In particular, I want to know whether the smart contract is somehow its own entity in the blockchain, or if a smart contract is just a property that EUTxOs may pick up.

EUTxOs are bound by smart contracts via their script addresses. But where actually is the script? To make it more practical-- how does a dapp dev actually get his smart contracts on-chain for others to use?

Some wild ideas passing through my head...

a) you have to reference some off-chain script to cause your EUTxO to operate under it.

b) you have to use a reference EUTxO, whose only purpose is to give a generic source for the smart contract's script,

c) or else, maybe the script is deployed independently on-chain somehow (outside of an EUTxO).

I'm quite ignorant about how EUTxO works; so, a), b), and c) are just to help show you where you need to do surgery.

2 Answers 2



A smart contract is the combination of off-chain and on-chain code that interact to form some desired behavior.

The on-chain smart contract code is called a script. The script can be compiled and the hash of that compiled code becomes the unique script address for that script.

EUTxOs are values that are owned by addresses on the blockchain. To spend EUTxOs at a script address, a transaction must be validated by the on-chain script.

If the hash of your compiled script doesn't match the script address, or the transaction is not validated by the script, you will not be able to spend the EUTxOs at the script address.


Where does a smart contract exist, in EUTxO?

Smart contracts exist in combination on and off chain. The state of the smart contract is stored on EUTxOs on-chain, at script addresses. In order to modify the smart contract's state, you must spend EUTxOs and possibly generate new ones with new state. The rules that say how EUTxOs at a script address can be spent are the scripts themselves.

Hope that helps :)

  • 1
    'The on-chain smart contract code is called a script. That script code doesn't need to actually live on-chain though (explained below).' These two sentences are confusing. My inital takeaway is -- all of the smart contract's code is called a script, and is off-chain. The on-chain stamp that binds an EUTxO to it is the hash of the script-- called a 'script address.' So, the on-chain component of a smart contract (script address) serves only to seal EUTxOs under a set off-chain rules (script). But is some code (beyond Script Addr.) actually on chain? Do you see where I'm going wrong? Commented Aug 18, 2021 at 22:57
  • I'll put it like this: If you can prove that the code you are having run by the nodes hashes to the script address, is there any need to save it on the chain? BUT, I just read some of the specs here (hydra.iohk.io/build/7244348/download/1/plutus.pdf) and it sound like the script is stored on the chain AFAICT. So I'll edit my original post. It's still a useful way of thinking of the on-chain scripts though! Commented Aug 19, 2021 at 0:07

(I've opted for a short answer, aiming to shed enough initial light on it. Of course, this is my take on it and there is a lot more to be said about it.)

Smart contracts do not exist/live on-chain.
They are units of software that exist/live off-chain and that generate transactions specific to the smart contract implementation.
These transactions are executed on-chain and use EUTxOs as inputs.

Transactions are validated prior to execution. Smart contracts implement validators (scripts) to form part of the transaction validation routine. These validators provide validation specific to the smart contract that the transaction belongs to.

A smart contract implementation (currently written in Haskell) can share code between its off-chain implementation and the on-chain validators. The on-chain code is compiled separately into Plutus Core as part of the implementation.

The implementation of a smart contract includes validating the transactions it creates prior to sending them on-chain. This ensures that there can't be failed transactions that incur costs. A transaction may still fail when sent for execution if the input EUTxOs it was validated with are not available any more.

Smart contracts can be invoked programmatically, and there also is a PAB that exposes it through an API. Currently, it is up to the smart contract developer to make it available for use.
However this is an area still very much under discussion. There are (early) plans to make smart contracts available as client browser apps interacting with e.g.Yoroi.

  • This answer provides me a lot of useful details. It isn't as structurally clear and terminologically clear enough to make me confident in my understanding though. You are dealing with a beginner though, so take that with a grain of salt :) Upvoted. Commented Aug 18, 2021 at 22:54
  • 1
    Thanks @MatthewCapps! The aim of the answer was to be informative knowing it wasn't 'complete' so to speak. I wouldn't call myself an expert, but I think the most important is to share understanding.
    – vcwebco
    Commented Aug 19, 2021 at 15:11

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.