6

How can a node verify a transaction with a script address without the script?

I mean when i start a node months after the transaction has been minted into a block. How can my node verify that the script conditions were met since only the hash is persisted in the chain?

2 Answers 2

4

By inspecting the current ledger CDDL specifications, you can see that each block contains a transaction_witness_sets field, where each transaction_witness_set is defined as:

transaction_witness_set =
  { ? 0: [* vkeywitness ]
  , ? 1: [* native_script ]
  , ? 2: [* bootstrap_witness ]
  }

Here, native_script, if present, contains some rules that need to be respected in order for the transaction to be valid (for instance, some minting policy):

native_script =
  [ script_pubkey
  // script_all
  // script_any
  // script_n_of_k
  // invalid_before
     ; Timelock validity intervals are half-open intervals [a, b).
     ; This field specifies the left (included) endpoint a.
  // invalid_hereafter
     ; Timelock validity intervals are half-open intervals [a, b).
     ; This field specifies the right (excluded) endpoint b.
  ]

So not only the script hash is included in the chain, but also the actual rules it contains.

0

A node initially executes a valid Plutus transaction and records it to the chain, it also adds an "isValid" tag to that transaction record.

When a new node starts syncing up and arrives at a Plutus transaction, it only looks out for the "isValid" tag and then adds that transaction to its chain if it does have the tag, this way new nodes don't have to re-execute the script but still have proof they belong on the chain.

3
  • hm sounds bad, when a validator can just set isValid=true and everybody beleves it
    – wutzebaer
    Dec 22, 2022 at 9:01
  • Cardano transactions are deterministic and compliant with the Ledger rules, a block producer cannot just slap an "isValid" tag on a transaction anyhow, it has to be validated by them and according to rules so if a block producer acts adversarially then other validators who do decide to do the heavy-lifting will notice and consensus rules take charge. Also an isValid tag doesn't mean a client will just speed run by default, they can still revalidate the Tx if they choose. Vas points to the data they need in their response. Dec 25, 2022 at 5:58
  • "Can" revalidate sounds vague, i think the other answer is more appropriate and the script is always attached to the transaction and all nodes re-evaluate that the condition were valid.
    – wutzebaer
    Dec 27, 2022 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.