<p>Ledger state is <strong>not</strong> stored on the blockchain, but if you start with the correct initial ledger state and apply all blocks, in the correct sequence, from genesis to the current tip, you can recreate ledger state.</p>
<p>The things stored on the block chain include (may not be a complete list):</p>
<ul>
<li>Blocks.</li>
<li>Transactions.</li>
<li>Stake pool registration certificates.</li>
<li>Stake pool parameter changes.</li>
<li>Stake address registrations certificates.</li>
<li>Staking delegation certificates (basically a special part of a transaction).</li>
<li>Proposals and voting for protocol parameters changes.</li>
</ul>
<p>Things that are part of ledger state that is not stored on the blockchain (may also be incomplete):</p>
<ul>
<li>The current UTxO state.</li>
<li>Current amount of ADA delegated to each stake pool.</li>
<li>Which stake address is currently delegated to each pool.</li>
<li>Rewards account balances for each stake address.</li>
<li>Current protocol parameters.</li>
</ul>
<blockquote>
<p>is there anything special added at epoch boundaries?</p>
</blockquote>
<p>For the first Byron era there was an Epoch Boundary Block, but for all eras after that, there are no Epoch Boundary Blocks.</p>

CC BY-SA 4.0
2022-10-24T12:14:31.610Z
A follow-up question: given that Cardano is written in Haskell, is there an ADT somewhere that represents the single item that goes on the chain. Something like `data Block = Txs ... | StakePoolAction ... | Proposal ...`?
Cigarette Smoking Man
CC BY-SA 4.0
2022-10-24T20:16:21.587Z
Unfortunately there is not a single type. The main complication is that all the types you mention are unique for each era (eg Byron, Shelley, Allegra, Mary, Alonzon, Babbage etc).  IMO this is an implementation detail that leaks out of `cardano-api`. For each era `Block` is a product type (ie a struct) with fields for transactions and all the other components. The current best way to access this is via `cardano-api` in the `cardano-node` repo.
Erik de Castro Lopo
CC BY-SA 4.0
2022-10-28T20:04:59.807Z
I think this answer is partly wrong then: https://cardano.stackexchange.com/questions/1977/how-is-the-active-stake-of-a-stake-pool-calculated/1993#1993. It says "Data captured by the snapshot is stored *on-chain* as a part of the ledger state", for me that sentence implies that ledger state is stored on-chain as well.
Cigarette Smoking Man
CC BY-SA 4.0
2022-10-28T21:42:57.833Z
Maybe its the other answer that is wrong. Some (but not all) parts of ledger state are available indirectly on chain. For instance, if you extract all the stake delegations from the chain, you can reconstruct the stake distribution for an epoch, but the stake distribution for an epoch is not directly stored on chain. The reward accounts for all stake addresses can be reconstructed by playing back the block chain, but the reward account balances are not on chain,
Erik de Castro Lopo
CC BY-SA 4.0
2022-10-28T21:46:59.270Z
Also the full ledger state is **HUGE** . When stored on disk (`db-sync` actually does this) in a relatively compact form a single ledger state snapshot is about 2 gigaybtes in size. If that data was stored on chain, the chain would be significantly bigger than it is.
Erik de Castro Lopo
CC BY-SA 4.0
2022-10-22T20:37:43.270Z
2022-10-24T11:45:09.123Z
2022-10-24T11:45:09.123Z
Erik de Castro Lopo
<p>On the transaction you can store some (little metadata)
But a blockchain is not a distributed database.</p>
<p>usage of such feature is dependente on your use case.</p>
<p>Example:
I want to have in the blockchain all repair information of my car.
I'd attach to the transaction a hash that represents data on an &quot;open database&quot; so the record if changed no longer has the hash that was stored on chain.</p>
<p>then your car has its own wallet and anyone can see it's repair history...with confidence it's not faked</p>

CC BY-SA 4.0
2022-10-24T08:37:14.573Z
2022-10-24T08:37:14.573Z
Cristovao Morgado
<p>Is anything other than blocks which contain zero or more transactions, stored? Is e.g ledger state stored, is there anything special added at epoch boundaries?</p>

<ledger>
What are the types of data that are stored on the Cardano blockchain?
# What are the types of data that are stored on the Cardano blockchain?

(Asked by: username_0 on 2022-10-22)

Is anything other than blocks which contain zero or more transactions, stored? Is e.g ledger state stored, is there anything special added at epoch boundaries?

**Tags:** ledger

---

## 2 answers

### Answer by username_1 on 2022-10-22. Score: 2

Ledger state is **not** stored on the blockchain, but if you start with the correct initial ledger state and apply all blocks, in the correct sequence, from genesis to the current tip, you can recreate ledger state.

The things stored on the block chain include (may not be a complete list):

* Blocks.
* Transactions.
* Stake pool registration certificates.
* Stake pool parameter changes.
* Stake address registrations certificates.
* Staking delegation certificates (basically a special part of a transaction).
* Proposals and voting for protocol parameters changes.

Things that are part of ledger state that is not stored on the blockchain (may also be incomplete):

* The current UTxO state.
* Current amount of ADA delegated to each stake pool.
* Which stake address is currently delegated to each pool.
* Rewards account balances for each stake address.
* Current protocol parameters.

> is there anything special added at epoch boundaries?

For the first Byron era there was an Epoch Boundary Block, but for all eras after that, there are no Epoch Boundary Blocks.

> **Comments:**
> **username_0**: A follow-up question: given that Cardano is written in Haskell, is there an ADT somewhere that represents the single item that goes on the chain. Something like `data Block = Txs ... | StakePoolAction ... | Proposal ...`?  
> **username_1**: Unfortunately there is not a single type. The main complication is that all the types you mention are unique for each era (eg Byron, Shelley, Allegra, Mary, Alonzon, Babbage etc).  IMO this is an implementation detail that leaks out of `cardano-api`. For each era `Block` is a product type (ie a struct) with fields for transactions and all the other components. The current best way to access this is via `cardano-api` in the `cardano-node` repo.  
> **username_0**: I think this answer is partly wrong then: https://cardano.stackexchange.com/questions/1977/how-is-the-active-stake-of-a-stake-pool-calculated/1993#1993. It says "Data captured by the snapshot is stored *on-chain* as a part of the ledger state", for me that sentence implies that ledger state is stored on-chain as well.  
> **username_1**: Maybe its the other answer that is wrong. Some (but not all) parts of ledger state are available indirectly on chain. For instance, if you extract all the stake delegations from the chain, you can reconstruct the stake distribution for an epoch, but the stake distribution for an epoch is not directly stored on chain. The reward accounts for all stake addresses can be reconstructed by playing back the block chain, but the reward account balances are not on chain,  
> **username_1**: Also the full ledger state is **HUGE** . When stored on disk (`db-sync` actually does this) in a relatively compact form a single ledger state snapshot is about 2 gigaybtes in size. If that data was stored on chain, the chain would be significantly bigger than it is.  

---

### Answer by username_2 on 2022-10-24. Score: 0

On the transaction you can store some (little metadata)
But a blockchain is not a distributed database.

usage of such feature is dependente on your use case.

Example:
I want to have in the blockchain all repair information of my car.
I'd attach to the transaction a hash that represents data on an "open database" so the record if changed no longer has the hash that was stored on chain.

then your car has its own wallet and anyone can see it's repair history...with confidence it's not faked


---

