docs: updated API key info

This commit is contained in:
Richard Moore 2022-03-19 02:48:17 -04:00
parent 96de58122a
commit 9bff2cb3d9
5 changed files with 157 additions and 6 deletions

@ -25,7 +25,7 @@ free tier, which (depending on the service) includes many advantages:
- useful **metric tracking** for performance tuning and to analyze your customer behaviour
- more **advanced APIs**, such as archive data or advanced log queries
_subsection: Etherscan @<api-keys--etherscan>
_subsection: Etherscan @NOTE<(see the [[EtherscanProvider]])> @<api-keys--etherscan>
Etherscan is an Ethereum block explorer, which is possibly the most useful
developer tool for building and debugging Ethereum applications.
@ -40,7 +40,11 @@ operations required to interact with the Ethereum Blockchain.
- higher rate limit (since you are not using the [shared rate limit](link-etherscan-ratelimit))
- customer usage metrics
_subsection: INFURA @<api-keys--infura>
_definition: **Networks:**
``homestead``, ``ropsten``, ``rinkeby``, ``goerli`` and ``kovan``.
_subsection: INFURA @NOTE<(see the [[InfuraProvider]])> @<api-keys--infura>
The INFURA service has been around for quite some time and is very robust
and reliable and highly recommended.
@ -56,7 +60,13 @@ interaction with standard tools versatile, simple and straightforward.
- customer usage metrics
- access to archive data (requires paid upgrade)
_subsection: Alchemy @<api-keys--alchemy>
_definition: **Networks:**
``homestead``, ``ropsten``, ``rinkeby``, ``goerli``, ``kovan``, ``matic``,
``maticmum``, ``optimism``, ``optimism-kovan``, ``arbitrum`` and
``arbitrum-rinkeby``.
_subsection: Alchemy @NOTE<(see the [[AlchemyProvider]])> @<api-keys--alchemy>
The Alchemy service has been around a few years and is also very robust
and reliable.
@ -74,9 +84,17 @@ with debugging.
- access to advanced token balance and metadata APIs
- access to advanced debugging trace and revert reason APIs
_subsection: Pocket Gateway@<api-keys--pocket-gateway>
_definition: **Networks:**
``homestead``, ``ropsten``, ``rinkeby``, ``goerli``, ``kovan``, ``matic``,
``maticmum``, ``optimism``, ``optimism-kovan``, ``arbitrum`` and
``arbitrum-rinkeby``.
_subsection: Pocket Gateway @NOTE<(see the [[PocketProvider]])> @<api-keys--pocket-gateway>
They offer a standard JSON-RPC interface using either a load-balanced
network or non-load-balanced fleet.
[Sign up for a free API key on Pocket](link-pocket-signup)
**Benefits:**
@ -86,6 +104,26 @@ _subsection: Pocket Gateway@<api-keys--pocket-gateway>
- Stake as opposed to paying a monthly fee
- Highly redundant global set of nodes incentivized by cryptoeconomic incentives
_definition: **Networks:**
``homestead``
_subsection: Ankr @NOTE<(see the [[AnkrProvider]])> @<api-keys--ankr>
They offer a standard JSON-RPC interface and have fairly high capacity without
the need for an API key early on in the development cycle.
[See their free tier features on Ankr](link-ankr-public)
**Benefits:**
- higher rate limit
- customer usage metrics
- access to archive data (requires paid upgrade)
_definition: **Networks:**
``homestead``, ``matic`` and ``arbitrum``
_subsection: Creating a Default Provider @<api-keys--getDefaultProvider>
@ -100,6 +138,8 @@ using the default API key for that service.
It is **highly recommended** that you provide an API for each service, to
maximize your applications performance.
If the API key ``"-"`` is used, the corresponding Provider will be omitted.
_code: Passing API Keys into getDefaultProvider @lang<script>
// Use the mainnet
@ -122,5 +162,6 @@ const provider = ethers.getDefaultProvider(network, {
// pocket: {
// applicationId: ,
// applicationSecretKey:
// }
// },
ankr: YOUR_ANKR_API_KEY
});

