I would like to get a list of user addresses, that minted a native asset NFT. Is this possible? I do not want current holders of the NFT, but the original minting NFT holders.
1 Answer
Here's a way using the https://blockfrost.io API:
Fist you need to get the asset id, I assume you already have this because you know which NFT you want to look up.
Then you would query all transactions of this asset using the Cardano > Assets > Asset Transactions
API endpoint:
https://docs.blockfrost.io/#tag/Cardano-Assets/paths/~1assets~1{asset}~1transactions/get
This returns a list of transactions, where this asset has been involved.
[
{
"tx_hash": "8788591983aa73981fc92d6cddbbe643959f5a784e84b8bee0db15823f575a5b",
"tx_index": 6,
"block_height": 69,
"block_time": 1635505891
},
{
"tx_hash": "52e748c4dec58b687b90b0b40d383b9fe1f24c1a833b7395cdf07dd67859f46f",
"tx_index": 9,
"block_height": 4547,
"block_time": 1635505987
},
{
"tx_hash": "e8073fd5318ff43eca18a852527166aa8008bee9ee9e891f585612b7e4ba700b",
"tx_index": 0,
"block_height": 564654,
"block_time": 1834505492
}
]
Now you take the tx_hash
of the transaction with the lowest block_height
and query the Cardano > Transactions > Transaction UTxOs
endpoint:
https://docs.blockfrost.io/#tag/Cardano-Transactions/paths/~1txs~1{hash}~1utxos/get
This will result in an object like this:
{
"hash": "1e043f100dce12d107f679685acd2fc0610e10f72a92d412794c9773d11d8477",
"inputs": [ ... ],
"outputs": [
{
"address": "addr1q9ld26v2lv8wvrxxmvg90pn8n8n5k6tdst06q2s856rwmvnueldzuuqmnsye359fqrk8hwvenjnqultn7djtrlft7jnq7dy7wv",
"amount": [
{
"unit": "lovelace",
"quantity": "42000000"
},
{
"unit": "b0d07d45fe9514f80213f4020e5a61241458be626841cde717cb38a76e7574636f696e",
"quantity": "12"
}
],
"output_index": 0,
"data_hash": "9e478573ab81ea7a8e31891ce0648b81229f408d596a3483e6f4f9b92d3cf710",
"inline_datum": "19a6aa",
"collateral": false,
"reference_script_hash": "13a3efd825703a352a8f71f4e2758d08c28c564e8dfcce9f77776ad1"
}
]
}
Go through the outputs
of this object and find the one that contains your NFT in the list of amount
objects. The address
of this output
is the original receiver of your NFT.
cardano-db-sync
acceptable?