Module pruned_utreexo

Source
Expand description

The pruned utreexo module handles the full blockchain logic: validation, state tracking and interfacing. This blockchain backend does not store the historical blocks, it’s pruned.

This module file defines the main traits for an utreexo-enabled chain backend:

  • BlockchainInterface: The main interface for interacting with the backend
  • UpdatableChainstate: Trait defining methods for updating the chain state
  • ChainStore: Trait for persisting and retrieving blockchain data (headers, block hashes, the best chain data, and the accumulator)

Modules§

chain_state
This module is centered around the ChainState type, defining it and providing implementations for the BlockchainInterface and UpdatableChainstate traits.
chain_state_builder
This module provides a builder pattern for constructing ChainState instances with various optional configurations.
chainparams
This module provides configuration and parameters for different Bitcoin networks (mainnet, testnet, signet, and regtest).
chainstore
consensus
A collection of functions that implement the consensus rules for the Bitcoin Network. This module contains functions that are used to verify blocks and transactions, and doesn’t assume anything about the chainstate, so it can be used in any context. We use this to avoid code reuse among the different implementations of the chainstate.
error
This module defines error types specific to the blockchain validation and database operations, along with conversion between types.
flat_chain_storeflat-chainstore
A fast database for the chainstore
kv_chainstorekv-chainstore
This is a basic kv database that stores all metadata about our blockchain and utreexo state.
partial_chain
A partial chain is a chain that only contains a subset of the blocks in the full chain. We use multiple partial chains to sync up with the full chain, and then merge them together to get the full chain. This allows us to make Initial Block Download in parallel.
udata
UData is the serialized data used for proof propagation in utreexo. It contains all data needed for validating some piece of information, like a transaction and a block.
utxo_data
This module defines an UtxoData struct, helpful for transaction validation

Enums§

Notification
A notification is a hook that a type implementing BlockchainInterface sends each time the given event happens. This is use to notify new blocks to the Electrum server. In the future, it can be expanded to send more data, like transactions.

Traits§

BlockchainInterface
This trait is the main interface between our blockchain backend and other services. It’ll be useful for transitioning from rpc to a p2p based node
ChainBackend
ChainBackend is a trait alias for the BlockchainInterface and UpdatableChainstate combo meant to be used to specify a generic blockchain backend.
ChainStore
This trait is defining how we interact with our chain database. This definitions will be used by the ChainState to save and retrieve data about the blockchain, likely on disk. Right now, you can use the KvChainStore in your code, it implements this trait and uses a key-value store to save data. The DatabaseError is a simple trait that can be implemented by any error type that implements std::error::Error and std::fmt::Display. This is useful to abstract the database implementation from the blockchain. See the documentation of DatabaseError for more info.
ThreadSafeChain
ThreadSafeChain is a trait alias for the BlockchainInterface, UpdatableChainstate, Sync and Send combo and has a static lifetime. It is meant to be used to specify thread-safe blockchain backends.
UpdatableChainstate
UpdatableChainstate is a contract that a is expected from a chainstate implementation, that wishes to be updated. Using those methods, a backend like the p2p-node, can notify new blocks and transactions to a chainstate, allowing it to update it’s state.