Skip to content

Commit c730cbc

Browse files
committed
docs: Added Provider api-keys page.
1 parent 4ef3fc5 commit c730cbc

File tree

3 files changed

+109
-0
lines changed

3 files changed

+109
-0
lines changed

docs.wrm/api-keys.wrm

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
_section: Provider API Keys @<api-keys>
2+
3+
//( **TL; DR** &ndash; sign up for your own API keys with the links below to improve your application performance )//
4+
5+
When using a [[Provider]] backed by an API service (such as [[link-alchemy]],
6+
[[link-etherscan]] or [[link-infura]]), the service requires an API key,
7+
which allows each service to track individual projects and their usage and
8+
permissions.
9+
10+
The ethers library offers default API keys for each service, so that each
11+
[[Provider]] works out-of-the-box.
12+
13+
These API keys are a provided as a community resource by the backend services
14+
for low-traffic projects and for early prototyping.
15+
16+
Since these API keys are shared by all users (that have not acquired their
17+
own API key), they are aggressively throttled which means reties occur more
18+
frequently and the responses are slower.
19+
20+
It is **highly recommended** that you sign up for a free API key from each service for their
21+
free tier, which (depending on the service) includes many advantages:
22+
23+
- a much **higher request rate** and concurrent request limit
24+
- **faster** responses with fewer retries and timeouts
25+
- useful **metric tracking** for performance tuning and to analyze your customer behaviour
26+
- more **advanced APIs**, such as archive data or advanced log queries
27+
28+
_subsection: Etherscan @<api-keys--etherscan>
29+
30+
Etherscan is an Ethereum block explorer, which is possibly the most useful
31+
developer tool for building and debugging Ethereum applications.
32+
33+
They offer an extensive collection of API endpoints which provide all the
34+
operations required to interact with the Ethereum Blockchain.
35+
36+
[Sign up for a free API key on Etherscan](link-etherscan-signup)
37+
38+
**Benefits:**
39+
40+
- higher rate limit (since you are not using the [shared rate limit](link-etherscan-ratelimit))
41+
- customer usage metrics
42+
43+
_subsection: INFURA @<api-keys--infura>
44+
45+
The INFURA service has been around for quite some time and is very robust
46+
and reliable and highly recommend.
47+
48+
They offer a standard JSON-RPC interface and a WebSocket interface, which makes
49+
interaction with standard tools versatile, simple and straight forward.
50+
51+
[Sign up for a free Project ID on INFURA](link-infura-signup)
52+
53+
**Benefits:**
54+
55+
- higher rate limit
56+
- customer usage metrics
57+
- access to archive data (requires paid upgrade)
58+
59+
_subsection: Alchemy @<api-keys--alchemy>
60+
61+
The Alchemy service has been around a few years and is also very robust
62+
and reliable.
63+
64+
They offer a standard JSON-RPC interface and a WebSocket interface, as well
65+
as a collection of advanced APIs for interacting with tokens and to assist
66+
with debugging.
67+
68+
[Sign up for a free API key on Alchemy](link-alchemy-signup)
69+
70+
**Benefits:**
71+
72+
- higher rate limit
73+
- customer usage metrics
74+
- access to advanced token balance and metadata APIs
75+
- access to advanced debugging trace and revert reason APIs
76+
77+
78+
_subsection: Creating a Default Provider @<api-keys--getDefaultProvider>
79+
80+
The [default provider](providers-getDefaultProvider) connects to multiple
81+
backends and verifies their results internally, making it simple to have
82+
a high level of trust in third-party services.
83+
84+
A second optional parameter allows API keys to be specified to each
85+
Provider created internally and any API key omitted will fallback onto
86+
using the default API key for that service.
87+
88+
It is **highly recommended** that you provide an API for each service, to
89+
maximize your applications performance.
90+
91+
_code: Passing API Keys into getDefaultProvider @lang<script>
92+
93+
// Use the mainnet
94+
const network = "homestead";
95+
96+
// Specify your own API keys
97+
// Each is optional, and if you omit it the default
98+
// API key for that service will be used.
99+
const provider = ethers.getDefaultProvider(network, {
100+
etherscan: YOUR_ETHERSCAN_API_KEY,
101+
infura: YOUR_INFURA_PROJECT_ID,
102+
alchemy: YOUR_ALCHEMY_API_KEY
103+
});

docs.wrm/config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ module.exports = {
188188
"link-solidity": { name: "Solidity" , url: "https:/\/solidity.readthedocs.io/en/v0.6.2/" },
189189
"link-sphinx": { name: "Sphinx", url: "https:/\/www.sphinx-doc.org/" },
190190

191+
"link-alchemy-signup": "https:/\/alchemyapi.io/signup",
192+
"link-etherscan-signup": "https:/\/etherscan.io/apis",
193+
"link-etherscan-ratelimit": "https:/\/info.etherscan.com/api-return-errors/",
194+
"link-infura-signup": "https:/\/infura.io/register",
195+
191196
"link-json-rpc": "https:/\/github.com/ethereum/wiki/wiki/JSON-RPC",
192197
"link-web3-send": "https:/\/github.com/ethereum/web3.js/blob/1.x/packages/web3-providers-http/types/index.d.ts#L57",
193198
"link-parity-trace": "https:/\/openethereum.github.io/wiki/JSONRPC-trace-module",

docs.wrm/index.wrm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ _toc:
3838

3939
getting-started
4040
concepts
41+
api-keys
4142
api
4243
cli
4344
cookbook

0 commit comments

Comments
 (0)