Skip to main content

Understanding Hash Types

For the sake of user convenience and compatibility, we expect the delivery of hashes and similar data in the form of a prefixed string when using the node. The following is a list of string representations used.

Table of Associated Hash Types

TypePrefixExample
PublicKey018a88e3dd7409f195fd52db2d3cba5d72ca6709bf1d94121bf3748801b40f6f5c
AccountHashaccount-hash-account-hash-ef4687f74d465826239bab05c4e1bdd2223dd8c201b96f361f775125e624ef70
ContractHashcontract-contract-0101010101010101010101010101010101010101010101010101010101010101
ContractPackageHashcontract-package-wasmcontract-package-wasm0101010101010101010101010101010101010101010101010101010101010101
Key::Accountaccount-hash-account-hash-ef4687f74d465826239bab05c4e1bdd2223dd8c201b96f361f775125e624ef70
Key::Hashhash-hash-0101010101010101010101010101010101010101010101010101010101010101
Key::URefuref-uref-0101010101010101010101010101010101010101010101010101010101010101-001
Key::Transfertransfer-transfer-0101010101010101010101010101010101010101010101010101010101010101
Key::DeployInfodeploy-deploy-0101010101010101010101010101010101010101010101010101010101010101
Key::EraInfoera-era-1
Key::Balancebalance-balance-0101010101010101010101010101010101010101010101010101010101010101
Key::Bidbid-bid-ef4687f74d465826239bab05c4e1bdd2223dd8c201b96f361f775125e624ef70
Key::Withdrawwithdraw-withdraw-ef4687f74d465826239bab05c4e1bdd2223dd8c201b96f361f775125e624ef70
Key::Dictionarydictionary-dictionary-0101010101010101010101010101010101010101010101010101010101010101
Key::SystemContractRegistrysystem-contract-registry-00000000000000000000000000000000

Hash and Key Explanations

PublicKey is a 32 byte asymmetric public key, preceded by a one-byte prefix that tells whether the key is ed25519 or secp256k1.

AccountHash is a 32 byte hash of the PublicKey. It serves as the address for user accounts.

ContractHash is the 32 byte hash of specific smart contract versions. You can use this to call specific contract versions.

ContractPackageHash is a 32 byte hash of the smart contract package. This hash directs you to the contract package. The function call_versioned_contract uses ContractPackageHash and allows you to call the latest version of the contract (by default). It also allows you to call any version stored previously to the package.

Key is a wrapper type that may contain one of several possible sets of data.

  • Key::Account contains an AccountHash.
  • Key::Hash contains a byte array with a length of 32, and as such can be used to pass any of the hashes. Please take note that the developer of the contract is responsible for implementation of any checks necessary on the receiving side.
  • Key::URef contains an URef suffixed by access rights.
  • Key::Transfer should contain the address hash for a transfer.
  • Key::DeployInfo retains the address hash of deploy information.
  • Key::EraInfo is the integer number of the associated era.
  • Key::Balance is the balance of a purse.
  • Key::Bid is used to keep track of bids for the auction contract. It is not generally used by users.
  • Key::Withdraw is used to keep track of withdraws for the auction contract. It is not generally used by users.
  • Key::Dictionary is the hash derived from a URef and a piece of arbitrary data and leads to a dictionary.
  • Key::SystemContractRegistry is a unique Key under which a mapping of the names and ContractHashes for system contracts, including Mint, Auction, HandlePayment and StandardPayment, is stored.