btck

Type-safe C++ RAII wrapper over the libbitcoinkernel C API.

Description

Each type in this namespace owns or views a btck_* C handle and forwards to the matching btck_* C function, adding ownership semantics, ranges, and exceptions on top of the plain C interface declared in kernel/bitcoinkernel.h.

Types

NameDescription
Block Owning wrapper over a btck_Block, a full block with its transactions.
BlockHash Owning wrapper over a btck_BlockHash.
BlockHashApi CRTP mixin adding block-hash operations shared by the view and owning types.
BlockHashView Non-owning view over a btck_BlockHash.
BlockHeader Owning wrapper over a btck_BlockHeader.
BlockHeaderApi CRTP mixin adding block-header accessors shared by the view and owning types.
BlockHeaderView Non-owning view over a btck_BlockHeader.
BlockSpentOutputs Owning wrapper over a btck_BlockSpentOutputs, the undo data of a whole block.
BlockTreeEntry Non-owning view over a btck_BlockTreeEntry, a node in the block index tree.
BlockValidationState Owning wrapper over a btck_BlockValidationState, holding a block's validation outcome.
BlockValidationStateApi CRTP mixin adding block-validation-state accessors shared by the view and owning types.
BlockValidationStateView Non-owning view over a btck_BlockValidationState.
ChainMan Owning wrapper over a btck_ChainstateManager, the entry point for block processing.
ChainParams Owning wrapper over btck_ChainParameters, the consensus parameters for a network.
ChainView Non-owning view over a btck_Chain, a sequence of block tree entries by height.
ChainstateManagerOptions Owning wrapper over btck_ChainstateManagerOptions, configuring a ChainMan.
Coin Owning wrapper over a btck_Coin.
CoinApi CRTP mixin adding coin accessors shared by the view and owning types.
CoinView Non-owning view over a btck_Coin, an unspent transaction output entry.
ConsensusParamsView Non-owning view over btck_ConsensusParams, the consensus parameters of a chain.
Context Owning wrapper over a btck_Context, the top-level kernel execution context.
ContextOptions Owning wrapper over btck_ContextOptions, configuring a Context before creation.
Handle Owning RAII handle for a copyable C object of type CType.
Iterator Random-access iterator that lazily materializes views of a collection by index.
KernelNotifications Base class for receiving kernel notifications; override the handlers you need.
Logger Connects a user log sink of type T to the kernel logging system.
OutPoint Owning wrapper over a btck_TransactionOutPoint.
OutPointApi CRTP mixin adding out-point accessors shared by the view and owning types.
OutPointView Non-owning view over a btck_TransactionOutPoint.
PrecomputedTransactionData Owning wrapper over btck_PrecomputedTransactionData used to cache signature hashes.
Range Read-only random-access view over an indexed C-handle collection.
Range Read-only random-access view over an indexed C-handle collection.
ScriptPubkey Owning wrapper over a btck_ScriptPubkey output script.
ScriptPubkeyApi CRTP mixin adding script-pubkey operations shared by the view and owning types.
ScriptPubkeyView Non-owning view over a btck_ScriptPubkey.
Transaction Owning wrapper over a btck_Transaction.
TransactionApi CRTP mixin adding transaction accessors shared by the view and owning types.
TransactionInput Owning wrapper over a btck_TransactionInput.
TransactionInputApi CRTP mixin adding transaction-input accessors shared by the view and owning types.
TransactionInputView Non-owning view over a btck_TransactionInput.
TransactionOutput Owning wrapper over a btck_TransactionOutput.
TransactionOutputApi CRTP mixin adding transaction-output accessors shared by the view and owning types.
TransactionOutputView Non-owning view over a btck_TransactionOutput.
TransactionSpentOutputs Owning wrapper over a btck_TransactionSpentOutputs, the coins spent by one transaction.
TransactionSpentOutputsApi CRTP mixin adding accessors over the coins spent by one transaction.
TransactionSpentOutputsView Non-owning view over a btck_TransactionSpentOutputs.
TransactionView Non-owning view over a btck_Transaction.
TxValidationState Owning wrapper over a btck_TxValidationState, holding a transaction's validation outcome.
Txid Owning wrapper over a btck_Txid transaction identifier.
TxidApi CRTP mixin adding transaction-id operations shared by the view and owning types.
TxidView Non-owning view over a btck_Txid.
UniqueHandle Owning RAII handle for a non-copyable C object, backed by std::unique_ptr.
ValidationInterface Base class for receiving validation events; override the handlers you need.
View Non-owning view over a const C handle of type CType.
WitnessStack Owning wrapper over a btck_WitnessStack.
WitnessStackApi CRTP mixin adding witness-stack accessors shared by the view and owning types.
WitnessStackView Non-owning view over a btck_WitnessStack.
is_bitmask_enum Trait marking an enum as a bitmask; specialize to std::true_type to opt in.

Enums

NameDescription
BlockCheckFlags Selects which block checks to run, mirroring btck_BlockCheckFlags; combinable as a bitmask.
BlockValidationResult Reason a block failed validation, mirroring btck_BlockValidationResult.
ChainType Bitcoin network the chain parameters describe, mirroring btck_ChainType.
LogCategory Logging category, mirroring btck_LogCategory.
LogLevel Logging verbosity level, mirroring btck_LogLevel.
ScriptVerificationFlags Script verification flags, mirroring btck_ScriptVerificationFlags; combinable as a bitmask.
ScriptVerifyStatus Status of a script verification call, mirroring btck_ScriptVerifyStatus.
SynchronizationState Stage of block synchronization, mirroring btck_SynchronizationState.
TxValidationResult Reason a transaction failed validation, mirroring btck_TxValidationResult.
ValidationMode Outcome of a validation operation, mirroring btck_ValidationMode.
Warning Kernel warning condition, mirroring btck_Warning.

Functions

NameDescription
CheckTransaction Runs consensus-level checks on a standalone transaction.
check Throws if a freshly returned C handle is null, otherwise passes it through.
logging_disable Disables all kernel logging.
logging_disable_category Disables logging for a category.
logging_enable_category Enables logging for a category.
logging_set_level_category Sets the log level for a single category.
logging_set_options Applies global logging options.
operator& Bitwise AND of two bitmask-enum values.
operator&= Bitwise AND-assign for a bitmask-enum value.
operator+ Returns an iterator advanced by n positions (offset on the left).
operator^ Bitwise XOR of two bitmask-enum values.
operator^= Bitwise XOR-assign for a bitmask-enum value.
operator| Bitwise OR of two bitmask-enum values.
operator|= Bitwise OR-assign for a bitmask-enum value.
operator~ Bitwise complement of a bitmask-enum value.
set_mock_time Overrides the kernel's notion of the current time, for testing.
write_bytes Serializes a C object into a byte vector using its to_bytes callback.

Concepts

NameDescription
BitmaskEnum Satisfied by enums opted into bitmask operators via is_bitmask_enum.
IndexedContainer Satisfied when a container exposes a size accessor and an indexed element accessor.
Log Satisfied by a type exposing LogMessage(std::string_view) returning void.