Expand description
A read-only, era-agnostic view over Cardano blocks and transactions.
Where pallas-primitives exposes the raw typed CBOR per era, this crate
hides the era split behind MultiEra* enums so a single piece of
indexing or analysis code can run against everything from Byron to
Conway.
This is the read side of the ledger. For transaction construction see
pallas-txbuilder; for ledger-rule validation see pallas-validate.
§Usage
use pallas_traverse::MultiEraBlock;
let block = MultiEraBlock::decode(&cbor_bytes)?;
println!("era={:?} slot={} hash={}", block.era(), block.slot(), block.hash());
for tx in block.txs() {
for output in tx.outputs() {
println!(" → {} lovelace", output.lovelace_amount());
}
}§Overview
MultiEraBlock,MultiEraTx,MultiEraHeader— top-level entry points withdecode/decode_for_eraconstructors.MultiEraInput,MultiEraOutput,MultiEraValue,MultiEraAsset,MultiEraPolicyAssets— per-piece views.MultiEraCert,MultiEraRedeemer,MultiEraWithdrawals,MultiEraSigners,MultiEraMeta,MultiEraUpdate,MultiEraProposal,MultiEraGovAction— the rest of the tx surface, normalised across eras.EraandFeature— discriminators for “which era is this” and “does this era support X” (multi-assets, smart contracts, CIP-1694, …).- Trait-driven hashing:
ComputeHashandOriginalHashgive a uniform way to take Blake2b digests of typed structures. - Per-aspect submodules for deeper helpers:
block,tx,input,output,assets,value,cert,redeemers,witnesses,signers,hashes,fees,governance,time,header,meta,auxiliary,probe,size,withdrawals,wellknown.
§Feature flags
unstable— exposes APIs that are not yet considered stable and may change between minor releases.
§Usage as part of pallas
When depending on the umbrella pallas crate, this crate is re-exported
as pallas::ledger::traverse.
Modules§
- assets
- Helpers for inspecting native and Plutus assets inside outputs and mints.
- auxiliary
- Helpers for transaction auxiliary data (metadata, native scripts, plutus scripts).
- block
- Block-level traversal: era detection, header access, transaction iteration.
- cert
- Helpers for inspecting on-chain certificates across eras.
- era
- Helpers for Cardano ledger eras and feature gating.
- fees
- Fee inspection and computation helpers.
- governance
- Helpers for Conway governance actions, votes, and proposals.
- hashes
- Stable hash computation for ledger entities (
ComputeHash,OriginalHash). - header
- Block-header traversal across era-specific header shapes.
- input
- Helpers for transaction inputs across eras.
- meta
- Helpers for transaction metadata.
- output
- Helpers for transaction outputs across eras.
- probe
- Era detection by probing CBOR shape. Lightweight inspection of block data without full CBOR decoding
- redeemers
- Helpers for Plutus redeemers.
- signers
- Helpers for required-signer hashes.
- size
- Size accounting helpers for transactions and blocks.
- time
- Slot / epoch / wall-clock conversion helpers.
- tx
- Transaction-level traversal: inputs, outputs, witnesses, etc.
- update
- Helpers for protocol-parameter update proposals.
- value
- Helpers for ada plus multi-asset values across eras.
- wellknown
- Well-known genesis hashes and parameter snapshots (will move to a genesis crate).
- withdrawals
- Helpers for reward-account withdrawals.
- witnesses
- Helpers for Plutus and native witnesses.
Structs§
- Output
Ref - Reference to a transaction output by transaction hash and output index.
Enums§
- Era
- The Cardano ledger eras in chronological order.
- Error
- Errors produced while traversing or decoding multi-era data.
- Feature
- Feature flags individual eras can be queried for.
- Multi
EraAsset - A single native or Plutus asset, normalized across eras.
- Multi
EraBlock - A block normalized across eras.
- Multi
EraCert - On-chain certificate normalized across eras.
- Multi
EraGov Action - Conway-era governance action carried by a
MultiEraProposal. - Multi
EraHeader - A block header normalized across eras, keeping access to its raw CBOR.
- Multi
EraInput - Transaction input normalized across eras.
- Multi
EraMeta - Transaction metadata normalized across eras.
- Multi
EraOutput - Transaction output normalized across eras.
- Multi
EraPolicy Assets - Multi-asset bundle for a single policy, normalized across eras.
- Multi
EraProposal - Conway-era governance proposal procedure.
- Multi
EraRedeemer - Plutus redeemer normalized across eras.
- Multi
EraSigners - Required-signer hashes normalized across eras.
- Multi
EraTx - A transaction normalized across eras.
- Multi
EraUpdate - Protocol-parameter update proposal normalized across eras.
- Multi
EraValue - Ada-plus-multi-asset value normalized across eras.
- Multi
EraWithdrawals - Reward-account withdrawals normalized across eras.
Traits§
- Compute
Hash - Recompute the hash of a value from its current in-memory shape.
- Original
Hash - Recover the hash that the value had on the wire, preserving any encoding quirks.