<p>A witness is the public key of the signer and the signature of the txbody using that public key. That is attached to the submitted transaction. It is not possible to query witnesses from db-sync at the moment, but the raw CBOR of the transaction submitted contains all witnesses included in the transaction.</p>

CC BY-SA 4.0
2021-10-01T21:58:59.563Z
Thanks Samuel. If I understand correctly, your answer confirms that witnesses only live inside transaction bodies, but not in blocks. This raises a question of how we can find the source code of a Plutus program, which is considered as a witness. One simple solution I can think of is to build a service that record all transactions on the network, including their witnesses, so a script address could be indexed to a Plutus script easily. I am happy to hear if there is a plan or solution proposed by IOG or the community.
Jerry
CC BY-SA 4.0
2021-12-23T18:06:56.137Z
Blocks are made up of signed transactions. Signed transactions are the raw transaction body + the witnesses for that transaction. cardano-db-sync does not expose witnesses, but the blockchain does store them.
Samuel Leathers
CC BY-SA 4.0
2021-10-01T15:26:40.467Z
2021-10-01T15:26:40.467Z
Samuel Leathers
<p>According to Cardano's <a href="https://hydra.iohk.io/build/7632148/download/1/ledger-spec.pdf" rel="nofollow noreferrer">ledger spec</a> (page 26), the purpose of witnessing is to make sure that the intended action is authorized by the holder
of the signing key, providing replay protection as a consequence. For example, the signature of a transaction and a Plutus script are both witnesses.</p>
<p>Witnesses are used by block producers to validate transactions. After a transaction is validated by a block producer, it will be included in a new block, which is then propagated to the network, and verified by the rest of pools. Obviously, witnesses are required as part of the block validation. However, theoretically, once a transaction is validated and included in a block, is there a strong reason to keep the witnesses in the block? Can witnesses be discarded after being used in transaction validation in order to reduce the size of the blockchain? What does the lifecycle of witnesses look like in Cardano?</p>

<transaction><validator>
Are transaction witnesses stored on the blockchain?
# Are transaction witnesses stored on the blockchain?

(Asked by: username_0 on 2021-09-23)

According to Cardano's [ledger spec](https://hydra.iohk.io/build/7632148/download/1/ledger-spec.pdf) (page 26), the purpose of witnessing is to make sure that the intended action is authorized by the holder
of the signing key, providing replay protection as a consequence. For example, the signature of a transaction and a Plutus script are both witnesses.

Witnesses are used by block producers to validate transactions. After a transaction is validated by a block producer, it will be included in a new block, which is then propagated to the network, and verified by the rest of pools. Obviously, witnesses are required as part of the block validation. However, theoretically, once a transaction is validated and included in a block, is there a strong reason to keep the witnesses in the block? Can witnesses be discarded after being used in transaction validation in order to reduce the size of the blockchain? What does the lifecycle of witnesses look like in Cardano?

**Tags:** transaction, validator

---

## 1 answers

### Answer by username_1 on 2021-10-01. Score: 6 | Accepted answer

A witness is the public key of the signer and the signature of the txbody using that public key. That is attached to the submitted transaction. It is not possible to query witnesses from db-sync at the moment, but the raw CBOR of the transaction submitted contains all witnesses included in the transaction.

> **Comments:**
> **username_0**: Thanks Samuel. If I understand correctly, your answer confirms that witnesses only live inside transaction bodies, but not in blocks. This raises a question of how we can find the source code of a Plutus program, which is considered as a witness. One simple solution I can think of is to build a service that record all transactions on the network, including their witnesses, so a script address could be indexed to a Plutus script easily. I am happy to hear if there is a plan or solution proposed by IOG or the community.  
> **username_1**: Blocks are made up of signed transactions. Signed transactions are the raw transaction body + the witnesses for that transaction. cardano-db-sync does not expose witnesses, but the blockchain does store them.  

---

