<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="hide link depth-2"><ahref="/v5/concepts/best-practices/">Best Practices</a></div><divclass="base myself ancestor ancestor show link depth-1"><ahref="/v5/api-keys/">Provider API Keys</a></div><divclass="link show child depth-2"><ahref="#api-keys--etherscan">Etherscan</a></div><divclass="link show child depth-2"><ahref="#api-keys--infura">INFURA</a></div><divclass="link show child depth-2"><ahref="#api-keys--alchemy">Alchemy</a></div><divclass="link show child depth-2"><ahref="#api-keys--pocket-gateway">Pocket Gateway</a></div><divclass="link show child depth-2"><ahref="#api-keys--getDefaultProvider">Creating a Default Provider</a></div><divclass="base show link depth-1"><ahref="/v5/api/">Application Programming Interface</a></div><divclass="hide link depth-2"><ahref="/v5/api/providers/">Providers</a></div><divclass="hide link depth-3"><ahref="/v5/api/providers/provider/">Provider</a></div><divclass="hide link depth-3"><ahref="/v5/api/providers/jsonrpc-provider/">JsonRpcProvider</a></div><divclass="hide link depth-3"><ahref="/v5/api/providers/api-providers/">API Providers</a></div><divclass="hide link depth-3"><ahref="/v5/api/providers/other/">Other Providers</a></div><divclass="hide link depth-3"><ahref="/v5/api/providers/types/">Types</a></div><divclass="hide link depth-2"><ahref="/v5/api/signer/">Signers</a></div><divclass="hide 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="hide 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="hidel
<divclass="breadcrumbs"><ahref="/v5/">Documentation</a> » <spanclass="current">Provider API Keys</span></div>
<aname="api-keys"></a><aname="api-keys"></a><h1class="show-anchors"><div>Provider API Keys<divclass="anchors"><aclass="self"href="/v5/api-keys/#api-keys"></a></div></div></h1><p><i>( <b>TL; DR</b>– sign up for your own API keys with the links below to improve your application performance )</i></p>
<p>When using a <ahref="/v5/api/providers/provider/">Provider</a> backed by an API service (such as <ahref="https://alchemyapi.io">Alchemy</a>, <ahref="https://etherscan.io">Etherscan</a> or <ahref="https://infura.io">INFURA</a>), the service requires an API key, which allows each service to track individual projects and their usage and permissions.</p>
<p>The ethers library offers default API keys for each service, so that each <ahref="/v5/api/providers/provider/">Provider</a> works out-of-the-box.</p>
<p>Since these API keys are shared by all users (that have not acquired their own API key), they are aggressively throttled which means retries occur more frequently and the responses are slower.</p>
<p>It is <b>highly recommended</b> that you sign up for a free API key from each service for their free tier, which (depending on the service) includes many advantages:</p>
<p><ul><li>a much <b>higher request rate</b> and concurrent request limit </li><li><b>faster</b> responses with fewer retries and timeouts </li><li>useful <b>metric tracking</b> for performance tuning and to analyze your customer behaviour </li><li>more <b>advanced APIs</b>, such as archive data or advanced log queries </li></ul></p>
<aname="api-keys--etherscan"></a><aname="api-keys--api-keys--etherscan"></a><h2class="show-anchors"><div>Etherscan<divclass="anchors"><aclass="self"href="/v5/api-keys/#api-keys--etherscan"></a></div></div></h2><p>Etherscan is an Ethereum block explorer, which is possibly the most useful developer tool for building and debugging Ethereum applications.</p>
<p>They offer an extensive collection of API endpoints which provide all the operations required to interact with the Ethereum Blockchain.</p>
<p><ahref="https://etherscan.io/apis">Sign up for a free API key on Etherscan</a></p>
<p><b>Benefits:</b></p>
<p><ul><li>higher rate limit (since you are not using the <ahref="https://info.etherscan.com/api-return-errors/">shared rate limit</a>) </li><li>customer usage metrics </li></ul></p>
<aname="api-keys--infura"></a><aname="api-keys--api-keys--infura"></a><h2class="show-anchors"><div>INFURA<divclass="anchors"><aclass="self"href="/v5/api-keys/#api-keys--infura"></a></div></div></h2><p>The INFURA service has been around for quite some time and is very robust and reliable and highly recommended.</p>
<p>They offer a standard JSON-RPC interface and a WebSocket interface, which makes interaction with standard tools versatile, simple and straight forward.</p>
<p><ahref="https://infura.io/register">Sign up for a free Project ID on INFURA</a></p>
<p><b>Benefits:</b></p>
<p><ul><li>higher rate limit </li><li>customer usage metrics </li><li>access to archive data (requires paid upgrade) </li></ul></p>
<aname="api-keys--alchemy"></a><aname="api-keys--api-keys--alchemy"></a><h2class="show-anchors"><div>Alchemy<divclass="anchors"><aclass="self"href="/v5/api-keys/#api-keys--alchemy"></a></div></div></h2><p>The Alchemy service has been around a few years and is also very robust and reliable.</p>
<p>They offer a standard JSON-RPC interface and a WebSocket interface, as well as a collection of advanced APIs for interacting with tokens and to assist with debugging.</p>
<aname="api-keys--pocket-gateway"></a><aname="api-keys--api-keys--pocket-gateway"></a><h2class="show-anchors"><div>Pocket Gateway<divclass="anchors"><aclass="self"href="/v5/api-keys/#api-keys--pocket-gateway"></a></div></div></h2><p><ahref="https://pokt.network/pocket-gateway-ethereum-mainnet/">Sign up for a free API key on Pocket</a></p>
<p><b>Benefits:</b></p>
<p><ul><li>customer usage metrics </li><li>decentralized Access to Blockchain Infrastructure </li><li>Stake as opposed to paying a monthly fee </li><li>Highly redundant global set of nodes incentivized by cryptoeconomic incentives </li></ul></p>
<aname="api-keys--getDefaultProvider"></a><aname="api-keys--api-keys--getDefaultProvider"></a><h2class="show-anchors"><div>Creating a Default Provider<divclass="anchors"><aclass="self"href="/v5/api-keys/#api-keys--getDefaultProvider"></a></div></div></h2><p>The <ahref="/v5/api/providers/#providers-getDefaultProvider">default provider</a> connects to multiple backends and verifies their results internally, making it simple to have a high level of trust in third-party services.</p>
<p>A second optional parameter allows API keys to be specified to each Provider created internally and any API key omitted will fallback onto using the default API key for that service.</p>
<p>It is <b>highly recommended</b> that you provide an API for each service, to maximize your applications performance.</p>
<divclass="code-title"><div>Passing API Keys into getDefaultProvider</div></div><divclass="code"><spanclass="comment">// Use the mainnet
</span>const network = "homestead";
<spanclass="comment">// Specify your own API keys
</span><spanclass="comment">// Each is optional, and if you omit it the default
</span><spanclass="comment">// API key for that service will be used.
<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 February 8, 2021, 3:25pm.</div>