Overview of Covalent API features: Solving the #OneMillionWallets Avalanche Wallet Puzzle Challenge as a case study. Part 1.

Jason Win
Covalent
Published in
7 min readApr 21, 2021

--

The market is very busy right now, and there are a lot of new projects that deserve attention. However, for me — an ordinary user, without programming skills, only the real user experience is important.

Recently, I became interested in the Covalent project, which has been developed for several years and in fact is already working in full. But let’s talk about everything in order!

Covalent — a single API that allows you to pull detailed, granular blockchain transaction data from multiple blockchains with no code.

In fact, to put it quite simply, thanks to Covalent, each person, developing their project or application, or just a page on the network, can use data from different blockchains, without knowing the code, simply by inserting the necessary piece of API code, which Covalent will create automatically based on your request.

Covalent indexes absolutely everything: blockchains, individual contracts, every transaction, every wallet address, and much more. This is a huge amount of information that Covalent analyzes and updates, attention!

EVERY 30 SECONDS!

Another cool feature is that requests can be combined for any situation and any project.

Difficult?

If you are not a developer or a tech-savvy user, you may think it all a complex system that you need to delve into!

Believe me, I also thought so, until I participated in an interesting challenge from Covalent, which they conducted together, with an equally cool project — Avalanche, as part of a large hackathon called #OneMillionWallets.

In this series of articles, I will tell you about the three stages of the Wallet Puzzle challenges in which I was able to participate and which I successfully solved all.

Wallet Puzzle Challenge Round 1

In this round, I had to use Covalent’s API capabilities for the first time in practice, to solve a puzzle. It is in this format that the information is absorbed best and the understanding of the project becomes much higher!

Task:
1. Find the contract address (0xABC…) of the Wrapped AVAX (WAVAX) token on the Avalanche C-Chain. Note — there are multiple tokens with the same label so find the contract address of the token with the greater number of token holders and transaction volume.
2. Find the number of new non-zero WAVAX token holders since March 1, 2021 0:00AM UTC until now (block height — 973950) . Convert this number to binary.3. Your secret room with the next task will be unlocked at the website:www.onemillionwallets.com/{contract_address}-{binary_number}- using your contract address from step 1 and the binary number from step 2.- Hint: Read the Covalent API Docs on Class A endpoints (www.covalenthq.com/docs/api)

From my experience of participating in quests, when you read the task for the first time, at first it may seem that everything is very unclear and difficult, but the main task is to gradually understand each detail and put them together. In this task, everything has already been done for us, we just need to step through both steps and apply the values found.

  1. In the first step, we need to find the correct address of the WAVAX contract in the Avalanche C-Chain network. This is done quite simply. Go to the network explorer https://cchain.explorer.avax.network/ and we score the necessary token. In the task, they warn us that we may see two addresses and we need an address with more activity.

Opening both addresses in turn, it is easy to understand that I need this one: 0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7

2. The fun begins! But how do we find new WAVAX holders, and in a certain period of time? This is where we need to use the Covalent API. The hint says that we need this document www.covalenthq.com/docs/api, go there.

We find Class A, which was also given to us in the hint, and try to understand which interface we will use for our situation. After reading all sorts of scenarios for class A, it’s not hard to guess that we need this “Get changes in token holders between two block heights” option.

If you carefully study this page, everything becomes very clear.

  • chain_id — the number of the network where the search will take place. We are given directly in the interface.
  • address string is the address of our contract.
  • starting-block — the starting point of reference. That is, according to the terms, this is the block from March 1, 2021, 00:00:00 UTC.
  • ending-block — the end point that is given in the condition.
  • page-number — the page number that I want to output. If left empty, it will return a null page by default.
  • page-size — the number of results per page. You can enter a huge number and get the whole result at once on one page.
  • format — the default response format is json. If you specify the csv format, the result can be copied to any spreadsheet, which is very convenient for later analysis.

So, of all the data, I don’t have only the starting-block, but I know the date that I need to focus on. Here we see the relevance of blockchains as open and transparent because everything is in the public domain. Since everything happens in Avalanche C-Chain, I then need to explore the Avalanche network to find the right block. I use the Ava Scan tool to source the information https://avascan.info/blockchain/c/blocks

Unfortunately, the Ava Scan interface does not allow you to specify the desired page, so you need to do this in the browser bar.

After several attempts to find the required page, I found the desired number.

Now we have all the data to make a call.

A small life hack: As you can see, in the page-size line, I specified a large number, because I want to get the entire result on one page at once. If it was a large request, a weak computer can take a very long time to process it, or even freeze. If your PC is not very powerful, it is better to put some optimal number like 1000 and search for the result page by page.

After I clicked “TRY”, my computer got the answer, which I’m going to copy to Excel.

I got 1338 results (1139–1, because the first line was occupied with the description).

Here at this step, I made a mistake because of which I could not understand for two hours why I could not go to the next step. The whole point is that I did not carefully read the condition. I needed to find exactly the NEW WAVAX holders, that is, those whose balance was initially zero, and then became larger. The selection had to be made, exactly for this indicator. Thanks to the support I got in the Covalent discord, I was still able to understand the correct calculation logic, and after some simple manipulations in Excel, I got the right number.

3. Well, we have all the necessary data, and only the last step remains. You need to convert the number 674 to binary format. To do this, you can use any online converter. We get 1010100010

Finally right!

https://www.onemillionwallets.com/0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7-1010100010

After clicking on the secret link, we finally get to the secret room!

Whooooooo!!!!!!

At the second stage, I had to solve a crossword puzzle based on the knowledge of the Covalent and Avalanche projects.

It wasn’t difficult for me, and I did it quickly. Although the challenge is over, the crossword puzzle is still available here. You can pass it to test yourself.

In conclusion, I wrote a tweet about this cool event!

If you liked this review — like and retweet:)

Thanks to this quest, I learned the basics of working with the Covalent API, I think this is the coolest training format.

In the next article, I will share with you some thoughts about this and show you what was waiting for me in the second round of this quest!

A small spoiler. This was the most difficult round.

See you later!

--

--