There are many services which offer a web API for accessing the Ethereum Blockchain. These Providers allow connecting to them, which simplifies development, since you do not need to run your own instance or cluster of Ethereum nodes.
However, this reliance on third-party services can reduce resilience, security and increase the amount of required trust. To mitigate these issues, it is recommended you use a Default Provider.
The EtherscanProvider is backed by a combination of the various Etherscan APIs.
Create a new EtherscanProvider connected to network with the optional apiKey.
The network may be specified as a string for a common network name, a number for a common chain ID or a [Network Object]provider-(network).
If no apiKey is provided, a shared API key will be used, which may result in reduced performance and throttled requests. It is highly recommended for production, you register with Etherscan for your own API key.
If no apiKey is provided, a shared API key will be used, which may result in reduced performance and throttled requests.
It is highly recommended for production, you register with Etherscan for your own API key.
- Homestead (Mainnet)
- Ropsten (proof-of-work testnet)
- Rinkeby (proof-of-authority testnet)
- Görli (clique testnet)
- Kovan (proof-of-authority testnet)
@TODO... Explain
InfuraProvider inherits UrlJsonRpcProvider
The InfuraProvider is backed by the popular INFURA Ethereum service.
Create a new InfuraProvider connected to network with the optional apiKey.
The network may be specified as a string for a common network name, a number for a common chain ID or a [Network Object]provider-(network).
The apiKey can be a string Project ID or an object with the properties projectId
and projectSecret
to specify a Project Secret which can be used on non-public sources (like on a server) to further secure your API access and quotas.
Create a new WebSocketProvider using the INFURA web-socket endpoint to connect to network with the optional apiKey.
The network and apiKey are specified the same as the constructor.
If no apiKey is provided, a shared API key will be used, which may result in reduced performance and throttled requests.
It is highly recommended for production, you register with INFURA for your own API key.
- Homestead (Mainnet)
- Ropsten (proof-of-work testnet)
- Rinkeby (proof-of-authority testnet)
- Görli (clique testnet)
- Kovan (proof-of-authority testnet)
AlchemyProvider inherits UrlJsonRpcProvider
The AlchemyProvider is backed by Alchemy.
Create a new AlchemyProvider connected to network with the optional apiKey.
The network may be specified as a string for a common network name, a number for a common chain ID or a Network Object.
If no apiKey is provided, a shared API key will be used, which may result in reduced performance and throttled requests.
It is highly recommended for production, you register with Alchemy for your own API key.
- Homestead (Mainnet)
- Ropsten (proof-of-work testnet)
- Rinkeby (proof-of-authority testnet)
- Görli (clique testnet)
- Kovan (proof-of-authority testnet)
CloudflareProvider inherits UrlJsonRpcProvider
The CloudflareProvider is backed by the Cloudflare Ethereum Gateway.
Create a new CloudflareProvider connected to mainnet (i.e. "homestead").
- Homestead (Mainnet)