singular-registry
LicenseApache-2.0
Safe HaskellNone
LanguageGHC2021

Singular.State.Genesis

Description

The genesis transaction spends a seed, mints the one state token named from it and creates the one state output that holds the token, at the address of the state script, with the empty root. It ends an hour from the tip, so that a creation the chain never took can be proved excluded. The application adds its own steps to the same transaction (for open datum, the registry's configuration record), and the registry the transaction creates is returned with it.

Synopsis

Documentation

buildGenesis Source #

Arguments

:: Session NoWitness IO 
-> StateScript 
-> TxIn

The seed: an unspent output of the payer, spent by the genesis

-> Addr

The payer: fee, collateral and change

-> [(TxIn, TxOut ConwayEra)]

The outputs that carry the application's code, already checked, when it is referenced

-> (RegistryIdentity -> Program ())

The application's steps of the creation

-> IO (Either Refusal (ConwayTx, RegistryIdentity)) 

Build the genesis transaction of the registry the seed creates. The payer funds it and holds the seed. The application's steps receive the registry being created and add their outputs and mints to the same transaction. The outputs that carry the application's code, when it is referenced and not attached, are priced with the state script's, so that the fee covers every reference script the transaction names.