Interacting with the Blockchain

Learn how to integrate the Web3 module into the app.

Setting up the blockchain

We’ll be using the Web3 library to interact with the blockchain. We’ll import this library at the top of our index file.

import Web3 from "web3";

We can instantiate this Web3 object by passing window.ethereum to it. This way, we’re instructing Web3 to connect to the blockchain using MetaMask.

Press + to interact

If the window.ethereum object doesn’t exist, there isn’t much we ...