singular-registry
LicenseApache-2.0
Safe HaskellNone
LanguageGHC2021

Singular.State.Preimage

Description

Every hashed name of the Singular state is the blake2b-256 hash of a preimage, and the preimage is the Plutus Data serialisation of a structured value with one constructor per role. The constructors are numbered as the model's Preimage, so two roles never share a preimage even when they carry the same fields.

The bytes are pinned by the vectors in test/fixtures/preimage-vectors.json, which the on-chain functions of singular_state/preimage.ak reproduce as well. Nothing here builds a transaction.

Synopsis

The roles

data Preimage Source #

The structured value hashed into a name, one constructor per role, numbered as the model's Preimage.

Constructors

State TxIn

The registry created by spending the seed.

Active RegistryIdentity ByteString

The token that stands for a key in a registry.

ApplicationConfiguration RegistryIdentity

The registry's application configuration.

RegistrationApproval RegistryIdentity ByteString Address DatumHash Lovelace

The approval of one registration: registry, key, the address the holding sits at, the hash of the holding's initial datum and the deposit it holds.

TerminationApproval RegistryIdentity ByteString

The approval of the termination of a key.

Instances

Instances details
Show Preimage Source # 
Instance details

Defined in Singular.State.Preimage

Methods

showsPrec :: Int -> Preimage -> ShowS Source #

show :: Preimage -> String Source #

showList :: [Preimage] -> ShowS Source #

Eq Preimage Source # 
Instance details

Defined in Singular.State.Preimage

Methods

(==) :: Preimage -> Preimage -> Bool Source #

(/=) :: Preimage -> Preimage -> Bool Source #

encodePreimage :: Preimage -> ByteString Source #

The Plutus Data serialisation of a preimage.

roleName :: Preimage -> AssetName Source #

The name of a role: the blake2b-256 hash of its preimage.

The names the line builds

stateTokenName :: TxIn -> AssetName Source #

The name of the state token of the registry created by spending the seed.

activeTokenName :: RegistryIdentity -> ByteString -> AssetName Source #

The name of the token that stands for a key in a registry.

configurationTokenName :: RegistryIdentity -> AssetName Source #

The name of the token of the configuration record of a registry.

registrationPreimage :: ByteString -> RegistryIdentity -> Address -> DatumHash -> Lovelace -> ByteString Source #

The Plutus Data serialisation of the registration approval preimage: the key, the registry, the address the holding sits at, the hash of the holding's initial datum and the deposit.

terminationPreimage :: ByteString -> RegistryIdentity -> ByteString Source #

The Plutus Data serialisation of the termination approval preimage: the registry and the key.

approvalName :: ByteString -> AssetName Source #

The name of the approval token whose preimage is the given bytes.

initialDatumHash :: Data -> DatumHash Source #

The hash a registration approval commits for the datum a holding starts with: the blake2b-256 hash of its Plutus Data serialisation.

seedData :: TxIn -> Data Source #

An output reference: the transaction id and the output index, as a script reads it.