Project to outline the functionalities of the new babbage era consisting of validators and bash scripts.
- The Plutus Application Framework
- cardano-node
- jq
- Ubuntu:
sudo apt-get install jq
- Ubuntu:
- at least one funded wallet
- one token in the wallet
- start your cardano-node (pre-production testnet)
- open new terminal and enter your plutus-apps nix-shell with tag 87b647b05902a7cef37340fda9acb175f962f354
- go to the root folder of this repository and run
cabal update
followed bycabal build
- go into /testnet/env.sh and change the values to your own
- TESTNET can be left as is for pre-production testnet
- CLIWALLET is the path where you store your wallet key files (.addr, .vkey, .skey)
- CS_V2_REFIN currency symbol of a token in your wallet
- TN_V2_REFIN corresponding token name
- AMOUNT can be left as 5 ada, later used as datum
- CS_V2_REFSCR currency symbol of a token in your wallet (other than CS_V2_REFIN)
- TN_V2_REFSCR corresponding token name
- make it an executable
chmod +x env.sh
- run
. env.sh
to mount the variables for this shell - go into the /v2 folder and run
./createPlutusData.sh
- creates validators, datums, redeemers in /Data folder
- now you can run the examples provided in the subdirectories
data ScriptContext = ScriptContext{scriptContextTxInfo :: TxInfo, scriptContextPurpose :: ScriptPurpose }
Nothing changed
data TxInfo = TxInfo
{ txInfoInputs :: [TxInInfo] -- ^ Transaction inputs
, txInfoOutputs :: [TxOut] -- ^ Transaction outputs
, txInfoFee :: Value -- ^ The fee paid by this transaction.
, txInfoMint :: Value -- ^ The 'Value' minted by this transaction.
, txInfoDCert :: [DCert] -- ^ Digests of certificates included in this transaction
, txInfoWdrl :: [(StakingCredential, Integer)] -- ^ Withdrawals
, txInfoValidRange :: POSIXTimeRange -- ^ The valid range for the transaction.
, txInfoSignatories :: [PubKeyHash] -- ^ Signatures provided with the transaction, attested that they all signed the tx
, txInfoData :: [(DatumHash, Datum)]
, txInfoId :: TxId
-- ^ Hash of the pending transaction (excluding witnesses)
}
data TxInfo = TxInfo
{ txInfoInputs :: [TxInInfo] -- ^ Transaction inputs
, txInfoReferenceInputs :: [TxInInfo] -- ^ Transaction reference inputs
, txInfoOutputs :: [TxOut] -- ^ Transaction outputs
, txInfoFee :: Value -- ^ The fee paid by this transaction.
, txInfoMint :: Value -- ^ The 'Value' minted by this transaction.
, txInfoDCert :: [DCert] -- ^ Digests of certificates included in this transaction
, txInfoWdrl :: Map StakingCredential Integer -- ^ Withdrawals
, txInfoValidRange :: POSIXTimeRange -- ^ The valid range for the transaction.
, txInfoSignatories :: [PubKeyHash] -- ^ Signatures provided with the transaction, attested that they all signed the tx
, txInfoRedeemers :: Map ScriptPurpose Redeemer
, txInfoData :: Map DatumHash Datum
, txInfoId :: TxId
-- ^ Hash of the pending transaction (excluding witnesses)
}
txInfoReferenceInputs
indicated with--read-only-tx-in-reference
(cardano-cli), only possible with wallet utxos
-- | An input of a pending transaction.
data TxInInfo = TxInInfo
{ txInInfoOutRef :: TxOutRef
, txInInfoResolved :: TxOut
}
Nothing changed
data TxOut = TxOut {
txOutAddress :: Address,
txOutValue :: Value,
txOutDatumHash :: Maybe DatumHash
}
data TxOut = TxOut {
txOutAddress :: Address,
txOutValue :: Value,
txOutDatum :: OutputDatum,
txOutReferenceScript :: Maybe ScriptHash
}
- txOutDatum is a new type
data OutputDatum = NoOutputDatum | OutputDatumHash DatumHash | OutputDatum Datum
OutputDatum is the new inline-datum - txOutReferenceScript is a reference script attached to a transaction output, as input it just tells the node to build the transaction for the referenced script but isn't included in the transaction