<blockquote>
<p>I thought datum was used to keep track of the state of the script.</p>
</blockquote>
<p>It can be and often is. This is how its used in a <code>StateMachine</code>, for example.</p>
<p>The cardano chain is 'lean': only the necessary information to ensure the integrity of the chain is required and kept on the chain.</p>
<p>A script is required and run only if a transaction spends from the address, and that script requires the datum to be available.</p>
<p>Sending to a script address from  a payment address doesn't require the script to be run. In the minimalist spirit the chain needs only to record the hash of the datum to ensure that when the UTXO is spent this spending transaction has provided the right datum.</p>
<p>The design requires &quot;off-chain&quot; components of a DApp to take a much greater role for handling state than, say, ethereum. Whatever builds a transaction is responsible for ensuring that all datums and hashes are sensible ones.</p>
<p>Use of datum hashes has been flagged as a pain point:
<a href="https://github.com/cardano-foundation/CIPs/tree/master/CIP-0032" rel="nofollow noreferrer">https://github.com/cardano-foundation/CIPs/tree/master/CIP-0032</a></p>

CC BY-SA 4.0
2022-03-16T09:34:43.623Z
2022-03-16T09:34:43.623Z
waalge
<p>So i am going over the plutus-pionner-program right now and he keeps on iterating this point. Transaction that spends a script output need to provide the datum of that script. Transaction that send money to a script address just need to provide the hash of that script. What is the point of all this ? I thought datum was used to keep track of the state of the script.What role does datum play in using a output from a script address and what role does datum play in sending to a script address.</p>

<transaction><datum>
What is the role of datum in spending a transaction
# What is the role of datum in spending a transaction

(Asked by: username_0 on 2022-03-15)

So i am going over the plutus-pionner-program right now and he keeps on iterating this point. Transaction that spends a script output need to provide the datum of that script. Transaction that send money to a script address just need to provide the hash of that script. What is the point of all this ? I thought datum was used to keep track of the state of the script.What role does datum play in using a output from a script address and what role does datum play in sending to a script address.

**Tags:** transaction, datum

---

## 1 answers

### Answer by username_1 on 2022-03-16. Score: 2 | Accepted answer

> I thought datum was used to keep track of the state of the script.

It can be and often is. This is how its used in a `StateMachine`, for example.

The cardano chain is 'lean': only the necessary information to ensure the integrity of the chain is required and kept on the chain.

A script is required and run only if a transaction spends from the address, and that script requires the datum to be available.

Sending to a script address from a payment address doesn't require the script to be run. In the minimalist spirit the chain needs only to record the hash of the datum to ensure that when the UTXO is spent this spending transaction has provided the right datum.

The design requires "off-chain" components of a DApp to take a much greater role for handling state than, say, ethereum. Whatever builds a transaction is responsible for ensuring that all datums and hashes are sensible ones.

Use of datum hashes has been flagged as a pain point:
<https://github.com/cardano-foundation/CIPs/tree/master/CIP-0032>


---

