Home

Awesome

NFT Analyst Starter Pack

Enter your Alchemy API key and an NFT contract address, and with one command generate CSV extracts for all token transfers, historical sales, and each underlying item's metadata (with calculated rarity scores).

You can read more from us about what this is, and why it matters, here.

Getting Started

You will first need to obtain an Alchemy API key. You can sign up for a free account at alchemy.com.

Then, install the dependencies.

poetry install or pip3 install -r requirements.txt

Export Data

If you're using poetry, remember to prepend this command with poetry run or activate the appropriate environment with poetry shell while in the nft-analyst-starter-pack directory. You can learn more about poetry and how to properly install it here. If using Docker you can spin up a containerized environment with docker-compose up and cd into the container to run commands from the CLI. You can learn more about Docker Compose here.

python export_data.py --alchemy-api-key YourAPIKey --contract-address 0xED5AF388653567Af2F388E6224dC7C4b3241C544

The first argument is your Alchemy API key and the second argument is the contract address of the NFT collection you want to export (the example provided is Azuki).

End-to-End Example

export ALCHEMY_API_KEY=put_your_api_key_here
git clone https://github.com/a16z/nft-analyst-starter-pack && cd nft-analyst-starter-pack
poetry env use python3.9
poetry install
poetry shell
python export_data.py --alchemy-api-key $ALCHEMY_API_KEY --contract-address 0xED5AF388653567Af2F388E6224dC7C4b3241C544

Outputs

The data outputs are stored as three CSV files:

transfers_0x---.csv

transaction_hashblock_numberdateasset_idfrom_addressto_addresslog_indexvalue
0xda1c66592b56293d37b16b4c72222e6c2ea8768db8480860132ad9b0d723c719170906504/20/2312000x29c0f446b983d002a8d110aee7e904426da5327f0x7d88f221e9ecef9eef118e0d0e8a47f81b37e0b61781
0xe9cc5b02af90369061dcf42cd696c30bd0ef4e378d88400645322eb65dc51f03170905024/20/2346930xeecba4834ca010c0ced9b2ed8b7050f5229667b80x53bf035f62f27dd99f8afc867abf328c218aaa034391
0x1d87dbb54ee80ff34a775412db433b5d6ce3b3c40153345b53c9acb234be67e8170900954/20/2354060x703229ec1005fba3108883b8a094ea206fc1e1610xe52cec0e90115abeb3304baa36bc2655731f79343641

sales_0x---.csv

transaction_hashblock_numberdateasset_idmarketplacesellerbuyermakertakersale_price_ethsale_price_usdprotocol_fee_ethprotocol_fee_usdroyalty_fee_ethroyalty_fee_usdquantity
0xda1c66592b56293d37b16b4c72222e6c2ea8768db8480860132ad9b0d723c719170906504/20/231200blur0x29c0f446b983d002a8d110aee7e904426da5327f0x7d88f221e9ecef9eef118e0d0e8a47f81b37e0b60x29c0f446b983d002a8d110aee7e904426da5327f0x7d88f221e9ecef9eef118e0d0e8a47f81b37e0b616.2931544.37825000.08145157.72189121
0xe9cc5b02af90369061dcf42cd696c30bd0ef4e378d88400645322eb65dc51f03170905024/20/234693seaport0xeecba4834ca010c0ced9b2ed8b7050f5229667b80x53bf035f62f27dd99f8afc867abf328c218aaa030x53bf035f62f27dd99f8afc867abf328c218aaa030xeecba4834ca010c0ced9b2ed8b7050f5229667b817.737534347.354770.4125798.77569230.8251597.5513851
0xbdb62c189c11ca8e16c8c56a41ffad2e27875407aabdf1c8fd3cb9cc505966cf170896464/20/238516blur0xdc2d12cdefe1b3b9060692a5d47015d2192860770xfa89ec40699bbfd749c4eb6643dc2b22ff0e2aa60xdc2d12cdefe1b3b9060692a5d47015d2192860770xfa89ec40699bbfd749c4eb6643dc2b22ff0e2aa615.1629356.21696000.7581467.8108481

metadata_0x---.csv

asset_idattribute_countattribute_count_rarity_scoreType_attributeType_rarity_scoreHair_attributeHair_rarity_scoreClothing_attributeClothing_rarity_scoreEyes_attributeEyes_rarity_scoreMouth_attributeMouth_rarity_scoreOffhand_attributeOffhand_rarity_scoreBackground_attributeBackground_rarity_scoreEar_attributeEar_rarity_scoreHeadgear_attributeHeadgear_rarity_scoreNeck_attributeNeck_rarity_scoreFace_attributeFace_rarity_scoreSpecial_attributeSpecial_rarity_scoreoverall_rarity_score
073.160556258Human1.108893324Water476.1904762Pink Oversized Kimono140.8450704Striking24.50980392Frown27.54820937Monkey King Staff68.96551724Off White A5.5126791621.2223444571.5356265361.2909888971.472754051.067121972754.4300418
173.160556258Human1.108893324Pink Hairband129.8701299White Qipao with Fur119.047619Daydreaming25.83979328Lipstick24.50980392Gloves90.09009009Off White D5.0251256281.2223444571.5356265361.2909888971.472754051.067121972405.2408473
273.160556258Human1.108893324Pink Flowy114.9425287Vest62.5Ruby26.24671916Chewing28.490028493.159557662Red9.940357853Red Tassel303.0303031.5356265361.2909888971.472754051.067121972557.945436

*Note: Category rarity scores are calculated as 1 divided by the statistical probability of selecting an item at random from the collection with the given trait. The overall rarity score is the sum of the category rarity scores.

Processing Time

The script can take up to ~5 minutes to run, depending on the contract's deployment date and the number of tokens in the collection.

Limitations

(1) Only compatible with Ethereum-based collections

(2) Only compatible with collections supported by Alchemy's NFT API

(3) Only includes sales denominated in ETH/WETH

(4) ETH/USD prices are only tracked at a daily granularity

Related Work and Credits

Disclaimer

This code is being provided as is. No guarantee, representation or warranty is being made, express or implied, as to the safety or correctness of the code. It has not been audited and as such there can be no assurance it will work as intended, and users may experience delays, failures, errors, omissions or loss of transmitted information. Nothing in this repo should be construed as investment advice or legal advice for any particular facts or circumstances and is not meant to replace competent counsel. It is strongly advised for you to contact a reputable attorney in your jurisdiction for any questions or concerns with respect thereto. a16z is not liable for any use of the foregoing, and users should proceed with caution and use at their own risk. See a16z.com/disclosure for more info.