Introduction to web3.jslearning manual

Published on 2023-04-20 00:10:05 · 中文 · بالعربية · Español · हिंदीName · 日本語 · Русский язык · 中文繁體

Developing an Ethereum blockchain application involves the following parts:
Smart contract development – Write code using the Solidity language and deploy to the blockchain. Website or client development – Interact with smart contracts in the blockchain, read and write data.
When developing websites or clients, you need to use web3 .js. Web3.js library is a JavaScript library that allows you to perform many tasks that interact with the blockchain, such as:
Ether transfers Read and write data in smart contracts Create a smart contract
If you have a background in web development, you should be familiar with the mechanics of using Ajax to communicate with web servers. Similar to Ajax, the Ethereum blockchain can be read and written using Web3 .js.
The blockchain network is a peer-to-peer network, the network is composed of individual nodes connected to each other, and the code and data of smart contracts are stored in the blockchain. With web3.js you can make a request to an Ethereum node in the blockchain network to interact with the blockchain network.
This process is shown in the following diagram:
web3.js原理
web3 .js uses JSON RPC to communicate with the Ethereum blockchain (JSON RPC is JSON remote call) to read and write data to the blockchain network. It's a bit like using the jQuery ajax library to read and write data on a web server.