Installation and Configuration
Setting up the Axiom SDK
To send an on-chain query into Axiom, you'll use the Axiom SDK. Constructing and submitting a query proceeds in three steps. You can also check out our starter repo at axiom-quickstart
which helps you submit your first test query as quickly as possible.
SDK Installation
Start by installing the Axiom SDK:
SDK Configuration
To initialize the Axiom
class, first create an AxiomConfig
object, which requires:
providerUri
: a JSON-RPC provider URI (e.g. from Infura or Alchemy)A local Geth node would have format
http://127.0.0.1:8545
A Infura URI would have format
https://mainnet.infura.io/v3/<INFURA_ID>
A Alchemy URI would have format
https://eth-mainnet.g.alchemy.com/v2/<ALCHEMY_KEY>
chainId
: thechainId
of the EVM chainWe currently support
1
for mainnet and5
for Goerli testnet
The Axiom
class will enable all further interactions with the SDK.
The Axiom class includes several convenience methods for interacting with the onchain contracts and wraps calls to the Axiom API, which serves on-chain data that we have indexed for convenience. All data fetched from the Axiom API can always be replicated trustlessly from a standard archive node.
Ethers Installation and Configuration
Install Ethers.js with the following command:
Configure ethers in your project. We'll use ethers to submit our query onchain.
Make sure the providerUri
that you provide matches with the chainId
value passed in at the top of the config
object (so if chainId
is 5, then provide a providerUri
for Goerli).
Last updated