Deprecated

This Splice documentation site is deprecated. Use the current Canton Network docs.

Open current docs

Splice.Amulet.CryptoHash

Utilities to compute cryptographic hashes of Daml data structures. We use this for computing compact commitments for reflecting off-ledger data shared by the SV nodes on-ledger.

Note that the hashes are based on viewing all scalar values as strings and taking a structural view of Daml records; i.e., the hashes do not include a unique type tag by default. Make sure to include a type tag using hashVariant if you want to hash different data structures in the same scope.

Typeclasses

class Hashable a where

hash

: a -> Hash

instance Hashable Hash

instance Hashable Batch

instance Hashable MintingAllowance

instance Hashable Decimal

instance Hashable Int

instance Hashable Text

instance Hashable Party

instance Hashable a => Hashable (Optional a)

instance Hashable a => Hashable [a]

Data Types

data Hash

Hash

Field

Type

Description

value

Text

instance Hashable Hash

instance Eq Hash

instance Show Hash

instance GetField "batchHash" ProcessRewardsV2 Hash

instance GetField "batchHash" AmuletRules_StartProcessingRewardsV2 Hash

instance GetField "value" Hash Text

instance SetField "batchHash" ProcessRewardsV2 Hash

instance SetField "batchHash" AmuletRules_StartProcessingRewardsV2 Hash

instance SetField "value" Hash Text

Functions

hashRecord

: [Hash] -> Hash

Compute the hash of a record.

hashUpgradedRecord

: [Hash] -> [Optional Hash] -> Hash

Compute the hash of an upgraded record so that it agrees with the old record hash when ignoring trailing None fields.

hashVariant

: Text -> [Hash] -> Hash

Compute the hash of a variant.

hashUpgradedVariant

: Text -> [Hash] -> [Optional Hash] -> Hash

Compute the hash of an upgraded variant so that it agrees with the old variant hash when ignoring trailing None fields.

Comments