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

Jason Win
Covalent
Published in
8 min readApr 29, 2021

--

Today I will analyze the final, third part of the Wallet Puzzle Challenge quest and sum up the personal results of this competition!

Read Part 1 and Part 2.

The third round was the easiest and fastest for me. I think it took me no more than 20 minutes to complete the entire quest. Although I did not try to do it quickly, nevertheless it is nice to feel confident.

Let’s start the analysis.

The Wallet Puzzle Challenge 3.

In this quest, the Wallet challenge gives us the steps by which we can find the correct link to the secret room.

Step 1.Find the contract address (0xabc…) of the CryptoSeal (SEAL) NFT token on the Avalanche C-Chain.

Find a contract on the Avalanche C-Chain network? What could be easier, because I am already a professional in finding contracts in this network. Click on the link: https://cchain.explorer.avax.network/

Our contract 0x0540E4EE0C5CdBA347C2f0E011ACF8651bB70Eb9

Step 2. Determine the token_id of this NFT token. You will need this value to build the secret room URL.

This is a very important step because you will need the result to enter the secret room.

After I clicked on the link. I found myself on a page that makes it absolutely clear that if you want to get further information, you need to connect to the C-Chain network.

Well, there is no way out, I had to look for instructions on connecting to the C-Chain network using Metamask.

The blue writing is a link to the tweet — instructions. Here is the direct link -https://tradingtoolcrypto.medium.com/how-to-use-metamask-with-avalanche-avax-e5db94d749b

After that, I opened a page with the necessary information.

So, we have the first part of the puzzle.

token_id — 2514

Agree, it’s all quite simple.

Step 3. Determine the block_height when the NFT from step 2 was transferred to the current owner.

So, how do I find this block?

Well, to begin with, it makes sense that we need to find this transaction where the token was transferred to the last owner. Accordingly, we need to find all transactions for this token and see the last transfer. I went to the explorer, tried to somehow “play” with the search, but everything was unsuccessful.

Suddenly, I had an idea!

We have the contract address that we found in step 1. Going to the contract page, we see something like this.

However, if we look more closely, we can see transactions for certain TokenID from below.

I click on the number of any TokenID and a window opens with a transaction for that token.

Let’s say I chose TokenID 4583. However, we need another. To do this, I change the number 4583 in the browser line to the 2514 which we need in this instance, and now we see the transactions for the token we need.

Here is a direct link to the token transactions: https://cchain.explorer.avax.network/tokens/0x0540e4ee0c5cdba347c2f0e011acf8651bb70eb9/instance/2514/token-transfers

As you can see, there is only one transaction at the block height:

#717770

Step 4. NFTs can be sold in marketplaces and when doing so,there is a special event emitted by the smart contract. In the case of CryptoSeals, the event emitted when placing an NFT in their marketplace for sale is called ForSale which has a specific topic hash. Find the number of NFT CryptoSeal NFTs which have been placed in the marketplace ForSale between the block_height fetched in step 3 until April 1, 2021 0:00AM UTC. You will need this value, nfts_for_sale to build your URL.

The fun begins! At this step, we return to the Covalent API interface, where the main events will take place!

After reading the task several times, I realized that here we will again have to search for data on the Topic Hash.

Thanks to the experience of the last round, it was quite easy to do this.

First of all, I need to find the Topic Hash that corresponds to the transaction “For sale”. I did all this in the previous round.

Here you can find an overview of the second round: https://dice40568.medium.com/overview-of-covalent-features-on-the-example-of-avalanche-in-a-joint-quest-wallet-puzzle-544f2b289210

I then proceed to the contract page with the logs: https://cchain.explorer.avax.network/address/0x0540E4EE0C5CdBA347C2f0E011ACF8651bB70Eb9/logs

And I’m looking for the right Topic Hash.

I found a couple of transactions, made sure that they are included in the “For Sale” category and see their general Topic Hash:

0x454a59b1e51b1685e697faeca2a404382f4dcb9970aece78299147857e150393

Now we have all the data to request in the Covalent API.

Go to the familiar section Get Log events by topic hash(es), on the Covalent API page: https://www.covalenthq.com/docs/api/#get-/v1/{chain_id}/events/topics/{topic}/

And enter the data.

I will not describe each tab, we have already gone through all this in the previous rounds. If you are reading about this for the first time, go back to the previous reviews.

Round 1: https://link.medium.com/8yU1RY55Cfb

