Overview - Tools you need to work with Chainbase
- A free account at Chainbase with an API key.
- An IDE. Our examples are shown in JavaScript, you can use VS Code as your IDE for example.
- A known wallet address as your input.
Step 1: Set up a free account at Chainbase
To better leverage the ability that Chainbase provides, you can register here for a free account and access to different APIs and data cloud. After logging into Chainbase, visit the dashboard to get an overview. Create a new project in the console and get an API key.
Step 2: Write script using Chainbase API
- Using
fetch
in JavaScript.
- Using
axios
in JavaScript. You need to installaxios
usingnpm install axios --save
in the terminal first.
Step 3: Print native token balances
Chainbase API Get native token balances takes the chain id and wallet address as parameters, and returns the value of native token balances. To get data printed, run commandnode <filename>.js
in the terminal. In this case, the native token balances of Vitalik’s wallet on Ethereum is 0x122b7e019d9a0431a15
by the time of Mar. 17th, 2023.