2

In the EUTXO explainer it says that

[The EUTXO model] generalizes the concept of ‘address’ by using the lock-and-key analogy. Instead of restricting locks to public keys and keys to signatures, addresses in the EUTXO model can contain arbitrary logic in the form of scripts. For example, when a node validates a transaction, the node determines whether or not the transaction is allowed to use a certain output as an input. The transaction will look up the script provided by the output's address and will execute the script if the transaction can use the output as an input.

But isn't this the same as locking/unlocking scripts as used in Bitcoin? I understand Cardano's scripts are more sophisticated, but that is a difference of degree.

2 Answers 2

2

EUTXO stands for (Extended Unspent Transaction Output), the mechanism is, in spirit, the same as Bitcoin UTXO (Unspent Transaction Output) but very much improved.

The first difference is between scripting languages, Bitcoin uses Script which is a very primitive scripting language and has around 90 available OP Codes for use. Cardano uses Plutus which is essentially Haskell, a very powerful functional programming language.

The second difference is the information the script has to work with, Bitcoin script does not have access to the context information of the transaction, the user locking funds in a Bitcoin UTXO provides a partial Bitcoin Script, and the spender must complete the Script in a way that the Script leaves the value true on the stack after the execution ends, but the script is blind to the details of the transaction (the script has access to the signatures, but not the details about how the value is being transferred between parties), for example:

OP_HASH256 6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000 OP_EQUAL

This script will hash twice the given data with SHA-256 (see OP_HASH256) and compare the result to the embedded hash (in this case the data is Genesis block header).

A Cardano Plutus script on the other hand has full access to everything that is going on in the transaction, how the ADA is moving, signatures etc:

-- | A pending transaction. This is the view as seen by validator scripts, so some details are stripped out.
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)
    } deriving stock (Generic, Haskell.Show, Haskell.Eq)

And the third difference is the introduction of the concept of Datum and Reedemer, Datums are linked to EUTXOs and are useful to keep track of state, and Reedemer is data that can be provided to the EUTXO when we want to unlock it, both Datums and Redeemers can be arbitrary data structures.

This is a good resource from the Plutus Pioneer Program that goes into detail on how the EUTXO model work:

https://www.youtube.com/watch?v=bfofA4MM0QE

The EUTXO in general it's more expensive and powerful.

1
  • Very good explainer. I still think that the text I quoted is misleading; UTXOs in the UTXO model can be locked with scripts. I think it would be better if the Cardano docs were rewritten to explain how much more powerful Cardano's scripts are rather than claim that the difference is the possibility of using scripts. I guess the EUTXO definition they use comes from a time when bitcoin did not support locking UTXOs with scripts, only (hashed) public keys. Jul 25 at 6:26
1

Yes, but the Bitcoin blockchain does not store a datum on-chain. So the concept is similar but you are very limited what you can do with those scripts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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