📕
A closer look at Chi GasToken
  • What is Chi?
  • Prerequisites
  • First Covalent API call
  • Spot a mint/burn/transfer
  • Mints, burns and transfers
  • Closing thoughts
Powered by GitBook
On this page
  • Step 1: Get the token address
  • Step 2: Get the Ethereum chain id
  • Step 3: Get block heights for the 1st of May, 2021

Was this helpful?

First Covalent API call

PreviousPrerequisitesNextSpot a mint/burn/transfer

Last updated 4 years ago

Was this helpful?

Now that we are all set with the Covalent API key and an IDE to run code, let's start finding the answer for our question. So, how many Chi tokens were minted, burned and transferred on the 1st of May, 2021 on the Ethereum network?

Let's break it down in smaller steps so it's easier to follow..

Step 1: Get the token address

As mentioned previously, a simple search on etherscan.io will retrieve the contract address for the Chi GasToken 0x0000000000004946c0e9F43F4Dee607b0eF1fA1c

Step 2: Get the Ethereum chain id

We know that Chi is available on multiple networks so we need to get our hands on the Ethereum chain id. Looking at the Covalent documentation in the Supported Networks section and there we see that the chain id for Ethereum is 1.

Step 3: Get block heights for the 1st of May, 2021

Blockchain data is stored in blocks. This is a bit different from the traditional timestamp we are used to when querying data. The good news is that blocks have timestamps too and there is a Restful API that serves exactly this purpose, to provide a block based on the date you provide it: GET /v1/{chain_id}/block_v2/{start_date}/{end_date}/

We have all the necessary parameters to perform our first API call. I do suggest making this call in parallel from the browser on Covalent's documentation page so that it is easier to test and follow.

If we look at the response we'll notice the following: - the blocks are in ascending order so it's easy to spot the starting_block that we need; - it has pagination and contains a total_count that allows us to compute the ending_block without the need to make an additional call;

After running the code we get the block heights we need for the 1st of May, 2021, respectively starting_block = 12344945 and ending_block = 12351433

Tip! At the time of writing this article, the number of Ethereum Blocks Per Day is at a current level of 6463, up from 6425 yesterday and up from 6413 one year ago.

Now we are all set to have a closer look at the mints, burns and transfers for the Chi GasToken so make sure to follow this tutorial until the end.