Skip to content

tweag/cardano-block-cost

Repository files navigation

Cardano's block cost analysis

A home for Tweag's investigation into the cost structure of Cardano block validation

Download a Cardano DB snapshot

The script ./bootstrap.sh is a simple wrapper over Mithril that downloads the latest snapshot of the Cardano DB. See the instructions here. You can change where the files are downloaded with --download-dir.

Extract blocks with

# Make snapshots (very important! don't skip)
$ bash ./snapshots.sh
# Run the analysis proper
$ nix run github:tweag/ouroboros-consensus/aspiwack/explore-cardano#db-analyser -- --db path/to/db/ --config path/to/config.json --lmdb --dump-features --block-file path/to/blocks.csv --transaction-file path/to/transactions.csv --analyse-from 146620810

Where

  • --db points to a directory with a node's block database
  • --config points to the config file that the node used
  • --block-file and --transaction-file point to possibly non-existent files, where the data will be dumped.

Notes: -146620810 is the first block (or second block maybe?) of the latest epoch (see feature table). There are meaningful block features way earlier than that (we've used 4492900 as a starting point in the past), but due to a quirk in the implementation of the db-analyser tool, an analysis which crosses depends on the ledger state cannot cross era boundaries.

Did you know?

Some early-project observations

Blocks

The smallest a block has ever been on mainnet is 633 bytes. The largest is 648KB (633KiB). For a mean average of 17KiB per block.

There seems to be trends in block size, see how it evolves over time:

Block size over time, smoothed over 1000 samples

Most blocks are pretty small though

Distribution of block size, as a 100-bin histogram

Witnesses

Here's the distribution of the number of script witnesses in transactions

Distribution of number of script witnesses in transactions, as a 10-bin histogram, with logaritmic scale

About

A home for Tweag's investigation into the cost structure of Cardano block validation

Resources

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors