plutus-ledger-1.1.0.0: Wallet API
Safe HaskellNone
LanguageHaskell2010

Ledger.Blockchain

Synopsis

Documentation

data OnChainTx Source #

A transaction on the blockchain. Invalid transactions are still put on the chain to be able to collect fees.

Instances

Instances details
Eq OnChainTx Source # 
Instance details

Defined in Ledger.Blockchain

Show OnChainTx Source # 
Instance details

Defined in Ledger.Blockchain

Generic OnChainTx Source # 
Instance details

Defined in Ledger.Blockchain

Associated Types

type Rep OnChainTx :: Type -> Type Source #

ToJSON OnChainTx Source # 
Instance details

Defined in Ledger.Blockchain

FromJSON OnChainTx Source # 
Instance details

Defined in Ledger.Blockchain

Pretty OnChainTx Source # 
Instance details

Defined in Ledger.Blockchain

Methods

pretty :: OnChainTx -> Doc ann Source #

prettyList :: [OnChainTx] -> Doc ann Source #

Serialise OnChainTx Source # 
Instance details

Defined in Ledger.Blockchain

type Rep OnChainTx Source # 
Instance details

Defined in Ledger.Blockchain

type Rep OnChainTx = D1 ('MetaData "OnChainTx" "Ledger.Blockchain" "plutus-ledger-1.1.0.0-JskZbcPMCdRJVHaAZ0to82" 'False) (C1 ('MetaCons "Invalid" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CardanoTx)) :+: C1 ('MetaCons "Valid" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CardanoTx)))

type Block = [OnChainTx] Source #

A block on the blockchain. This is just a list of transactions following on from the chain so far.

newtype BlockId Source #

Block identifier (usually a hash)

Constructors

BlockId 

Instances

Instances details
Eq BlockId Source # 
Instance details

Defined in Ledger.Blockchain

Ord BlockId Source # 
Instance details

Defined in Ledger.Blockchain

Show BlockId Source # 
Instance details

Defined in Ledger.Blockchain

Generic BlockId Source # 
Instance details

Defined in Ledger.Blockchain

Associated Types

type Rep BlockId :: Type -> Type Source #

ToJSON BlockId Source # 
Instance details

Defined in Ledger.Blockchain

FromJSON BlockId Source # 
Instance details

Defined in Ledger.Blockchain

ToSchema BlockId Source # 
Instance details

Defined in Ledger.Blockchain

Pretty BlockId Source # 
Instance details

Defined in Ledger.Blockchain

Methods

pretty :: BlockId -> Doc ann Source #

prettyList :: [BlockId] -> Doc ann Source #

type Rep BlockId Source # 
Instance details

Defined in Ledger.Blockchain

type Rep BlockId = D1 ('MetaData "BlockId" "Ledger.Blockchain" "plutus-ledger-1.1.0.0-JskZbcPMCdRJVHaAZ0to82" 'True) (C1 ('MetaCons "BlockId" 'PrefixI 'True) (S1 ('MetaSel ('Just "getBlockId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)))

type Blockchain = [Block] Source #

A blockchain, which is just a list of blocks, starting with the newest.

newtype Context Source #

Information about the state of the blockchain and about the transaction that is currently being validated, represented as a value in Data.

Constructors

Context BuiltinData 

eitherTx :: (CardanoTx -> r) -> (CardanoTx -> r) -> OnChainTx -> r Source #

consumableInputs :: OnChainTx -> [TxIn] Source #

Outputs consumed from the UTXO set by the OnChainTx

outputsProduced :: OnChainTx -> Map TxOutRef TxOut Source #

Outputs added to the UTXO set by the OnChainTx

transaction :: Blockchain -> TxId -> Maybe OnChainTx Source #

Lookup a transaction in a Blockchain by its id.

out :: Blockchain -> TxOutRef -> Maybe TxOut Source #

Determine the unspent output that an input refers to

value :: Blockchain -> TxOutRef -> Maybe Value Source #

Determine the unspent value that a transaction output refers to.

unspentOutputsTx :: Tx -> Map TxOutRef TxOut Source #

The unspent outputs of a transaction.

spentOutputs :: Tx -> [TxOutRef] Source #

The transaction output references consumed by a transaction.

unspentOutputs :: Blockchain -> Map TxOutRef TxOut Source #

The unspent transaction outputs of the ledger as a whole.

datumTxo :: Blockchain -> TxOutRef -> Maybe DatumHash Source #

Determine the data script that a transaction output refers to.

updateUtxo :: CardanoTx -> Map TxOutRef TxOut -> Map TxOutRef TxOut Source #

Update a map of unspent transaction outputs and signatures based on the inputs and outputs of a transaction.

pubKeyTxo :: Blockchain -> TxOutRef -> Maybe PubKeyHash Source #

Determine the public key that locks a transaction output, if there is one.

validValuesTx :: Tx -> Bool Source #

Check that all values in a transaction are non-negative.