Skip to main content

How to Calculate Script Hash

Script hash is calculated as follows:

ckbhash(molecule_encode(script))

Where:

  • ckbhash is the BLAKE2b hash algorithm specifically used in CKB. For details, refer to ckbhash.

  • molecule_encode serializes a structure into a binary format with the Molecule serialization method

The definition of Script is as follows:

table Script {
code_hash: Byte32,
hash_type: byte,
args: Bytes,
}