brtr / nft-hunter

0 stars 0 forks source link

Getting streaming data of NFT events on Eth blockchain [D: Hazel] #9

Open yaseenkhanmohmand opened 2 years ago

yaseenkhanmohmand commented 2 years ago

It seems we currently have a static list of projects on nft-hunter, can we make it so that we can get all Eth NFTs on the website. This will mean that viewers will have the ability to detect activity on new project as soon as new projects hit the market.

This will require using the nft/transfers api from moralis, which does not need an NFT contract address to provide transfers information. It instead only needs the block number and then provides live data based on what is happening on the block.

pan-xiong commented 2 years ago
  1. Fetch block transfers every 5 mins, save contract address if contract type is ERC721 and we don't have this address in the database
  2. Fetch NFT price and trades by contract address
yaseenkhanmohmand commented 2 years ago

image

Hi folks this api from moralis is very helpful. It gives all nft events.

Moralis APIs are a little unreliable, however. For example, this API stops working at times as in it will return an error or stop providing data for a second, (the correct response is 200, any other response is an error) so we need to failsafes in place if we pull from this.

iannono commented 2 years ago

@yaseenkhanmohmand Yes, What we mentioned above was talking about this nft transfer API : )

yaseenkhanmohmand commented 2 years ago

Amazzzing!!

Just to confirm IAN,

There are two APIs, both look very similar:

One is contract address agnostic: That is: /nft/transfers
This API gives all data from block x to block y for all NFTs on the blockchain.

The other API is :

nft/{address}/trades This API needs a contract address to pull data, the problem with this one is this does not provide information on mints.

We are using the first one for our use case?

yaseenkhanmohmand commented 2 years ago

okay disregard! :D I got access to the database it seems even the mints are being accounted for!! Great!!

yaseenkhanmohmand commented 2 years ago

HI Hazel,

How does this look?

Please let me know if i can help, i extracted data for this purpose using Python in the past, so i can share my experience doing this.

yaseenkhanmohmand commented 2 years ago

Hi hazel,

I am looking at the front end,

And looked at the nft_trades table, I don't see new data in there.

I run this query: select count(distinct nft_id) from nft_trades limit 10

I am getting 133 projects.

This should be a much higher number like in the thousands, given that there are many new projects being launched every day. We should be able to see all those projects.

image