@ -217,3 +217,98 @@ _code: Cloudflare Examples @lang<javascript>
// Connect to mainnet (homestead)
provider = new CloudflareProvider();
_subsection: PocketProvider @<PocketProvider> @inherit<[[UrlJsonRpcProvider]]> @src<providers:class.PocketProvider>
The **PocketProvider** is backed by [Pocket](link-pocket).
_property: new ethers.providers.PocketProvider([ network = "homestead", [ apiKey ] ])
Create a new **PocketProvider** 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](providers-Network).
_note: Note: Default API keys
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
[Pocket](link-pocket) for your own API key.
_definition: **Supported Networks**
- ``homestead`` - Homestead (Mainnet)
- ``ropsten`` - Ropsten (proof-of-work testnet)
- ``rinkeby`` - Rinkeby (proof-of-authority testnet)
- ``goerli`` - G&ouml;rli (clique testnet)
_code: Pocket Examples @lang<javascript>
//_hide: const PocketProvider = ethers.providers.PocketProvider;
//_hide: const applicationId = "...";
//_hide: const applicationSecretKey = "...";
//_hide: const loadBalancer = true;
// Connect to mainnet (homestead)
provider = new PocketProvider();
// Connect to the ropsten testnet
// (see EtherscanProvider above for other network examples)
provider = new PocketProvider("ropsten");
// Connect to mainnet with an Application ID (these are equivalent)
provider = new PocketProvider(null, applicationId);
provider = new PocketProvider("homestead", applicationId);
// Connect to mainnet with an application ID, application secret
// and specify whether to use the load balances
provider = new PocketProvider("homestead", {
applicationId: applicationId,
applicationSecretKey: applicationSecretKey,
loadBalancer: loadBalancer // true or false
});
_subsection: AnkrProvider @<AnkrProvider> @inherit<[[UrlJsonRpcProvider]]> @src<providers:class.AnkrProvider>
The **AnkrProvider** is backed by [Ankr](link-ankr).
_property: new ethers.providers.AnkrProvider([ network = "homestead", [ apiKey ] ])
Create a new **AnkrProvider** 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](providers-Network).
_note: Note: Default API keys
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
[Ankr](link-ankr) for your own API key.
_definition: **Supported Networks**
- ``homestead`` - Homestead (Mainnet)
- ``matic`` - Polygon
- ``arbitrum`` - Arbitrum (L2; optimistic roll-up)
_code: Ankr Examples @lang<javascript>
//_hide: const AnkrProvider = ethers.providers.AnkrProvider;
//_hide: const apiKey = "...";
// Connect to mainnet (homestead)
provider = new AnkrProvider();
// Connect to polygont
// (see EtherscanProvider above for other network examples)
provider = new AnkrProvider("matic");
// Connect to mainnet with an API Key (these are equivalent)
provider = new AnkrProvider(null, apiKey);
provider = new AnkrProvider("homestead", apiKey);

@ -68,6 +68,18 @@ _property: ipcProvider.path => string
The path this [[Provider]] is connected to.
_subsection: JsonRpcBatchProvider @<JsonRpcBatchProvider> @INHERIT<[[JsonRpcProvider]]> @SRC<providers:class.JsonRpcBatchProvider>
The **JsonRpcBatchProvider** operated identically to any other Provider,
except the calls are implicly batched during an event-loop and sent using
the JSON-RPC batch protocol to the backend.
This results in fewer connections and fewer requests, which may result
in lower costs or faster responses, depending on your use case.
Keep in mind some backends may not support batched requests.
_subsection: UrlJsonRpcProvider @<UrlJsonRpcProvider> @INHERIT<[[JsonRpcProvider]]> @SRC<providers:class.UrlJsonRpcProvider>
This class is intended to be sub-classed and not used directly. It

@ -226,6 +226,7 @@ module.exports = {
externalLinks: {
"link-mail": "mailto:me@ricmoo.com",
"link-alchemy": { name: "Alchemy", url: "https:/\/alchemyapi.io" },
"link-ankr": { name: "Ankr", url: "https:/\/www.ankr.com" },
"link-cloudflare": { name: "Cloudflare", url: "https:/\/developers.cloudflare.com/distributed-web/ethereum-gateway/" },
"link-ens": { name: "ENS", url: "https:/\/ens.domains/" },
"link-ethereum": { name: "Ethereum", url: "https:/\/ethereumorg" },
@ -250,6 +251,8 @@ module.exports = {
"link-sphinx": { name: "Sphinx", url: "https:/\/www.sphinx-doc.org/" },
"link-alchemy-signup": "https:/\/dashboard.alchemyapi.io/signup?referral=55a35117-028e-4b7c-9e47-e275ad0acc6d",
"link-ankr-public": "https:/\/www.ankr.com/protocol/public/",
"link-ankr-premium": "https:/\/www.ankr.com/protocol/plan/",
"link-etherscan-signup": "https:/\/etherscan.io/apis",
"link-etherscan-ratelimit": "https:/\/info.etherscan.com/api-return-errors/",
"link-infura-signup": "https:/\/infura.io/register",

@ -5,7 +5,7 @@ _section: TroubleShooting
_toc:
building
errors
networks
network
help
_subsection: About Trbouble-Shooting