Skip to content

How do we get the fingerprint of an non ADA asset #341

Answered by gitmachtl
PaulMatencio asked this question in Q&A
Discussion options

You must be logged in to vote

This is simple, here is a oneliner in bash:

PolyPeer2214 into hex

$ echo -n "PolyPeer2214" | xxd -ps
506f6c795065657232323134

Concate it with the policyID -> ef76f6f0b3558ea0aaad6af5c9a5f3e5bf20b393314de747662e8ce9506f6c795065657232323134

Calculate the fingerprint

$ echo -n "ef76f6f0b3558ea0aaad6af5c9a5f3e5bf20b393314de747662e8ce9506f6c795065657232323134" | xxd -r -ps | b2sum -l 160 -b | cut -d' ' -f 1 | ./bech32 asset
asset1q924wa9xs5uz3cr4pazgv329pka4d22mhgevd5

what 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"

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@PaulMatencio
Comment options

@PaulMatencio
Comment options

Answer selected by PaulMatencio
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@gitmachtl
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants