2

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?

2 Answers 2

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.

5
  • 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 ...? Oct 24, 2022 at 12:14
  • 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. Oct 24, 2022 at 20:16
  • I think this answer is partly wrong then: cardano.stackexchange.com/questions/1977/…. 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. Oct 28, 2022 at 20:04
  • 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, Oct 28, 2022 at 21:42
  • 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. Oct 28, 2022 at 21:46
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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