| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ledger.Blockchain
Synopsis
- data OnChainTx
- _Valid :: Prism' OnChainTx CardanoTx
- _Invalid :: Prism' OnChainTx CardanoTx
- type Block = [OnChainTx]
- newtype BlockId = BlockId {}
- type Blockchain = [Block]
- newtype Context = Context BuiltinData
- eitherTx :: (CardanoTx -> r) -> (CardanoTx -> r) -> OnChainTx -> r
- unOnChain :: OnChainTx -> CardanoTx
- onChainTxIsValid :: OnChainTx -> Bool
- consumableInputs :: OnChainTx -> [TxIn]
- outputsProduced :: OnChainTx -> Map TxOutRef TxOut
- transaction :: Blockchain -> TxId -> Maybe OnChainTx
- out :: Blockchain -> TxOutRef -> Maybe TxOut
- value :: Blockchain -> TxOutRef -> Maybe Value
- unspentOutputsTx :: Tx -> Map TxOutRef TxOut
- spentOutputs :: Tx -> [TxOutRef]
- unspentOutputs :: Blockchain -> Map TxOutRef TxOut
- datumTxo :: Blockchain -> TxOutRef -> Maybe DatumHash
- updateUtxo :: CardanoTx -> Map TxOutRef TxOut -> Map TxOutRef TxOut
- txOutPubKey :: TxOut -> Maybe PubKeyHash
- pubKeyTxo :: Blockchain -> TxOutRef -> Maybe PubKeyHash
- validValuesTx :: Tx -> Bool
Documentation
A transaction on the blockchain. Invalid transactions are still put on the chain to be able to collect fees.
Instances
| Eq OnChainTx Source # | |
| Show OnChainTx Source # | |
| Generic OnChainTx Source # | |
| ToJSON OnChainTx Source # | |
| FromJSON OnChainTx Source # | |
| Pretty OnChainTx Source # | |
| Serialise OnChainTx Source # | |
| type Rep OnChainTx Source # | |
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.
Block identifier (usually a hash)
Constructors
| BlockId | |
Fields | |
Instances
| Eq BlockId Source # | |
| Ord BlockId Source # | |
Defined in Ledger.Blockchain | |
| Show BlockId Source # | |
| Generic BlockId Source # | |
| ToJSON BlockId Source # | |
| FromJSON BlockId Source # | |
| ToSchema BlockId Source # | |
Defined in Ledger.Blockchain Methods declareNamedSchema :: Proxy BlockId -> Declare (Definitions Schema) NamedSchema Source # | |
| Pretty BlockId Source # | |
| type Rep BlockId Source # | |
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.
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 |
onChainTxIsValid :: OnChainTx -> Bool Source #
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.
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.
txOutPubKey :: TxOut -> Maybe PubKeyHash Source #
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.