1

Given a certain token,for example Sundae, which has

policyID:    9a9693a9a37912a5097918f97918d15240c92ab729a0b7c4aa144d77

fingerprint: asset1m4u92ke6820pkk07m8qmmguye02ewr8g6tezr0

(https://cardanoassets.com/asset1m4u92ke6820pkk07m8qmmguye02ewr8g6tezr0)

I want to get the information of this token, e.g how many Sundae tokens have been staked,how many Sundae remain in the address of the creator.

To do that,I need to know

(1) the total minted amount of Sundae (in this case 2 millions)

(2) the amount has been released to public (which does not belong to the owners)

(3) the amount remains belonging to the owners

I think I can get (1) by

select multi_asset.name, ma_tx_mint.quantity
from public.multi_asset, public.ma_tx_mint, 
where multi_asset.id = ma_tx_mint.ident and 
multi_asset.fingerprint = 'asset1m4u92ke6820pkk07m8qmmguye02ewr8g6tezr0'

For (3), at least I can get the address of the creator

select multi_asset.name, ma_tx_mint.quantity, tx.fee, tx.block_id,tx.block_index, tx_out.address, tx_out.value
from public.multi_asset, public.ma_tx_mint, public.tx,public.tx_out
where multi_asset.id = ma_tx_mint.ident and ma_tx_mint.tx_id = tx.id and tx.id = tx_out.tx_id and
multi_asset.fingerprint = 'asset1m4u92ke6820pkk07m8qmmguye02ewr8g6tezr0'

But how to get the remaining amount of Sundae in this address?

For (2),I do not have any idea how to do.

Thanks you very much!

1 Answer 1

0

These SQL queries are not quite correct.

For 1):

select multi_asset.name, ma_tx_mint.quantity from multi_asset
  inner join ma_tx_mint on multi_asset.id = ma_tx_mint.ident
  where multi_asset.fingerprint =
  'asset1m4u92ke6820pkk07m8qmmguye02ewr8g6tezr0';
      name      |     quantity     
----------------+------------------
 \x53554e444145 | 2000000000000000
(1 row)

For 3) I had to modify this one to use tx.block_no instead of tx.block_id because my database is currently running a new experimental schema:

select multi_asset.name, ma_tx_mint.quantity, tx.fee, 
    tx.block_no,tx.block_index, tx_out.address, tx_out.value
  from multi_asset inner join ma_tx_mint on multi_asset.id = ma_tx_mint.ident
    inner join tx on ma_tx_mint.tx_id = tx.id
    inner join tx_out on tx.id = tx_out.tx_id
  where multi_asset.fingerprint = 
    'asset1m4u92ke6820pkk07m8qmmguye02ewr8g6tezr0';

      name      |     quantity     |  fee   | block_no | block_index |                          address                           |  value   
----------------+------------------+--------+----------+-------------+------------------------------------------------------------+----------
 \x53554e444145 | 2000000000000000 | 684646 |  6766387 |          39 | addr1w9742z4fewans7ry6cjp95pc4ecv7y54cx298lp5qfw7s9gv8ukrj |  2000000
 \x53554e444145 | 2000000000000000 | 684646 |  6766387 |          39 | addr1w9pgj46r4wh80ujlrdf5h6sxuuvfac2wurfnsn4xgqw584sfa966l |  2000000
 \x53554e444145 | 2000000000000000 | 684646 |  6766387 |          39 | addr1w9pgj46r4wh80ujlrdf5h6sxuuvfac2wurfnsn4xgqw584sfa966l |  2000000
 \x53554e444145 | 2000000000000000 | 684646 |  6766387 |          39 | addr1w9pgj46r4wh80ujlrdf5h6sxuuvfac2wurfnsn4xgqw584sfa966l |  2000000
 \x53554e444145 | 2000000000000000 | 684646 |  6766387 |          39 | addr1w9pgj46r4wh80ujlrdf5h6sxuuvfac2wurfnsn4xgqw584sfa966l |  2000000
 \x53554e444145 | 2000000000000000 | 684646 |  6766387 |          39 | addr1w9pgj46r4wh80ujlrdf5h6sxuuvfac2wurfnsn4xgqw584sfa966l |  2000000
 \x53554e444145 | 2000000000000000 | 684646 |  6766387 |          39 | addr1w9pgj46r4wh80ujlrdf5h6sxuuvfac2wurfnsn4xgqw584sfa966l | 12315354
(7 rows)

For 2) I am a little unsure. Were all initial tokens held in a single address? If so, are all transactions containing the relevant mutli-asset from that address to other addresses releases to the public?

2
  • Can I use cardano-cli to check the above information, not to use postgres database. Because my database is not fully synced right now, so maybe the result is not right.
    – cdt
    Commented Aug 20, 2022 at 22:53
  • I am not aware of cardano-cli being able to provide that information. For db-sync you should wait until it is fully synced before querying it. Commented Aug 21, 2022 at 5:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.