Connect to MetaMask

Learn how to implement the connect to MetaMask feature in a web application.

Before we can read blockchain data or send transactions to our smart contract, we need to connect our application to MetaMask. If this process succeeds, our application will be able to get the user’s account address and send transactions signed with the user’s private key to the Ethereum network.

This is exactly what we'll implement in this lesson, and this will be the last hurdle before we can access the Auction smart contract from the web application.

Connecting to MetaMask

The process of connecting to MetaMask is initiated by a web application. To initiate a connection flow, we need to call requestAccounts from the web3.js library:

Get hands-on with 1200+ tech skills courses.