First you need to include web3, js in your project. To verify that we have correctly configured our web3 instance, we will try to retrieve the last block number using the GetBlockNumber function. This function accepts a callback as a parameter and returns the block number as an integer. You can see all the features that are available in the web3 instance in the official web3 documentation.
Most Web3 libraries are asynchronous because, in the background, the library makes JSON RPC calls to the node that returns the result. If you're working in the browser, some wallets directly inject a web3 instance and you should try to use it whenever possible, especially if you plan to interact with the user's Ethereum address to make transactions. While Ethereum has been trying to scale, it has encountered some problems with gasoline prices. A lot of layer 2 and sidechain solutions emerged to solve this problem, but Ethereum is the main chain and, at some point, needs to be improved.
Ganache is a client of Node, js Ethereum for testing and developing smart contracts. Because it's based on Node, js, we need Node, js to be installed together with NPM (Node Package Manager) to install it.
Leave a Comment