How do we get the fingerprint of an non ADA asset #341
Unanswered
PaulMatencio
asked this question in
Q&A
Replies: 4 comments 3 replies
|
This is simple, here is a oneliner in bash: PolyPeer2214 into hex $ echo -n "PolyPeer2214" | xxd -ps
506f6c795065657232323134Concate it with the policyID -> Calculate the fingerprint $ echo -n "ef76f6f0b3558ea0aaad6af5c9a5f3e5bf20b393314de747662e8ce9506f6c795065657232323134" | xxd -r -ps | b2sum -l 160 -b | cut -d' ' -f 1 | ./bech32 asset
asset1q924wa9xs5uz3cr4pazgv329pka4d22mhgevd5what you do is to concate a hexstring of the policyid+assetname. than you convert that into bytes, do a blake2b (160bits->20bytes) hashing on it and than that is bech32 encoded with the prefix "asset" |
2 replies
|
Thank you .
It is greatly appreciated
Kind regards
Paul Matencio
…On Thu, Jun 23, 2022, 8:45 PM Martin Lang ***@***.***> wrote:
This is simple, here is a oneliner in bash:
echo -n "34250edd1e9836f5378702fbf9416b709bc140e04f668cc3552085184154414441636f696e" | xxd -r -ps | b2sum -l 160 -b | cut -d' ' -f 1 | ./bech32 asset
what you do is to concate a hexstring of the policyid+assetname. than you
convert that into bytes, to a blake2 hashing on it and than that is bech32
encoded with the prefix "asset"
—
Reply to this email directly, view it on GitHub
<#341 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABID6OIOXU3XUKDIOIHEZ63VQSWFRANCNFSM5ZUXKYYQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
0 replies
|
@PaulMatencio @gitmachtl would it help if we added the bech32 encoding for assets as part of the event output? |
1 reply
|
Hi Santiago
I believe so. It would be great so I don't have to do it.
Here is my transaction document model created during the extraction of
the cardano events provided by oura .
It should be noted that due to lack of history I could not add missing
addresses to uxto_input collateral, mint etc .. At the end of each block,
I will keep only one document per transaction, it saves me a lot of space
and speeds up further queries ( need just to extract a subpart of a
document). The process is pretty past thanks to the concurrency features
of the programming language I am using.
Kind regards
Paul Matencio
*Here is my transaction document model *
context.tx_hash
8f9a8f3ac874e540fe37a20da2c7472347ca82b731fc65a6fe96648e115b412f
{
"context": {
"block_hash":
"8efab7f05865cb50c5bbf46dc8a2567bf550e9326c099384f5717e72777118ab",
"block_number": 7412016,
"certificate_idx": null,
"input_idx": null,
"output_address": null,
"output_idx": null,
"slot": 64415645,
"timestamp": 1655981936,
"tx_hash":
"8f9a8f3ac874e540fe37a20da2c7472347ca82b731fc65a6fe96648e115b412f",
"tx_idx": 9
},
"fingerprint":
*"64415645.trans.38828000133457693162287893424143555641",*
"transaction": {
"fee": 569467,
"hash":
"8f9a8f3ac874e540fe37a20da2c7472347ca82b731fc65a6fe96648e115b412f",
"input_count": 2,
"inputs": null,
"metadata": null,
"mint": null,
"mint_count": 0,
"native_witnesses": null,
"network_id": null,
"output_count": 2,
"outputs": null,
"plutus_data": null,
"plutus_redeemers": null,
"plutus_witnesses": null,
"total_output": 6154633,
"ttl": 64419159,
"validity_interval_start": 64415559,
"vkey_witnesses": null
},
"utxo_output": [
{
"address":
"addr1zxj47sy4qxlktqzmkrw8dahe46gtv8seakrshsqz26qnvzypw288a4x0xf8pxgcntelxmyclq83s0ykeehchz2wtspksr3q9nx",
"amount": 1724100,
"assets": [
{
"amount": 1,
"asset": "43727970746f44696e6f3036333533",
"asset_ascii": "CryptoDino06353",
"policy":
"7a5a5c3757d33c2b2ff0b09405676e61f93d28b5d12805dd3320e31f",
* "finger_print":
"asset1ugffhqg9ztf66tpy046xzmkxdz3y0hhjmqfywd"*
}
]
},
{
"address":
"addr1qxe4u8t3292kwj9a9mqays0f4he6telz4rf8cxaqnskzqclkl528y00v3m6yvfjjkwzul75f5cz86g6ahdzpn89h55msrhhhw9",
"amount": 4430533,
"assets": []
}
],
"utxo_input": [
{
"index": 0,
"tx_id":
"bcf5fb79e66b566bbf38500edab962409cfe84ca55936b07e2c830b9f9a010df",
"address":""
},
{
"index": 2,
"tx_id":
"a51ba880f3b09545264d52be8b8a6f077a583e4992113012e9c7c66a37129f30",
* "address":""*
}
],
"metadata": {
"label": "0",
"text_scalar":
"d8799f581cb35e1d7151556748bd2ec1d241e9adf3a5e7e2a8d27c1ba09c2c20",
"map_json": [
{
"Key": "msg",
"Value": [
"Minswap: Withdraw Order"
]
}
]
},
"collateral": {
"index": 0,
"tx_id":
"33bcc7dd7ba1ea8fefb7319f2884445db541cce065542611e658739d7f512b82",
* "address": ""*
},
"plutus_witness": {
"script_hash":
"7f3ffaaebb69fc434d960ee835e5b2a349a8fb765c1423439dd79fe3",
"script_hex":
"590fbe0100003233223232323322333222323233322232333222323332223322323322323332223232332233223232332232323332223322332233223322323232323232323232323232332232323232323232323322323232332232333322223232323232322232232325335305c33223530310012235303500222222222322235304400c23232325335306f333222533530723300300200110731074506e32353047001220023253353505a00113507649010350543800221002302e5002004107115335304a01313301b49101350033355029302f1200123535505e00122323355030335502d30331200123535506200122353550640012253353506f335503533550250490040062153353507033550363335550323039120012235355069002232233225335350770022130020011507800425335350763335502c0500040072153353080013304d0010031335503d5079300400215335308001330630010031335503d507933335502e0510053304900100300215078150773200135508601225335350680011506a2213535506e002225335308201330530020071003133506d33550710020013006003350720010022133026491023130003322333573466e200080041f41f8cc8cd54c0ec48004d40c00048004cd40c40952000335530321200123535506900122001001004133573892010231310007a133573892010231320007900233233553023120013503500135034001335038223355302c120012353550630012233550660023355302f12001235355066001223355069002333535502b0012330264800000488cc09c0080048cc09800520000013355302c1200123535506300122335506600233353550280012335530301200123535506700122335506a00235502f0010012233355502804a0020012335530301200123535506700122335506a00235502d001001333555023045002001505e33233553023120012253353506c3003002213350610010021001505f2353053001222533530763332001504100600313506f0021506e011320013333555028302f1200122353055002225335307333044002500b10031333355502c303312001235305a00122253353506e333550245042003001213333550265043004335530301200123535506700122335506a002333535502c0012001223535506b002223535506d0032233550703302c00400233553039120012353550700012233550730023335355035001200122330310020012001333555030052003001200133355502704900300100213333550255042003002001003001505b500113301b49101340033355029302f1200123530540012233043500a00250011533535058335530401200123320015051320013530460012235305100122253353506b0012321300100d3200135507f2253353506100113507d491022d310022135355067002225335307b3304c00200710011300600313507a49101370050011350744901013600221335530421200123320015053320013530480012235305300122253353506d0012321300100f32001355081012253353506300113507f491022d310022135355069002225335307d3304e00200710011300600313507c4910137005003133355301d12001225335306f335306a303e302d35304600222001207125335307033041001300401010721350764901013300133505a0020011001505900d3200135507622533535058001135074491022d31002213530470022253353072333200150710020071353063303000122335306f00223507b491022d310020011300600315335350520011306d4988854cd4d41500044008884c1c5263333573466e1d40112002203a23333573466e1d40152000203a23263530663357380b80ce0ca0c80c66666ae68cdc39aab9d5002480008cc0c4c8c8c8c8c8c8c8c8c8c8c8cccd5cd19b8735573aa01490001199999999981f99a828919191999ab9a3370e6aae7540092000233045304b35742a00460986ae84d5d1280111931a983a99ab9c06b076074073135573ca00226ea8004d5d0a80519a8288241aba1500935742a0106ae85401cd5d0a8031aba1500535742a00866a0a2eb8d5d0a80199a82899aa82b3ae200135742a0046ae84d5d1280111931a983899ab9c06707207006f135744a00226ae8940044d5d1280089aba25001135744a00226ae8940044d5d1280089aba25001135573ca00226ea8004d5d0a80119191999ab9a3370e6aae75400520022303a303e357426aae7940088c98d4c1a0cd5ce02f03483383309baa001357426ae8940088c98d4c194cd5ce02d833032031883289931a983219ab9c49010350543500065063135573ca00226ea80044d55ce9baa001223370000400244a66a60ac00220b0266ae7000815c4488c88c008004c8004d5417c894cd4d41040045413c884d4d5411c008894cd4c16ccc02000801c4d41500044c01800c448888c8cd54c03c480048d4d5411800488cd54124008ccd4d5402c0048004880048004ccd554018014008004c8cd40054109410c488cc008cd5411c014010004444888ccd54c0104800540fccd54c030480048d4d5410c00488cd54118008d5402c004ccd54c0104800488d4d54110008894cd4c160ccd54c06048004d4034cd403c894cd4c168008417040041648d4d5411c00488cc028008014018400c4cd410c01000d4100004cd54c030480048d4d5410c00488c8cd5411c00cc004014c8004d54184894cd4d410c0044d5402c00c884d4d54124008894cd4c174cc0300080204cd5404001c0044c01800c008c8004d5416888448894cd4d40fc0044008884cc014008ccd54c01c480040140100044484888c00c01044884888cc0080140104484888c00401044800448cd404888ccd4d401000c88008008004d4d40080048800448848cc00400c00848004c8004d541488844894cd4d40d8004540e0884cd40e4c010008cd54c018480040100044448888cccd54011403c00c0040084488cd54008c8cd403c88ccd4d401800c88008008004d4d401000488004cd401005012800448848cc00400c008480044488c0080048d4c08c00488800cc8004d5412c88c8c94cd4c114cc0a14009200213300c300433530081200150010033004335300d12001500100310031332233706004002a002900209999aa9801890009919a80511199a8040018008011a802800a8039119b800014800800520003200135504a221122253353502f00113500600322133350090053004002333553007120010050040011235350050012200112353500400122002320013550472212253353041333573466e2400920000430421502d153353502b0011502d22133502e002335300612001337020089001000899a801111180198010009000891091980080180109000990009aa821911299a9a81300108009109a980a801111a982180111299a9a8160038a99a9a8160038804110b1109a980d801111a982480111299a9824199ab9a33720010004094092266a0660186601e01601a2a66a6090666ae68cdc8804001024825099a819803198078070028a99a982419809003800899a81980619807805806899a81980319807807002990009aa82111091299a9a8130008a814110a99a981f19804002240002006266a600c240026600e00890010009119b8100200122333573466e240080040e80e4488cc00ccc01cc018008c018004cc894cd4d40c0008854cd4d40c400884cd4c0b80088cd4c0bc0088cc034008004888100888cd4c0c401081008894cd4c104ccd5cd19b87006003043042153353041333573466e1c01400810c1084cc0380100044108410840ec54cd4d40c0004840ec40ecc014008c014004894cd4c0d8008400440dc88ccd5cd19b8700200103703623530240012200123530230012200222335302d0022335302e00223300500200120352335302e002203523300500200122333573466e3c0080040cc0c8c8004d540e08844894cd4d407000454078884cd407cc010008cd54c018480040100048848cc00400c0088004888888888848cccccccccc00402c02802402001c01801401000c00880048848cc00400c0088004848c004008800448800848800480048c8c8cccd5cd19b8735573aa004900011981519191999ab9a3370e6aae75400520002375c6ae84d55cf280111931a981899ab9c02703203002f137540026ae854008dd69aba135744a004464c6a605c66ae700900bc0b40b04d55cf280089baa00123232323333573466e1cd55cea801a4000466600e602c6ae85400cccd5403dd719aa807bae75a6ae854008cd4071d71aba135744a004464c6a605c66ae700900bc0b40b04d5d1280089aab9e5001137540024442466600200800600440022464646666ae68cdc39aab9d5002480008cc88cc024008004dd71aba1500233500a232323333573466e1cd55cea80124000466446601e004002602c6ae854008ccd5403dd719aa809919299a981419805a800a40022a00226a05c921022d33001375a00266aa01eeb88c94cd4c0a0cc02d400520001500113502e491022d32001375a0026ae84d5d1280111931a981719ab9c02402f02d02c135573ca00226ea8004d5d09aba25002232635302a33573804005605205026aae7940044dd500091199ab9a33712004002040042442466002006004400244246600200600440022464460046eb0004c8004d5408c88cccd55cf80092804119a80398021aba1002300335744004048224464460046eac004c8004d5408c88c8cccd55cf80112804919a80419aa80618031aab9d5002300535573ca00460086ae8800c0944d5d0800889100109109119800802001890008891119191999ab9a3370e6aae754009200023355008300635742a004600a6ae84d5d1280111931a981099ab9c01702202001f135573ca00226ea8004448848cc00400c0084480048c8c8cccd5cd19b8735573aa004900011980318071aba1500233500a2323232323333573466e1d40052002233300e375a6ae854010dd69aba15003375a6ae84d5d1280191999ab9a3370ea004900011808180a9aba135573ca00c464c6a604666ae700640900880840804d55cea80189aba25001135573ca00226ea8004d5d09aba25002232635301c33573802403a03603426aae7940044dd5000910919800801801100090911801001911091199800802802001900089119191999ab9a3370ea002900011a80418029aba135573ca00646666ae68cdc3a801240044a010464c6a603066ae7003806405c0580544d55cea80089baa001121223002003112200112001232323333573466e1d4005200223006375c6ae84d55cf280191999ab9a3370ea0049000118041bae357426aae7940108c98d4c04ccd5ce00480a00900880809aab9d50011375400242446004006424460020064002921035054310012253353003333573466e3cd4c01800888008d4c018004880080140104ccd5cd19b873530060022200135300600122001005004100412200212200120012212330010030022001235002490101310012326353003335738002008004930900090008891918008009119801980100100081"
},
"native_witness": {
"policy_id": "",
"script_json": {
"scripts": null,
"type": ""
}
},
"plutus_redeemer": {
"ex_units_mem": 1679020,
"ex_units_steps": 689615199,
"input_idx": 1,
"plutus_data": {
"constructor": 0,
"fields": []
},
"purpose": "spend"
},
"plutus_datum": {
"datum_hash":
"e4ecd7ef962a728cd7e8e84447546b2fccb21897872b1b9e86acda0f239d36b6",
"plutus_data": [
{
"Key": "constructor",
"Value": 0
},
{
"Key": "fields",
"Value": [
[
{
"Key": "bytes",
"Value":
"b35e1d7151556748bd2ec1d241e9adf3a5e7e2a8d27c1ba09c2c2063"
}
],
[
{
"Key": "list",
"Value": [
[
{
"Key": "constructor",
"Value": 0
},
{
"Key": "fields",
"Value": [
[
{
"Key": "constructor",
"Value": 0
},
{
"Key": "fields",
"Value": [
[
{
"Key":
"constructor",
"Value": 0
},
{
"Key":
"fields",
"Value": [
[
{
"Key": "bytes",
"Value": "b375bb9fc4efb1035bbcc3f593f4c3ffd43f8925004bf669f682119c"
}
]
]
}
],
[
{
"Key":
"constructor",
"Value": 0
},
{
"Key":
"fields",
"Value": [
[
{
"Key": "constructor",
"Value": 0
},
{
"Key": "fields",
"Value": [
[
{
"Key": "constructor",
"Value": 0
},
{
"Key": "fields",
"Value": [
[
{
"Key": "bytes",
"Value":
"9fb9686c713dd04932a540e42047f3b4503dc63dd24020cfdd4dadff"
}
]
]
}
]
]
}
]
]
}
]
]
}
],
[
{
"Key": "map",
"Value": [
[
{
"Key": "k",
"Value": [
{
"Key": "bytes",
"Value": ""
}
]
},
{
"Key": "v",
"Value": [
{
"Key": "constructor",
"Value": 0
},
{
"Key": "fields",
"Value": [
[
{
"Key": "int",
"Value": 0
}
],
[
{
"Key": "map",
"Value": [
[
{
"Key": "k",
"Value": [
{
"Key": "bytes",
"Value": ""
}
]
},
{
"Key": "v",
"Value": [
{
"Key": "int",
"Value": 1000000
}
]
}
]
]
}
]
]
}
]
}
]
]
}
]
]
}
],
[
{
"Key": "constructor",
"Value": 0
},
{
"Key": "fields",
"Value": [
[
{
"Key": "constructor",
"Value": 0
},
{
"Key": "fields",
"Value": [
[
{
"Key":
"constructor",
"Value": 0
},
{
"Key":
"fields",
"Value": [
[
{
"Key": "bytes",
"Value": "70e60f3b5ea7153e0acc7a803e4401d44b8ed1bae1c7baaad1a62a72"
}
]
]
}
],
[
{
"Key":
"constructor",
"Value": 0
},
{
"Key":
"fields",
"Value": [
[
{
"Key": "fields",
"Value": [
[
{
"Key": "constructor",
"Value": 0
},
{
"Key": "fields",
"Value": [
[
{
"Key": "bytes",
"Value":
"1e78aae7c90cc36d624f7b3bb6d86b52696dc84e490f343eba89005f"
}
]
]
}
]
]
},
{
"Key": "constructor",
"Value": 0
}
]
]
}
]
]
}
],
[
{
"Key": "map",
"Value": [
[
{
"Key": "k",
"Value": [
{
"Key": "bytes",
"Value": ""
}
]
},
{
"Key": "v",
"Value": [
{
"Key": "constructor",
"Value": 0
},
{
"Key": "fields",
"Value": [
[
{
"Key": "int",
"Value": 0
}
],
[
{
"Key": "map",
"Value": [
[
{
"Key": "k",
"Value": [
{
"Key": "bytes",
"Value": ""
}
]
},
{
"Key": "v",
"Value": [
{
"Key": "int",
"Value": 1000000
}
]
}
]
]
}
]
]
}
]
}
]
]
}
]
]
}
],
[
{
"Key": "constructor",
"Value": 0
},
{
"Key": "fields",
"Value": [
[
{
"Key": "constructor",
"Value": 0
},
{
"Key": "fields",
"Value": [
[
{
"Key":
"constructor",
"Value": 0
},
{
"Key":
"fields",
"Value": [
[
{
"Key": "bytes",
"Value": "b35e1d7151556748bd2ec1d241e9adf3a5e7e2a8d27c1ba09c2c2063"
}
]
]
}
],
[
{
"Key":
"constructor",
"Value": 0
},
{
"Key":
"fields",
"Value": [
[
{
"Key": "constructor",
"Value": 0
},
{
"Key": "fields",
"Value": [
[
{
"Key": "constructor",
"Value": 0
},
{
"Key": "fields",
"Value": [
[
{
"Key": "bytes",
"Value":
"f6fd14723dec8ef4462652b385cffa89a6047d235dbb44199cb7a537"
}
]
]
}
]
]
}
]
]
}
]
]
}
],
[
{
"Key": "map",
"Value": [
[
{
"Key": "k",
"Value": [
{
"Key": "bytes",
"Value": ""
}
]
},
{
"Key": "v",
"Value": [
{
"Key": "constructor",
"Value": 0
},
{
"Key": "fields",
"Value": [
[
{
"Key": "int",
"Value": 0
}
],
[
{
"Key": "map",
"Value": [
[
{
"Key": "k",
"Value": [
{
"Key": "bytes",
"Value": ""
}
]
},
{
"Key": "v",
"Value": [
{
"Key": "int",
"Value": 48000000
}
]
}
]
]
}
]
]
}
]
}
]
]
}
]
]
}
]
]
}
]
]
}
]
}
}
…On Wed, Jul 6, 2022 at 9:29 PM Santiago Carmuega ***@***.***> wrote:
@PaulMatencio <https://github.com/PaulMatencio> @gitmachtl
<https://github.com/gitmachtl> would it help if we added the bech32
encoding for assets as part of the event output?
—
Reply to this email directly, view it on GitHub
<#341 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABID6ONMDUHH2RZRT4SDZWTVSXNBLANCNFSM5ZUXKYYQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
How do we get the fingerprint for an asset policy and its asset id (or asset_ascii) ?
"asset_ascii":"PolyPeer2214","policy":"ef76f6f0b3558ea0aaad6af5c9a5f3e5bf20b393314de747662e8ce9"
As for instance from db-sync multi_asset table
select ma.policy,ma.name,ma.fingerprint
from multi_asset ma
where encode(ma.policy,'hex') = 'ef76f6f0b3558ea0aaad6af5c9a5f3e5bf20b393314de747662e8ce9'
and ma.name ='PolyPeer2214';
Policy: 0xEF76F6F0B3558EA0AAAD6AF5C9A5F3E5BF20B393314DE747662E8CE9
name: PolyPeer2214
fingerprint : asset1q924wa9xs5uz3cr4pazgv329pka4d22mhgevd5
All reactions