Step 1 – talking to the blockchain

Web3Js provides the web3 object that enables us to exploit the Web3 API functions in JavaScript. Therefore, the first action to take is to instantiate a web3 object as follows: var web3 = new Web3();

This object needs to be connected to an RPC provider to communicate with the blockchain. We set a local or remote web3 provider using web3.setProvider(new web3.providers.HttpProvider("http://RPC_IP:RPC_Port"));, where RPC_IP is the RPC provider's IP and RPC_Port is its RPC port.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset