What exactly is a provider? A provider is an instance of what we are using to connect to a node on a blockchain. To connect to a node, there are a couple of providers we can use. Lets just go over the basic ones like MetaMask and Infura.
Lets go over Infura first. Infura can be used anywhere. From a local script to a website online. How it works is that you grab your infura API key and with that you can create a new provider instance. This works well because you just need to plug in and go with it.
With MetaMask, you actually have to be on a browser. Since MetaMask is a browser extension, to access its API, you need to be on a browser with MetaMask enabled. If MetaMask is enabled, MetaMask will inject it's API into the DOM, accessible to us with window.ethereum
.
Top comments (0)