Let's say I have the following native token unit d5e6bf0500378d4f0da4e8dde6becec7621cd8cbf5cbb9b87013d4cc537061636542756433323639 that consists of the policy id d5e6bf0500378d4f0da4e8dde6becec7621cd8cbf5cbb9b87013d4cc and asset name 537061636542756433323639.

The asset name is a HEX representation of the name. Therefore it can vary in length.

But the policy id is some sort of a hash of the policy, so I'd assume the length of the string is always the same. Is this correct?

What I want to achieve is to split the asset name and the policy id e.g. like this:

> "537061636542756433323639"

2 Answers 2


The policyId is the hash of the policy script. It is a blake2b-224 hash resulting in 28 bytes and a hex length of 56 chars. So, your code will always work and is the right way to do it.

Find the spec defining the scriptHash here, note that the scriptHash is of type hash28 denoting the hash length.

Also, the assetName can be of any length between 0-32 bytes. Something to keep a note of in your application, this also means that there can be a token without assetName. Find the assetName length spec here


Yes, the policy ID is indeed defined as a ScriptHash in the specifications. Its length is 28 bytes.


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.