<divclass="link title"><ahref="/v5/">Documentation</a></div><divclass="base show link depth-1"><ahref="/v5/getting-started/">Getting Started</a></div><divclass="base show link depth-1"><ahref="/v5/concepts/">Ethereum Basics</a></div><divclass="hide link depth-2"><ahref="/v5/concepts/events/">Events</a></div><divclass="hide link depth-2"><ahref="/v5/concepts/gas/">Gas</a></div><divclass="hide link depth-2"><ahref="/v5/concepts/security/">Security</a></div><divclass="base ancestor show link depth-1"><ahref="/v5/api/">Application Programming Interface</a></div><divclass="show link depth-2"><ahref="/v5/api/contract/">Contract Interaction</a></div><divclass="hide link depth-3"><ahref="/v5/api/contract/contract/">Contract</a></div><divclass="hide link depth-3"><ahref="/v5/api/contract/contract-factory/">ContractFactory</a></div><divclass="hide link depth-3"><ahref="/v5/api/contract/example/">Example: ERC-20 Contract</a></div><divclass="show link depth-2"><ahref="/v5/api/signer/">Signers</a></div><divclass="ancestor show link depth-2"><ahref="/v5/api/providers/">Providers</a></div><divclass="show link depth-3"><ahref="/v5/api/providers/provider/">Provider</a></div><divclass="show link depth-3"><ahref="/v5/api/providers/jsonrpc-provider/">JsonRpcProvider</a></div><divclass="myself ancestor ancestor show link depth-3"><ahref="/v5/api/providers/api-providers/">API Providers</a></div><divclass="show link depth-3"><ahref="/v5/api/providers/other/">Other Providers</a></div><divclass="show link depth-3"><ahref="/v5/api/providers/types/">Types</a></div><divclass="show link depth-2"><ahref="/v5/api/utils/">Utilities</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/abi/">Application Binary Interface</a></div><divclass="hide link depth-4"><ahref="/v5/api/utils/abi/coder/">AbiCoder</a></div><divclass="hide link depth-4"><ahref="/v5/api/utils/abi/formats/">ABI Formats</a></div><divclass="hide link depth-4"><ahref="/v5/api/utils/abi/fragments/">Fragments</a></div><divclass="hide link depth-4"><ahref="/v5/api/utils/abi/interface/">Interface</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/address/">Addresses</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/bignumber/">BigNumber</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/bytes/">Byte Manipulation</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/constants/">Constants</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/display-logic/">Display Logic and Input</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/encoding/">Encoding Utilities</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/fixednumber/">FixedNumber</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/hashing/">Hashing Algorithms</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/hdnode/">HD Wallet</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/logger/">Logging</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/properties/">Property Utilities</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/signing-key/">Signing Key</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/strings/">Strings</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/transactions/">Transactions</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/web/">Web Utilities</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/wordlists/">Wordlists</a></div><divclass="show link depth-2"><ahref="/v5/api/other/">Other Libraries</a></div><divclass="hide link depth-3"><ahref="/v5/api/other/assembly/">Assembly</a></div><divclass="hide link depth-4"><ahref="/v5/api/other/assembly/dialect/">Ethers ASM Dialect</a></div><divclass="hide link depth-4"><ahref="/v5/api/other/assembly/api/">Utilities</a></div><divclass="hide link depth-4"><ahref="/v5/api/other/assembly/ast/">Abstract Syntax Tree</a></div><divclass="hide link depth-3"><ahref="/v5/api/other/hardware/">Hardware Wallets</a></div><divclass="sho
<aname="api-providers"></a><aname="api-providers"></a><h1class="show-anchors"><div>API Providers<divclass="anchors"><aclass="self"href="/v5/api/providers/api-providers/#api-providers"></a></div></div></h1><p>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.</p>
<p>However, this reliance on third-party services can reduce resiliance, security and increase the amount of required trust. To mitigate these issues, it is recommended you use a <ahref="/v5/api/providers/#providers-getDefaultProvider">Default Provider</a>.</p>
<aname="EtherscanProvider"></a><aname="api-providers--EtherscanProvider"></a><h2class="show-anchors"><div>EtherscanProvider<spanclass="inherits"> inherits <ahref="/v5/api/providers/provider/">Provider</a></span><divclass="anchors"><aclass="self"href="/v5/api/providers/api-providers/#EtherscanProvider"></a><aclass="source"href="https://github.com/ethers-io/ethers.js/blob/master/packages/providers/src.ts/etherscan-provider.ts#L76">source</a></div></div></h2><p>The <b>EtherscanProvider</b> is backed by a combination of the various <ahref="https://etherscan.io/apis">Etherscan APIs</a>.</p>
<divclass="property show-anchors"><divclass="signature"><spanclass="modifier">new </span><spanclass="path">ethers</span><spanclass="symbol">.</span><spanclass="path">providers</span><spanclass="symbol">.</span><spanclass="method">EtherscanProvider</span><spanclass="symbol">(</span><spanclass="symbol">[</span><spanclass="param">network</span> = "<spanclass="param">homestead</span>" <spanclass="symbol">,</span><spanclass="symbol">[</span><spanclass="param">apiKey</span><spanclass="symbol">]</span><spanclass="symbol">]</span><spanclass="symbol">)</span><divclass="anchors"></div></div><divclass="body"><p>Create a new <b>EtherscanProvider</b> connected to <i>network</i> with the optional <i>apiKey</i>.</p>
<p>The <i>network</i> may be specified as <b>string</b> for a common network name, a <b>number</b> for a common chain ID or a [Network Object]provider-(network).</p>
<p>If no <i>apiKey</i> 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 <ahref="https://etherscan.io">Etherscan</a> for your own API key.</p>
</div></div><divclass="definition container-box note"><divclass="term">Note: Default API keys</div><divclass="body"><p>If no <i>apiKey</i> is provided, a shared API key will be used, which may result in reduced performance and throttled requests.</p>
<p>It is highly recommended for production, you register with <ahref="https://etherscan.io">Etherscan</a> for your own API key.</p>
</div><divclass="property show-anchors"><divclass="signature"><spanclass="path">provider</span><spanclass="symbol">.</span><spanclass="method">getHistory</span><spanclass="symbol">(</span><spanclass="param">address</span><spanclass="symbol">)</span><spanclass="arrow">⇒</span><spanclass="returns">Array< History ></span><divclass="anchors"><aclass="source"href="https://github.com/ethers-io/ethers.js/blob/master/packages/providers/src.ts/etherscan-provider.ts#L306">source</a></div></div><divclass="body"><p>@TODO... Explain</p>
</div></div><aname="InfuraProvider"></a><aname="api-providers--InfuraProvider"></a><h2class="show-anchors"><div>InfuraProvider<spanclass="inherits"> inherits <ahref="/v5/api/providers/other/#UrlJsonRpcProvider">UrlJsonRpcProvider</a></span><divclass="anchors"><aclass="self"href="/v5/api/providers/api-providers/#InfuraProvider"></a><aclass="source"href="https://github.com/ethers-io/ethers.js/blob/master/packages/providers/src.ts/infura-provider.ts#L17">source</a></div></div></h2><p>The <b>InfuraProvider</b> is backed by the popular <ahref="https://infura.io">INFURA</a> Ethereum service.</p>
<divclass="property show-anchors"><divclass="signature"><spanclass="modifier">new </span><spanclass="path">ethers</span><spanclass="symbol">.</span><spanclass="path">providers</span><spanclass="symbol">.</span><spanclass="method">InfuraProvider</span><spanclass="symbol">(</span><spanclass="symbol">[</span><spanclass="param">network</span> = "<spanclass="param">homestead</span>" <spanclass="symbol">,</span><spanclass="symbol">[</span><spanclass="param">apiKey</span><spanclass="symbol">]</span><spanclass="symbol">]</span><spanclass="symbol">)</span><divclass="anchors"><aclass="source"href="https://github.com/ethers-io/ethers.js/blob/master/packages/providers/src.ts/infura-provider.ts#L17">source</a></div></div><divclass="body"><p>Create a new <b>InfuraProvider</b> connected to <i>network</i> with the optional <i>apiKey</i>.</p>
<p>The <i>network</i> may be specified as <b>string</b> for a common network name, a <b>number</b> for a common chain ID or a [Network Object]provider-(network).</p>
<p>The <i>apiKey</i> can be a <b>string</b> Project ID or an <b>object</b> with the properties <codeclass="inline">projectId</code> and <codeclass="inline">projectSecret</code> to specify a <ahref="https://infura.io/docs/gettingStarted/authentication">Project Secret</a> which can be used on non-public sources (like on a server) to further secure your API access and quotas.</p>
</div></div><aname="InfuraProvider-getWebSocketProvider"></a><divclass="property show-anchors"><divclass="signature"><spanclass="path">InfuraProvider</span><spanclass="symbol">.</span><spanclass="method">getWebSocketProvider</span><spanclass="symbol">(</span><spanclass="symbol">[</span><spanclass="param">network</span><spanclass="symbol">[</span><spanclass="symbol">,</span><spanclass="param">apiKey</span><spanclass="symbol">]</span><spanclass="symbol">]</span><spanclass="symbol">)</span><spanclass="arrow">⇒</span><spanclass="returns"><ahref="/v5/api/providers/other/#WebSocketProvider">WebSocketProvider</a></span><divclass="anchors"><aclass="self"href="/v5/api/providers/api-providers/#InfuraProvider-getWebSocketProvider"></a><aclass="source"href="https://github.com/ethers-io/ethers.js/blob/master/packages/providers/src.ts/infura-provider.ts#L21">source</a></div></div><divclass="body"><p>Create a new <ahref="/v5/api/providers/other/#WebSocketProvider">WebSocketProvider</a> using the INFURA web-socket endpoint to connect to <i>network</i> with the optional <i>apiKey</i>.</p>
<p>The <i>network</i> and <i>apiKey</i> are specified the same as <ahref="/v5/api/providers/api-providers/#InfuraProvider">the constructor</a>.</p>
</div></div><divclass="definition container-box note"><divclass="term">Note: Default API keys</div><divclass="body"><p>If no <i>apiKey</i> is provided, a shared API key will be used, which may result in reduced performance and throttled requests.</p>
<p>It is highly recommended for production, you register with <ahref="https://infura.io">INFURA</a> for your own API key.</p>
</div><aname="AlchemyProvider"></a><aname="api-providers--AlchemyProvider"></a><h2class="show-anchors"><div>AlchemyProvider<spanclass="inherits"> inherits <ahref="/v5/api/providers/other/#UrlJsonRpcProvider">UrlJsonRpcProvider</a></span><divclass="anchors"><aclass="self"href="/v5/api/providers/api-providers/#AlchemyProvider"></a><aclass="source"href="https://github.com/ethers-io/ethers.js/blob/master/packages/providers/src.ts/alchemy-provider.ts#L20">source</a></div></div></h2><p>The <b>AlchemyProvider</b> is backed by <ahref="https://alchemyapi.io">Alchemy</a>.</p>
<divclass="property show-anchors"><divclass="signature"><spanclass="modifier">new </span><spanclass="path">ethers</span><spanclass="symbol">.</span><spanclass="path">providers</span><spanclass="symbol">.</span><spanclass="method">AlchemyProvider</span><spanclass="symbol">(</span><spanclass="symbol">[</span><spanclass="param">network</span> = "<spanclass="param">homestead</span>" <spanclass="symbol">,</span><spanclass="symbol">[</span><spanclass="param">apiKey</span><spanclass="symbol">]</span><spanclass="symbol">]</span><spanclass="symbol">)</span><divclass="anchors"></div></div><divclass="body"><p>Create a new <b>AlchemyProvider</b> connected to <i>network</i> with the optional <i>apiKey</i>.</p>
<p>The <i>network</i> may be specified as <b>string</b> for a common network name, a <b>number</b> for a common chain ID or a <ahref="/v5/api/providers/types/#providers-Network">Network Object</a>.</p>
</div></div><divclass="definition container-box note"><divclass="term">Note: Default API keys</div><divclass="body"><p>If no <i>apiKey</i> is provided, a shared API key will be used, which may result in reduced performance and throttled requests.</p>
<p>It is highly recommended for production, you register with <ahref="https://alchemyapi.io">Alchemy</a> for your own API key.</p>
</div><aname="CloudflareProvider"></a><aname="api-providers--CloudflareProvider"></a><h2class="show-anchors"><div>CloudflareProvider<spanclass="inherits"> inherits <ahref="/v5/api/providers/other/#UrlJsonRpcProvider">UrlJsonRpcProvider</a></span><divclass="anchors"><aclass="self"href="/v5/api/providers/api-providers/#CloudflareProvider"></a><aclass="source"href="https://github.com/ethers-io/ethers.js/blob/master/packages/providers/src.ts/cloudflare-provider.ts#L10">source</a></div></div></h2><p>The CloudflareProvider is backed by the <ahref="https://developers.cloudflare.com/distributed-web/ethereum-gateway/">Cloudflare Ethereum Gateway</a>.</p>
<divclass="property show-anchors"><divclass="signature"><spanclass="modifier">new </span><spanclass="path">ethers</span><spanclass="symbol">.</span><spanclass="path">providers</span><spanclass="symbol">.</span><spanclass="method">CloudflareProvider</span><spanclass="symbol">(</span><spanclass="symbol">)</span><divclass="anchors"></div></div><divclass="body"><p>Create a new <b>CloudflareProvider</b> connected to mainnet (i.e. "homestead").</p>
<divclass="copyright">The content of this site is licensed under the <ahref="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>