Round 2: https://link.medium.com/7ogRD99OIfb

I will only note that in the sender address tab, we will enter the address of the SEAL contract: 0x0540E4EE0C5CdBA347C2f0E011ACF8651bB70Eb9

starting block — by condition, the block that we found in step 3, i.e. #717770

ending-block April 1, 2021 0:00AM UTC. This block can also be found in the explorer. And this step is also described in the last round, i.e. #875518

https://avascan.info/blockchain/c/block/875518

As a result, my query looks like this.

I copied the data to Excel and got the following result:

I got 4487 lines, but 1 line is a description of the positions. Therefore, we have 4486 operations. Due to the fact that the query immediately implied a search for the final result, we do not need to make a further selection here. We found the right number.

4486

Step 5. When an NFT is bought, a Bought event is emitted,which has its own specific topic hash. For this step, find the number of CryptoSeal NFTs which have been bought between the block_height fetched in step 3 until April 1, 2021 0:00AM UTC. You will need this value, nfts_bought to build your URL.

I think you guessed that this step is identical to the previous one, you just need to change the Topic Hash. Finding the Topic Hash for the “Bought” event. I had to search a little in the logs, but in the end, I found it.

0x3ccb2ab6980b218b1dd4974b07365cd90a191e170c611da46262fecc208bd661

Now you need to make a request to the Covalent API again. Everything is the same as last time, we only change the Topic Hash.

The result is copied to Excel. As you can see below, we have 543 lines. We remove the top one with the description and get 542 lines, which means 542 transactions that meet the conditions of the problem.

The found number is
542

Step 6. Within the same block range as the latest step, determine the wallet address of the last buyer of a CryptoSeal (i.e the NFT purchased closest to April 1, 2021 0:00AM UTC). You will need this value, buyer_address to build your URL.

Now we need to dig into the last transaction to find the address of the last buyer. I looked at the last transaction, but there was no address, but there was a Hash of the transaction.

How convenient and fast it all is! Knowing the hash, the transaction is not difficult to find.

By entering the Hash number in the search bar, we get a transaction with the necessary information.

https://cchain.explorer.avax.network/tx/0xbd7658c64fa894e0fa00872fdecec785ab9dabb4b3b5a27a9f831cea41add0c7/token-transfers

At the very end, you can see the details, namely, to which address the token was sent.

As a result, we get the desired address:
0x8De3990D94691CaB1DE6EC00142D9aA2415D41EC

Step 7.Putting all your values together, your secret room with the next task will be unlocked at the website: www.onemillionwallets.com/{token_id}-{nfts_for_sale}-{nfts_bought}-{buyer_address}For example, if you have:token_id from step 2: 1nfts_for_sale from step 4: 100nfts_bought from step 5: 100buyer_address from step 6: 0xc43ee4634Aed3796971ccE43e64b696D4de4ca83Then your URL will be:www.onemillionwallets.com/1-100-100-0xc43ee4634Aed3796971ccE43e64b696D4de4ca83

In fact, this is just a complete description, in what order and how we should use the found values to get the correct link of the secret room.

What we have:

token_id from step 2: 2514

nfts_for_sale from step 4: 4486

nfts_bought from step 5: 542

buyer_address from step 6: 0x8de3990d94691cab1de6ec00142d9aa2415d41ec

As a result, we get our link:

www.onemillionwallets.com/2514-4486-542-0x8de3990d94691cab1de6ec00142d9aa2415d41ec

Yeah!

I did it for the third time!

There was a special joy, because in this round, everything turned out without hints and from the first time.

In the secret room, I was waiting for an interesting puzzle!

The room is still available, and you can try to collect it!

And here’s what happened at the very end:

With the last puzzle, over and this amazing, cool and informative series of quests is over!

My tweet: https://twitter.com/Raptor2799/status/1383308473962668044

Please like and retweet! It was really cool!

In conclusion, I would like to say that I participated in this series, not because of the prizes and awards. For today, the results have already been announced and I managed to win $100, which I am certainly happy about, but the main thing for me was not this!

I took part because I love and know Avalanche. I took part because I see a huge potential in Covalent, which is difficult to fully assess. I really wanted to be a part of this story and try out a product called Covalent API from the inside.

I want to assure you, friends, there is nothing complicated in this. I decided to write this review, because in a few years, looking at Covalent in the TOP 10 market cap, I want to remember where it all started!

Thank you if you read it to the end!

--

--