Giter Site home page Giter Site logo

babbage-examples's Introduction

babbage examples

Project to outline the functionalities of the new babbage era consisting of validators and bash scripts.

Prerequisite

build validators and necessary data to build transactions

  • 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 by cabal 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

What changed on chain

ScriptContext

data ScriptContext = ScriptContext{scriptContextTxInfo :: TxInfo, scriptContextPurpose :: ScriptPurpose }

Nothing changed

TxInfo

V1

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)
}

V2

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

TxInfo

-- | An input of a pending transaction.
data TxInInfo = TxInInfo
{ txInInfoOutRef :: TxOutRef
, txInInfoResolved :: TxOut
}

Nothing changed

TxOut

V1

data TxOut = TxOut {
txOutAddress :: Address,
txOutValue :: Value,
txOutDatumHash :: Maybe DatumHash
}

V2

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

babbage-examples's People

Contributors

adrian1-dot avatar

Stargazers

Adam avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.