![]() |
Bitcoin Core 32.99.0
P2P Digital Currency
|
#include <stddef.h>#include <stdint.h>Go to the source code of this file.
Classes | |
| struct | btck_LogEntry |
| A log entry passed to the logging callback. More... | |
| struct | btck_ValidationInterfaceCallbacks |
| Holds the validation interface callbacks. More... | |
| struct | btck_NotificationInterfaceCallbacks |
| A struct for holding the kernel notification callbacks. More... | |
Typedefs | |
| typedef struct btck_Transaction | btck_Transaction |
| Opaque data structure for holding a transaction. More... | |
| typedef struct btck_ScriptPubkey | btck_ScriptPubkey |
| Opaque data structure for holding a script pubkey. More... | |
| typedef struct btck_TransactionOutput | btck_TransactionOutput |
| Opaque data structure for holding a transaction output. More... | |
| typedef struct btck_LoggingConnection | btck_LoggingConnection |
| Opaque data structure for holding a logging connection. More... | |
| typedef struct btck_ChainParameters | btck_ChainParameters |
| Opaque data structure for holding the chain parameters. More... | |
| typedef struct btck_ContextOptions | btck_ContextOptions |
| Opaque data structure for holding options for creating a new kernel context. More... | |
| typedef struct btck_Context | btck_Context |
| Opaque data structure for holding a kernel context. More... | |
| typedef struct btck_BlockTreeEntry | btck_BlockTreeEntry |
| Opaque data structure for holding a block tree entry. More... | |
| typedef struct btck_ChainstateManagerOptions | btck_ChainstateManagerOptions |
| Opaque data structure for holding options for creating a new chainstate manager. More... | |
| typedef struct btck_ChainstateManager | btck_ChainstateManager |
| Opaque data structure for holding a chainstate manager. More... | |
| typedef struct btck_Block | btck_Block |
| Opaque data structure for holding a block. More... | |
| typedef struct btck_BlockValidationState | btck_BlockValidationState |
| Opaque data structure for holding the state of a block during validation. More... | |
| typedef struct btck_ConsensusParams | btck_ConsensusParams |
| Opaque data structure for holding the Consensus Params. More... | |
| typedef struct btck_Chain | btck_Chain |
| Opaque data structure for holding the currently known best-chain associated with a chainstate. More... | |
| typedef struct btck_TxValidationState | btck_TxValidationState |
| Opaque data structure for holding the state of a transaction during validation. More... | |
| typedef struct btck_BlockSpentOutputs | btck_BlockSpentOutputs |
| Opaque data structure for holding a block's spent outputs. More... | |
| typedef struct btck_TransactionSpentOutputs | btck_TransactionSpentOutputs |
| Opaque data structure for holding a transaction's spent outputs. More... | |
| typedef struct btck_Coin | btck_Coin |
| Opaque data structure for holding a coin. More... | |
| typedef struct btck_BlockHash | btck_BlockHash |
| Opaque data structure for holding a block hash. More... | |
| typedef struct btck_TransactionInput | btck_TransactionInput |
| Opaque data structure for holding a transaction input. More... | |
| typedef struct btck_WitnessStack | btck_WitnessStack |
| Opaque data structure for holding a witness stack. More... | |
| typedef struct btck_TransactionOutPoint | btck_TransactionOutPoint |
| Opaque data structure for holding a transaction out point. More... | |
| typedef struct btck_PrecomputedTransactionData | btck_PrecomputedTransactionData |
| Opaque data structure for holding precomputed transaction data. More... | |
| typedef struct btck_Txid | btck_Txid |
| Opaque data structure for holding a btck_Txid. More... | |
| typedef struct btck_Wtxid | btck_Wtxid |
| Opaque data structure for holding a btck_Wtxid. More... | |
| typedef struct btck_BlockHeader | btck_BlockHeader |
| Opaque data structure for holding a btck_BlockHeader. More... | |
| typedef uint8_t | btck_SynchronizationState |
| Current sync state passed to tip changed callbacks. More... | |
| typedef uint8_t | btck_Warning |
| Possible warning types issued by validation. More... | |
| typedef uint8_t | btck_LogCategory |
| A collection of logging categories that may be encountered by kernel code. More... | |
| typedef uint8_t | btck_LogLevel |
| The severity of a log statement. More... | |
| typedef void(* | btck_LogCallback) (void *user_data, const btck_LogEntry *entry) |
| Callback function types. More... | |
| typedef void(* | btck_DestroyCallback) (void *user_data) |
| Function signature for freeing user data. More... | |
| typedef void(* | btck_NotifyBlockTip) (void *user_data, btck_SynchronizationState state, const btck_BlockTreeEntry *entry, double verification_progress) |
| Function signatures for the kernel notifications. More... | |
| typedef void(* | btck_NotifyHeaderTip) (void *user_data, btck_SynchronizationState state, int64_t height, int64_t timestamp, int presync) |
| typedef void(* | btck_NotifyProgress) (void *user_data, const char *title, size_t title_len, int progress_percent, int resume_possible) |
| typedef void(* | btck_NotifyWarningSet) (void *user_data, btck_Warning warning, const char *message, size_t message_len) |
| typedef void(* | btck_NotifyWarningUnset) (void *user_data, btck_Warning warning) |
| typedef void(* | btck_NotifyFlushError) (void *user_data, const char *message, size_t message_len) |
| typedef void(* | btck_NotifyFatalError) (void *user_data, const char *message, size_t message_len) |
| typedef void(* | btck_ValidationInterfaceBlockChecked) (void *user_data, btck_Block *block, const btck_BlockValidationState *state) |
| Function signatures for the validation interface. More... | |
| typedef void(* | btck_ValidationInterfacePoWValidBlock) (void *user_data, btck_Block *block, const btck_BlockTreeEntry *entry) |
| typedef void(* | btck_ValidationInterfaceBlockConnected) (void *user_data, btck_Block *block, const btck_BlockTreeEntry *entry) |
| typedef void(* | btck_ValidationInterfaceBlockDisconnected) (void *user_data, btck_Block *block, const btck_BlockTreeEntry *entry) |
| typedef int(* | btck_WriteBytes) (const void *bytes, size_t size, void *userdata) |
| Function signature for serializing data. More... | |
| typedef uint8_t | btck_ValidationMode |
| Whether a validated data structure is valid, invalid, or an error was encountered during processing. More... | |
| typedef uint32_t | btck_BlockValidationResult |
| A granular "reason" why a block was invalid. More... | |
| typedef uint32_t | btck_TxValidationResult |
| Indicates the reason why a transaction failed validation. More... | |
| typedef uint8_t | btck_ScriptVerifyStatus |
| A collection of status codes that may be issued by the script verify function. More... | |
| typedef uint32_t | btck_ScriptVerificationFlags |
| Script verification flags that may be composed with each other. More... | |
| typedef uint8_t | btck_ChainType |
| #define BITCOINKERNEL_API |
Definition at line 27 of file bitcoinkernel.h.
| #define BITCOINKERNEL_ARG_NONNULL | ( | ... | ) |
BITCOINKERNEL_ARG_NONNULL is a compiler attribute used to indicate that certain pointer arguments to a function are not expected to be null.
Callers must not pass a null pointer for arguments marked with this attribute, as doing so may result in undefined behavior. This attribute should only be used for arguments where a null pointer is unambiguously a programmer error, such as for opaque handles, and not for pointers to raw input data that might validly be null (e.g., from an empty std::span or std::string).
Definition at line 60 of file bitcoinkernel.h.
| #define BITCOINKERNEL_WARN_UNUSED_RESULT |
BITCOINKERNEL_WARN_UNUSED_RESULT is a compiler attribute used to indicate that ignoring a function's return value is almost certainly a bug.
It is used in cases such as a resource leak (e.g. an owning handle returned by a *_create or *_copy function), or when the returned value is itself an error/status code. It is not used merely because discarding the result is wasteful, e.g. on getters or predicates.
Definition at line 44 of file bitcoinkernel.h.
| #define btck_BlockCheckFlags_ALL ((btck_BlockCheckFlags)(btck_BlockCheckFlags_POW | btck_BlockCheckFlags_MERKLE)) |
enable all optional context-free block checks
Definition at line 1444 of file bitcoinkernel.h.
| #define btck_BlockCheckFlags_BASE ((btck_BlockCheckFlags)0) |
run the base context-free block checks only
Definition at line 1441 of file bitcoinkernel.h.
| #define btck_BlockCheckFlags_MERKLE ((btck_BlockCheckFlags)(1U << 1)) |
verify merkle root (and mutation detection)
Definition at line 1443 of file bitcoinkernel.h.
| #define btck_BlockCheckFlags_POW ((btck_BlockCheckFlags)(1U << 0)) |
run CheckProofOfWork via CheckBlockHeader
Definition at line 1442 of file bitcoinkernel.h.
| #define btck_BlockValidationResult_CACHED_INVALID ((btck_BlockValidationResult)(2)) |
this block was cached as being invalid and we didn't store the reason why
Definition at line 490 of file bitcoinkernel.h.
| #define btck_BlockValidationResult_CONSENSUS ((btck_BlockValidationResult)(1)) |
invalid by consensus rules (excluding any below reasons)
Definition at line 489 of file bitcoinkernel.h.
| #define btck_BlockValidationResult_HEADER_LOW_WORK ((btck_BlockValidationResult)(8)) |
the block header may be on a too-little-work chain
Definition at line 496 of file bitcoinkernel.h.
| #define btck_BlockValidationResult_INVALID_HEADER ((btck_BlockValidationResult)(3)) |
invalid proof of work or time too old
Definition at line 491 of file bitcoinkernel.h.
| #define btck_BlockValidationResult_INVALID_PREV ((btck_BlockValidationResult)(6)) |
A block this one builds on is invalid.
Definition at line 494 of file bitcoinkernel.h.
| #define btck_BlockValidationResult_MISSING_PREV ((btck_BlockValidationResult)(5)) |
We don't have the previous block the checked one is built on.
Definition at line 493 of file bitcoinkernel.h.
| #define btck_BlockValidationResult_MUTATED ((btck_BlockValidationResult)(4)) |
the block's data didn't match the data committed to by the PoW
Definition at line 492 of file bitcoinkernel.h.
| #define btck_BlockValidationResult_TIME_FUTURE ((btck_BlockValidationResult)(7)) |
block timestamp was > 2 hours in the future (or our clock is bad)
Definition at line 495 of file bitcoinkernel.h.
| #define btck_BlockValidationResult_UNSET ((btck_BlockValidationResult)(0)) |
initial value. Block has not yet been rejected
Definition at line 488 of file bitcoinkernel.h.
| #define btck_ChainType_MAINNET ((btck_ChainType)(0)) |
Definition at line 591 of file bitcoinkernel.h.
| #define btck_ChainType_REGTEST ((btck_ChainType)(4)) |
Definition at line 595 of file bitcoinkernel.h.
| #define btck_ChainType_SIGNET ((btck_ChainType)(3)) |
Definition at line 594 of file bitcoinkernel.h.
| #define btck_ChainType_TESTNET ((btck_ChainType)(1)) |
Definition at line 592 of file bitcoinkernel.h.
| #define btck_ChainType_TESTNET_4 ((btck_ChainType)(2)) |
Definition at line 593 of file bitcoinkernel.h.
| #define btck_LogCategory_BENCH ((btck_LogCategory)(1)) |
Definition at line 361 of file bitcoinkernel.h.
| #define btck_LogCategory_BLOCKSTORAGE ((btck_LogCategory)(2)) |
Definition at line 362 of file bitcoinkernel.h.
| #define btck_LogCategory_COINDB ((btck_LogCategory)(3)) |
Definition at line 363 of file bitcoinkernel.h.
| #define btck_LogCategory_KERNEL ((btck_LogCategory)(10)) |
Definition at line 370 of file bitcoinkernel.h.
| #define btck_LogCategory_LEVELDB ((btck_LogCategory)(4)) |
Definition at line 364 of file bitcoinkernel.h.
| #define btck_LogCategory_LOCK ((btck_LogCategory)(12)) |
Definition at line 372 of file bitcoinkernel.h.
| #define btck_LogCategory_MEMPOOL ((btck_LogCategory)(5)) |
Definition at line 365 of file bitcoinkernel.h.
| #define btck_LogCategory_NONE ((btck_LogCategory)(0)) |
Not tied to a specific category, e.g. most INFO, WARNING and ERROR entries.
Definition at line 360 of file bitcoinkernel.h.
| #define btck_LogCategory_PRUNE ((btck_LogCategory)(6)) |
Definition at line 366 of file bitcoinkernel.h.
| #define btck_LogCategory_RAND ((btck_LogCategory)(7)) |
Definition at line 367 of file bitcoinkernel.h.
| #define btck_LogCategory_REINDEX ((btck_LogCategory)(8)) |
Definition at line 368 of file bitcoinkernel.h.
| #define btck_LogCategory_TXPACKAGES ((btck_LogCategory)(11)) |
Definition at line 371 of file bitcoinkernel.h.
| #define btck_LogCategory_VALIDATION ((btck_LogCategory)(9)) |
Definition at line 369 of file bitcoinkernel.h.
| #define btck_LogLevel_DEBUG ((btck_LogLevel)(1)) |
Definition at line 379 of file bitcoinkernel.h.
| #define btck_LogLevel_ERROR ((btck_LogLevel)(4)) |
Definition at line 382 of file bitcoinkernel.h.
| #define btck_LogLevel_INFO ((btck_LogLevel)(2)) |
Definition at line 380 of file bitcoinkernel.h.
| #define btck_LogLevel_TRACE ((btck_LogLevel)(0)) |
Definition at line 378 of file bitcoinkernel.h.
| #define btck_LogLevel_WARNING ((btck_LogLevel)(3)) |
Definition at line 381 of file bitcoinkernel.h.
| #define btck_ScriptVerificationFlags_ALL |
Definition at line 582 of file bitcoinkernel.h.
| #define btck_ScriptVerificationFlags_CHECKLOCKTIMEVERIFY ((btck_ScriptVerificationFlags)(1U << 9)) |
enable CHECKLOCKTIMEVERIFY (BIP65)
Definition at line 578 of file bitcoinkernel.h.
| #define btck_ScriptVerificationFlags_CHECKSEQUENCEVERIFY ((btck_ScriptVerificationFlags)(1U << 10)) |
enable CHECKSEQUENCEVERIFY (BIP112)
Definition at line 579 of file bitcoinkernel.h.
| #define btck_ScriptVerificationFlags_DERSIG ((btck_ScriptVerificationFlags)(1U << 2)) |
enforce strict DER (BIP66) compliance
Definition at line 576 of file bitcoinkernel.h.
| #define btck_ScriptVerificationFlags_NONE ((btck_ScriptVerificationFlags)(0)) |
Definition at line 574 of file bitcoinkernel.h.
| #define btck_ScriptVerificationFlags_NULLDUMMY ((btck_ScriptVerificationFlags)(1U << 4)) |
enforce NULLDUMMY (BIP147)
Definition at line 577 of file bitcoinkernel.h.
| #define btck_ScriptVerificationFlags_P2SH ((btck_ScriptVerificationFlags)(1U << 0)) |
evaluate P2SH (BIP16) subscripts
Definition at line 575 of file bitcoinkernel.h.
| #define btck_ScriptVerificationFlags_TAPROOT ((btck_ScriptVerificationFlags)(1U << 17)) |
enable TAPROOT (BIPs 341 & 342)
Definition at line 581 of file bitcoinkernel.h.
| #define btck_ScriptVerificationFlags_WITNESS ((btck_ScriptVerificationFlags)(1U << 11)) |
enable WITNESS (BIP141)
Definition at line 580 of file bitcoinkernel.h.
| #define btck_ScriptVerifyStatus_ERROR_INVALID_FLAGS_COMBINATION ((btck_ScriptVerifyStatus)(1)) |
The flags were combined in an invalid way.
Definition at line 567 of file bitcoinkernel.h.
| #define btck_ScriptVerifyStatus_ERROR_SPENT_OUTPUTS_REQUIRED ((btck_ScriptVerifyStatus)(2)) |
The taproot flag was set, so valid spent_outputs have to be provided.
Definition at line 568 of file bitcoinkernel.h.
| #define btck_ScriptVerifyStatus_OK ((btck_ScriptVerifyStatus)(0)) |
Definition at line 566 of file bitcoinkernel.h.
| #define btck_SynchronizationState_INIT_DOWNLOAD ((btck_SynchronizationState)(1)) |
Definition at line 348 of file bitcoinkernel.h.
| #define btck_SynchronizationState_INIT_REINDEX ((btck_SynchronizationState)(0)) |
Definition at line 347 of file bitcoinkernel.h.
| #define btck_SynchronizationState_POST_INIT ((btck_SynchronizationState)(2)) |
Definition at line 349 of file bitcoinkernel.h.
| #define btck_TxValidationResult_CONFLICT ((btck_TxValidationResult)(8)) |
tx already in mempool or conflicts with a tx in the chain
Definition at line 511 of file bitcoinkernel.h.
| #define btck_TxValidationResult_CONSENSUS ((btck_TxValidationResult)(1)) |
invalid by consensus rules
Definition at line 504 of file bitcoinkernel.h.
| #define btck_TxValidationResult_INPUTS_NOT_STANDARD ((btck_TxValidationResult)(2)) |
inputs (covered by txid) failed policy rules
Definition at line 505 of file bitcoinkernel.h.
| #define btck_TxValidationResult_MEMPOOL_POLICY ((btck_TxValidationResult)(9)) |
violated mempool's fee/size/descendant/RBF/etc limits
Definition at line 512 of file bitcoinkernel.h.
| #define btck_TxValidationResult_MISSING_INPUTS ((btck_TxValidationResult)(4)) |
transaction was missing some of its inputs
Definition at line 507 of file bitcoinkernel.h.
| #define btck_TxValidationResult_NO_MEMPOOL ((btck_TxValidationResult)(10)) |
this node does not have a mempool so can't validate the transaction
Definition at line 513 of file bitcoinkernel.h.
| #define btck_TxValidationResult_NOT_STANDARD ((btck_TxValidationResult)(3)) |
otherwise didn't meet local policy rules
Definition at line 506 of file bitcoinkernel.h.
| #define btck_TxValidationResult_PREMATURE_SPEND ((btck_TxValidationResult)(5)) |
transaction spends a coinbase too early, or violates locktime/sequence locks
Definition at line 508 of file bitcoinkernel.h.
| #define btck_TxValidationResult_RECONSIDERABLE ((btck_TxValidationResult)(11)) |
fails some policy, but might be acceptable if submitted in a (different) package
Definition at line 514 of file bitcoinkernel.h.
| #define btck_TxValidationResult_UNKNOWN ((btck_TxValidationResult)(12)) |
transaction was not validated because package failed
Definition at line 515 of file bitcoinkernel.h.
| #define btck_TxValidationResult_UNSET ((btck_TxValidationResult)(0)) |
initial value. Tx has not yet been rejected
Definition at line 503 of file bitcoinkernel.h.
| #define btck_TxValidationResult_WITNESS_MUTATED ((btck_TxValidationResult)(6)) |
witness may have been malleated or is prior to SegWit activation
Definition at line 509 of file bitcoinkernel.h.
| #define btck_TxValidationResult_WITNESS_STRIPPED ((btck_TxValidationResult)(7)) |
transaction is missing a witness
Definition at line 510 of file bitcoinkernel.h.
| #define btck_ValidationMode_INTERNAL_ERROR ((btck_ValidationMode)(2)) |
Definition at line 482 of file bitcoinkernel.h.
| #define btck_ValidationMode_INVALID ((btck_ValidationMode)(1)) |
Definition at line 481 of file bitcoinkernel.h.
| #define btck_ValidationMode_VALID ((btck_ValidationMode)(0)) |
Definition at line 480 of file bitcoinkernel.h.
| #define btck_Warning_LARGE_WORK_INVALID_CHAIN ((btck_Warning)(1)) |
Definition at line 354 of file bitcoinkernel.h.
| #define btck_Warning_UNKNOWN_NEW_RULES_ACTIVATED ((btck_Warning)(0)) |
Definition at line 353 of file bitcoinkernel.h.
| typedef struct btck_Block btck_Block |
Opaque data structure for holding a block.
Definition at line 229 of file bitcoinkernel.h.
| typedef uint32_t btck_BlockCheckFlags |
Bitflags to control context-free block checks (optional).
Definition at line 1440 of file bitcoinkernel.h.
| typedef struct btck_BlockHash btck_BlockHash |
Opaque data structure for holding a block hash.
This is a type-safe identifier for a block.
Definition at line 293 of file bitcoinkernel.h.
| typedef struct btck_BlockHeader btck_BlockHeader |
Opaque data structure for holding a btck_BlockHeader.
Definition at line 343 of file bitcoinkernel.h.
| typedef struct btck_BlockSpentOutputs btck_BlockSpentOutputs |
Opaque data structure for holding a block's spent outputs.
Contains all the previous outputs consumed by all transactions in a specific block. Internally it holds a nested vector. The top level vector has an entry for each transaction in a block (in order of the actual transactions of the block and without the coinbase transaction). This is exposed through btck_TransactionSpentOutputs. Each btck_TransactionSpentOutputs is in turn a vector of all the previous outputs of a transaction (in order of their corresponding inputs).
Definition at line 269 of file bitcoinkernel.h.
| typedef struct btck_BlockTreeEntry btck_BlockTreeEntry |
Opaque data structure for holding a block tree entry.
This is a pointer to an element in the block index currently in memory of the chainstate manager. It is valid for the lifetime of the chainstate manager it was retrieved from. The entry is part of a tree-like structure that is maintained internally. Every entry, besides the genesis, points to a single parent. Multiple entries may share a parent, thus forming a tree. Each entry corresponds to a single block and may be used to retrieve its data and validation status.
Definition at line 204 of file bitcoinkernel.h.
| typedef uint32_t btck_BlockValidationResult |
A granular "reason" why a block was invalid.
Definition at line 487 of file bitcoinkernel.h.
| typedef struct btck_BlockValidationState btck_BlockValidationState |
Opaque data structure for holding the state of a block during validation.
Contains information indicating whether validation was successful, and if not which step during block validation failed.
Definition at line 237 of file bitcoinkernel.h.
| typedef struct btck_Chain btck_Chain |
Opaque data structure for holding the currently known best-chain associated with a chainstate.
Definition at line 248 of file bitcoinkernel.h.
| typedef struct btck_ChainParameters btck_ChainParameters |
Opaque data structure for holding the chain parameters.
These are eventually placed into a kernel context through the kernel context options. The parameters describe the properties of a chain, and may be instantiated for either mainnet, testnet, signet, or regtest.
Definition at line 163 of file bitcoinkernel.h.
| typedef struct btck_ChainstateManager btck_ChainstateManager |
Opaque data structure for holding a chainstate manager.
The chainstate manager is the central object for doing validation tasks as well as retrieving data from the chain. Internally it is a complex data structure with diverse functionality.
Its functionality will be more and more exposed in the future.
Definition at line 224 of file bitcoinkernel.h.
| typedef struct btck_ChainstateManagerOptions btck_ChainstateManagerOptions |
Opaque data structure for holding options for creating a new chainstate manager.
The chainstate manager options are used to set some parameters for the chainstate manager.
Definition at line 213 of file bitcoinkernel.h.
| typedef uint8_t btck_ChainType |
Definition at line 590 of file bitcoinkernel.h.
Opaque data structure for holding a coin.
Holds information on the btck_TransactionOutput held within, including the height it was spent at and whether it is a coinbase output.
Definition at line 286 of file bitcoinkernel.h.
| typedef struct btck_ConsensusParams btck_ConsensusParams |
Opaque data structure for holding the Consensus Params.
Definition at line 242 of file bitcoinkernel.h.
| typedef struct btck_Context btck_Context |
Opaque data structure for holding a kernel context.
The kernel context is used to initialize internal state and hold the chain parameters and callbacks for handling error and validation events. Once other validation objects are instantiated from it, the context is kept in memory for the duration of their lifetimes.
The processing of validation events is done through an internal task runner owned by the context. It passes events through the registered validation interface callbacks.
A constructed context can be safely used from multiple threads.
Definition at line 191 of file bitcoinkernel.h.
| typedef struct btck_ContextOptions btck_ContextOptions |
Opaque data structure for holding options for creating a new kernel context.
Once a kernel context has been created from these options, they may be destroyed. The options hold the notification and validation interface callbacks as well as the selected chain type until they are passed to the context. If no options are configured, the context will be instantiated with no callbacks and for mainnet. Their content and scope can be expanded over time.
Definition at line 175 of file bitcoinkernel.h.
| typedef void(* btck_DestroyCallback) (void *user_data) |
Function signature for freeing user data.
Definition at line 443 of file bitcoinkernel.h.
| typedef void(* btck_LogCallback) (void *user_data, const btck_LogEntry *entry) |
Callback function types.
Function signature for a logging callback. Receives kernel log entries at or above the minimum level (see btck_logging_set_min_level) while its btck_LoggingConnection exists.
The callback may be invoked from any thread. Invocations are serialized: no two invocations run at the same time, and destroying a btck_LoggingConnection waits for an in-flight invocation of its callback to return. The callback must not call any kernel API function (this may deadlock), and should return quickly since it blocks every kernel thread that logs.
| [in] | user_data | User-defined opaque structure. |
| [in] | entry | Log entry. Valid only for the duration of the callback. |
Definition at line 438 of file bitcoinkernel.h.
| typedef uint8_t btck_LogCategory |
A collection of logging categories that may be encountered by kernel code.
Definition at line 359 of file bitcoinkernel.h.
| typedef struct btck_LoggingConnection btck_LoggingConnection |
Opaque data structure for holding a logging connection.
Log entries are delivered to the connection's callback for as long as the connection exists. Entries logged before a connection is created are not delivered. Functions changing the logging settings are global and change the settings for all existing btck_LoggingConnection instances.
Definition at line 154 of file bitcoinkernel.h.
| typedef uint8_t btck_LogLevel |
The severity of a log statement.
Definition at line 377 of file bitcoinkernel.h.
| typedef void(* btck_NotifyBlockTip) (void *user_data, btck_SynchronizationState state, const btck_BlockTreeEntry *entry, double verification_progress) |
Function signatures for the kernel notifications.
Definition at line 448 of file bitcoinkernel.h.
| typedef void(* btck_NotifyFatalError) (void *user_data, const char *message, size_t message_len) |
Definition at line 454 of file bitcoinkernel.h.
| typedef void(* btck_NotifyFlushError) (void *user_data, const char *message, size_t message_len) |
Definition at line 453 of file bitcoinkernel.h.
| typedef void(* btck_NotifyHeaderTip) (void *user_data, btck_SynchronizationState state, int64_t height, int64_t timestamp, int presync) |
Definition at line 449 of file bitcoinkernel.h.
| typedef void(* btck_NotifyProgress) (void *user_data, const char *title, size_t title_len, int progress_percent, int resume_possible) |
Definition at line 450 of file bitcoinkernel.h.
| typedef void(* btck_NotifyWarningSet) (void *user_data, btck_Warning warning, const char *message, size_t message_len) |
Definition at line 451 of file bitcoinkernel.h.
| typedef void(* btck_NotifyWarningUnset) (void *user_data, btck_Warning warning) |
Definition at line 452 of file bitcoinkernel.h.
| typedef struct btck_PrecomputedTransactionData btck_PrecomputedTransactionData |
Opaque data structure for holding precomputed transaction data.
Reusable when verifying multiple inputs of the same transaction. This avoids recomputing transaction hashes for each input.
Required when verifying a taproot input.
Definition at line 324 of file bitcoinkernel.h.
| typedef struct btck_ScriptPubkey btck_ScriptPubkey |
Opaque data structure for holding a script pubkey.
Definition at line 139 of file bitcoinkernel.h.
| typedef uint32_t btck_ScriptVerificationFlags |
Script verification flags that may be composed with each other.
Definition at line 573 of file bitcoinkernel.h.
| typedef uint8_t btck_ScriptVerifyStatus |
A collection of status codes that may be issued by the script verify function.
Definition at line 565 of file bitcoinkernel.h.
| typedef uint8_t btck_SynchronizationState |
Current sync state passed to tip changed callbacks.
Definition at line 346 of file bitcoinkernel.h.
| typedef struct btck_Transaction btck_Transaction |
Opaque data structure for holding a transaction.
Definition at line 134 of file bitcoinkernel.h.
| typedef struct btck_TransactionInput btck_TransactionInput |
Opaque data structure for holding a transaction input.
Holds information on the btck_TransactionOutPoint, btck_WitnessStack and script_sig held within.
Definition at line 300 of file bitcoinkernel.h.
| typedef struct btck_TransactionOutPoint btck_TransactionOutPoint |
Opaque data structure for holding a transaction out point.
Holds the txid and output index it is pointing to.
Definition at line 314 of file bitcoinkernel.h.
| typedef struct btck_TransactionOutput btck_TransactionOutput |
Opaque data structure for holding a transaction output.
Definition at line 144 of file bitcoinkernel.h.
| typedef struct btck_TransactionSpentOutputs btck_TransactionSpentOutputs |
Opaque data structure for holding a transaction's spent outputs.
Holds the coins consumed by a certain transaction. Retrieved through the btck_BlockSpentOutputs. The coins are in the same order as the transaction's inputs consuming them.
Definition at line 278 of file bitcoinkernel.h.
Opaque data structure for holding a btck_Txid.
This is a type-safe identifier for a transaction.
Definition at line 331 of file bitcoinkernel.h.
| typedef uint32_t btck_TxValidationResult |
Indicates the reason why a transaction failed validation.
The subset of values reachable depends on which validation function was used.
Definition at line 502 of file bitcoinkernel.h.
| typedef struct btck_TxValidationState btck_TxValidationState |
Opaque data structure for holding the state of a transaction during validation.
Contains information indicating whether validation was successful, and if not which step during transaction validation failed.
Definition at line 256 of file bitcoinkernel.h.
| typedef void(* btck_ValidationInterfaceBlockChecked) (void *user_data, btck_Block *block, const btck_BlockValidationState *state) |
Function signatures for the validation interface.
Definition at line 459 of file bitcoinkernel.h.
| typedef void(* btck_ValidationInterfaceBlockConnected) (void *user_data, btck_Block *block, const btck_BlockTreeEntry *entry) |
Definition at line 461 of file bitcoinkernel.h.
| typedef void(* btck_ValidationInterfaceBlockDisconnected) (void *user_data, btck_Block *block, const btck_BlockTreeEntry *entry) |
Definition at line 462 of file bitcoinkernel.h.
| typedef void(* btck_ValidationInterfacePoWValidBlock) (void *user_data, btck_Block *block, const btck_BlockTreeEntry *entry) |
Definition at line 460 of file bitcoinkernel.h.
| typedef uint8_t btck_ValidationMode |
Whether a validated data structure is valid, invalid, or an error was encountered during processing.
Definition at line 479 of file bitcoinkernel.h.
| typedef uint8_t btck_Warning |
Possible warning types issued by validation.
Definition at line 352 of file bitcoinkernel.h.
| typedef struct btck_WitnessStack btck_WitnessStack |
Opaque data structure for holding a witness stack.
Holds a sequence of witness stack items.
Definition at line 307 of file bitcoinkernel.h.
| typedef int(* btck_WriteBytes) (const void *bytes, size_t size, void *userdata) |
Function signature for serializing data.
| [in] | bytes | The data to write. Can be null if size is 0. |
| [in] | size | The number of bytes in the data. |
| [in] | userdata | Holds the user-defined opaque structure that was given with the writer. |
Definition at line 473 of file bitcoinkernel.h.
| typedef struct btck_Wtxid btck_Wtxid |
Opaque data structure for holding a btck_Wtxid.
This is a type-safe identifier for a transaction that commits to witness data.
Definition at line 338 of file bitcoinkernel.h.
| BITCOINKERNEL_API int btck_block_check | ( | const btck_Block * | block, |
| const btck_ConsensusParams * | consensus_params, | ||
| btck_BlockCheckFlags | flags, | ||
| btck_BlockValidationState * | validation_state | ||
| ) |
Perform context-free validation checks on a btck_Block.
Runs the base context-free block checks (size limits, coinbase structure, transaction checks, and sigop limits) using the supplied btck_ConsensusParams. The proof-of-work and merkle-root checks are optional and can be toggled via flags. Note that this does not include any transaction script, timestamps, order, or other checks that may require more context.
| [in] | block | Non-null, btck_Block to validate. |
| [in] | consensus_params | Non-null, btck_ConsensusParams for validation. |
| [in] | flags | Bitmask of btck_BlockCheckFlags controlling the optional POW and merkle-root checks. Use btck_BlockCheckFlags_BASE to run only the base checks. |
| [out] | validation_state | Non-null, previously created with btck_block_validation_state_create. Overwritten in-place with the validation result. |
| BITCOINKERNEL_API btck_Block *BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_copy | ( | const btck_Block * | block | ) |
Copy a block.
Blocks are reference counted, so this just increments the reference count.
| [in] | block | Non-null. |
Definition at line 1376 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int BITCOINKERNEL_API size_t btck_block_count_transactions | ( | const btck_Block * | block | ) |
Count the number of transactions contained in a block.
| [in] | block | Non-null. |
Definition at line 1394 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_Block *BITCOINKERNEL_WARN_UNUSED_RESULT BITCOINKERNEL_API btck_Block *BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_create | ( | const void * | raw_block, |
| size_t | raw_block_len | ||
| ) |
Parse a serialized raw block into a new block object.
| [in] | raw_block | Serialized block. |
| [in] | raw_block_len | Length of the serialized block. |
Definition at line 1359 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT BITCOINKERNEL_API void btck_block_destroy | ( | btck_Block * | block | ) |
Destroy the block.
Definition at line 1427 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_BlockHash *BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_get_hash | ( | const btck_Block * | block | ) |
Calculate and return the hash of a block.
| [in] | block | Non-null. |
Definition at line 1422 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_BlockHeader *BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_get_header | ( | const btck_Block * | block | ) |
Get the btck_BlockHeader from the block.
Creates a new btck_BlockHeader object from the block's header data.
| [in] | block | Non-null btck_Block |
Definition at line 1405 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API const btck_Transaction * btck_block_get_transaction_at | ( | const btck_Block * | block, |
| size_t | transaction_index | ||
| ) |
Get the transaction at the provided index.
The returned transaction is not owned and depends on the lifetime of the block.
| [in] | block | Non-null. |
| [in] | transaction_index | The index of the transaction to be retrieved. |
Definition at line 1399 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int BITCOINKERNEL_API btck_BlockHash *BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_hash_copy | ( | const btck_BlockHash * | block_hash | ) |
Copy a block hash.
| [in] | block_hash | Non-null. |
Definition at line 1467 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_BlockHash *BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_hash_create | ( | const unsigned char | block_hash[32] | ) |
Create a block hash from its raw data.
Definition at line 1462 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API void BITCOINKERNEL_API void btck_block_hash_destroy | ( | btck_BlockHash * | block_hash | ) |
Destroy the block hash.
Definition at line 1482 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int btck_block_hash_equals | ( | const btck_BlockHash * | hash1, |
| const btck_BlockHash * | hash2 | ||
| ) |
Check if two block hashes are equal.
| [in] | hash1 | Non-null. |
| [in] | hash2 | Non-null. |
| BITCOINKERNEL_API void btck_block_hash_to_bytes | ( | const btck_BlockHash * | block_hash, |
| unsigned char | output[32] | ||
| ) |
Serializes the block hash to bytes.
| [in] | block_hash | Non-null. |
| [in] | output | The serialized block hash. |
| BITCOINKERNEL_API btck_BlockHeader *BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_header_copy | ( | const btck_BlockHeader * | header | ) |
Copy a btck_BlockHeader.
| [in] | header | Non-null btck_BlockHeader. |
Definition at line 1639 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_BlockHeader *BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_header_create | ( | const void * | raw_block_header, |
| size_t | raw_block_header_len | ||
| ) |
Create a btck_BlockHeader from serialized data.
| [in] | raw_block_header | Non-null, serialized header data (80 bytes) |
| [in] | raw_block_header_len | Length of serialized header (must be 80) |
Definition at line 1623 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT BITCOINKERNEL_API void btck_block_header_destroy | ( | btck_BlockHeader * | header | ) |
Destroy the btck_BlockHeader.
Definition at line 1689 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API uint32_t btck_block_header_get_bits | ( | const btck_BlockHeader * | header | ) |
Get the nBits difficulty target from btck_BlockHeader.
| [in] | header | Non-null btck_BlockHeader |
Definition at line 1664 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_BlockHash *BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_header_get_hash | ( | const btck_BlockHeader * | header | ) |
Get the btck_BlockHash.
| [in] | header | Non-null header |
Definition at line 1644 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API void btck_block_header_get_merkle_root | ( | const btck_BlockHeader * | header, |
| unsigned char | output[32] | ||
| ) |
Get the Merkle root from btck_BlockHeader.
| [in] | header | Non-null btck_BlockHeader. |
| [out] | output | The 32-byte Merkle root. |
| BITCOINKERNEL_API uint32_t btck_block_header_get_nonce | ( | const btck_BlockHeader * | header | ) |
Get the nonce from btck_BlockHeader.
| [in] | header | Non-null btck_BlockHeader |
Definition at line 1674 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API const btck_BlockHash * btck_block_header_get_prev_hash | ( | const btck_BlockHeader * | header | ) |
Get the previous btck_BlockHash from btck_BlockHeader.
The returned hash is unowned and only valid for the lifetime of the btck_BlockHeader.
| [in] | header | Non-null btck_BlockHeader |
Definition at line 1649 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API void BITCOINKERNEL_API uint32_t btck_block_header_get_timestamp | ( | const btck_BlockHeader * | header | ) |
Get the timestamp from btck_BlockHeader.
| [in] | header | Non-null btck_BlockHeader |
Definition at line 1659 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int32_t btck_block_header_get_version | ( | const btck_BlockHeader * | header | ) |
Get the version from btck_BlockHeader.
| [in] | header | Non-null btck_BlockHeader |
Definition at line 1669 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_header_to_bytes | ( | const btck_BlockHeader * | header, |
| unsigned char | output[80] | ||
| ) |
Serializes the btck_BlockHeader to bytes.
This is consensus serialization that is also used for the P2P network.
| [in] | header | Non-null. |
| [out] | output | The serialized block header (80 bytes). |
| BITCOINKERNEL_API btck_Block *BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_read | ( | const btck_ChainstateManager * | chainstate_manager, |
| const btck_BlockTreeEntry * | block_tree_entry | ||
| ) |
Reads the block the passed in block tree entry points to from disk and returns it.
| [in] | chainstate_manager | Non-null. |
| [in] | block_tree_entry | Non-null. |
| BITCOINKERNEL_API btck_BlockSpentOutputs *BITCOINKERNEL_WARN_UNUSED_RESULT BITCOINKERNEL_API btck_BlockSpentOutputs *BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_spent_outputs_copy | ( | const btck_BlockSpentOutputs * | block_spent_outputs | ) |
Copy a block's spent outputs.
| [in] | block_spent_outputs | Non-null. |
Definition at line 1501 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API size_t btck_block_spent_outputs_count | ( | const btck_BlockSpentOutputs * | block_spent_outputs | ) |
Returns the number of transaction spent outputs whose data is contained in block spent outputs.
| [in] | block_spent_outputs | Non-null. |
Definition at line 1506 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API void btck_block_spent_outputs_destroy | ( | btck_BlockSpentOutputs * | block_spent_outputs | ) |
Destroy the block spent outputs.
Definition at line 1518 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API const btck_TransactionSpentOutputs * btck_block_spent_outputs_get_transaction_spent_outputs_at | ( | const btck_BlockSpentOutputs * | block_spent_outputs, |
| size_t | transaction_spent_outputs_index | ||
| ) |
Returns a transaction spent outputs contained in the block spent outputs at a certain index.
The returned pointer is unowned and only valid for the lifetime of block_spent_outputs.
| [in] | block_spent_outputs | Non-null. |
| [in] | transaction_spent_outputs_index | The index of the transaction spent outputs within the block spent outputs. |
Definition at line 1511 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_BlockSpentOutputs *BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_spent_outputs_read | ( | const btck_ChainstateManager * | chainstate_manager, |
| const btck_BlockTreeEntry * | block_tree_entry | ||
| ) |
Reads the block spent coins data the passed in block tree entry points to from disk and returns it.
| [in] | chainstate_manager | Non-null. |
| [in] | block_tree_entry | Non-null. |
| BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_to_bytes | ( | const btck_Block * | block, |
| btck_WriteBytes | writer, | ||
| void * | user_data | ||
| ) |
Serializes the block through the passed in callback to bytes.
This is consensus serialization that is also used for the P2P network.
| [in] | block | Non-null. |
| [in] | writer | Non-null, callback to a write bytes function. |
| [in] | user_data | Holds a user-defined opaque structure that will be passed back through the writer callback. |
| BITCOINKERNEL_API int btck_block_tree_entry_equals | ( | const btck_BlockTreeEntry * | entry1, |
| const btck_BlockTreeEntry * | entry2 | ||
| ) |
Check if two block tree entries are equal.
Two block tree entries are equal when they point to the same block.
| [in] | entry1 | Non-null. |
| [in] | entry2 | Non-null. |
| BITCOINKERNEL_API int BITCOINKERNEL_API const btck_BlockTreeEntry * btck_block_tree_entry_get_ancestor | ( | const btck_BlockTreeEntry * | block_tree_entry, |
| int32_t | height | ||
| ) |
Return the ancestor of a btck_BlockTreeEntry at the given height.
| [in] | block_tree_entry | Non-null. |
| [in] | height | The height of the requested ancestor. |
Definition at line 1136 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API const btck_BlockHash * btck_block_tree_entry_get_block_hash | ( | const btck_BlockTreeEntry * | block_tree_entry | ) |
Return the block hash associated with a block tree entry.
| [in] | block_tree_entry | Non-null. |
Definition at line 1452 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_BlockHeader *BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_tree_entry_get_block_header | ( | const btck_BlockTreeEntry * | block_tree_entry | ) |
Return the btck_BlockHeader associated with this entry.
| [in] | block_tree_entry | Non-null. |
Definition at line 1442 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int32_t btck_block_tree_entry_get_height | ( | const btck_BlockTreeEntry * | block_tree_entry | ) |
Return the height of a certain block tree entry.
| [in] | block_tree_entry | Non-null. |
Definition at line 1447 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API const btck_BlockTreeEntry * btck_block_tree_entry_get_previous | ( | const btck_BlockTreeEntry * | block_tree_entry | ) |
Returns the previous block tree entry in the tree, or null if the current block tree entry is the genesis block.
| [in] | block_tree_entry | Non-null. |
Definition at line 1126 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_BlockValidationState *BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_validation_state_copy | ( | const btck_BlockValidationState * | block_validation_state | ) |
Copies the btck_BlockValidationState.
| [in] | block_validation_state | Non-null. |
Definition at line 1148 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_BlockValidationState *BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_validation_state_create | ( | ) |
Create a new btck_BlockValidationState.
Definition at line 1143 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API void btck_block_validation_state_destroy | ( | btck_BlockValidationState * | block_validation_state | ) |
Destroy the btck_BlockValidationState.
Definition at line 1153 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_BlockValidationResult btck_block_validation_state_get_block_validation_result | ( | const btck_BlockValidationState * | block_validation_state | ) |
Returns the validation result from an opaque btck_BlockValidationState pointer.
Definition at line 1166 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_ValidationMode btck_block_validation_state_get_validation_mode | ( | const btck_BlockValidationState * | block_validation_state | ) |
Returns the validation mode from an opaque btck_BlockValidationState pointer.
Definition at line 1158 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int btck_chain_contains | ( | const btck_Chain * | chain, |
| const btck_BlockTreeEntry * | block_tree_entry | ||
| ) |
Return true if the passed in chain contains the block tree entry.
| [in] | chain | Non-null. |
| [in] | block_tree_entry | Non-null. |
| BITCOINKERNEL_API const btck_BlockTreeEntry * btck_chain_get_by_height | ( | const btck_Chain * | chain, |
| int32_t | block_height | ||
| ) |
Retrieve a block tree entry by its height in the currently active chain.
Once retrieved there is no guarantee that it remains in the active chain.
| [in] | chain | Non-null. |
| [in] | block_height | Height in the chain of the to be retrieved block tree entry. |
Definition at line 1611 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int32_t btck_chain_get_height | ( | const btck_Chain * | chain | ) |
Return the height of the tip of the chain.
| [in] | chain | Non-null. |
Definition at line 1605 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_ChainParameters *BITCOINKERNEL_WARN_UNUSED_RESULT btck_chain_parameters_copy | ( | const btck_ChainParameters * | chain_parameters | ) |
Copy the chain parameters.
Definition at line 1054 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_ChainParameters *BITCOINKERNEL_WARN_UNUSED_RESULT btck_chain_parameters_create | ( | btck_ChainType | chain_type | ) |
Creates a chain parameters struct with default parameters based on the passed in chain type.
| [in] | chain_type | Controls the chain parameters type created. |
Definition at line 1022 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_ChainParameters *BITCOINKERNEL_WARN_UNUSED_RESULT btck_chain_parameters_create_signet | ( | const void * | challenge, |
| size_t | challenge_len | ||
| ) |
Create a signet chain parameters struct with a user-provided challenge.
| [in] | challenge | The signet challenge value. Blocks must satisfy it in order to be valid. |
| [in] | challenge_len | The length of the signet challenge. |
Definition at line 1044 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API void btck_chain_parameters_destroy | ( | btck_ChainParameters * | chain_parameters | ) |
Destroy the chain parameters.
Definition at line 1064 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API const btck_ConsensusParams * btck_chain_parameters_get_consensus_params | ( | const btck_ChainParameters * | chain_parameters | ) |
Get btck_ConsensusParams from btck_ChainParameters.
The returned btck_ConsensusParams pointer is valid only for the lifetime of the btck_ChainParameters object and must not be destroyed by the caller.
| [in] | chain_parameters | Non-null. |
Definition at line 1059 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_ChainstateManager *BITCOINKERNEL_WARN_UNUSED_RESULT btck_chainstate_manager_create | ( | const btck_ChainstateManagerOptions * | chainstate_manager_options | ) |
Create a chainstate manager.
This is the main object for many validation tasks as well as for retrieving data from the chain and interacting with its chainstate and indexes.
| [in] | chainstate_manager_options | Non-null, created by btck_chainstate_manager_options_create. |
Definition at line 1268 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API const btck_BlockTreeEntry BITCOINKERNEL_API void btck_chainstate_manager_destroy | ( | btck_ChainstateManager * | chainstate_manager | ) |
Destroy the chainstate manager.
Definition at line 1324 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT BITCOINKERNEL_API const btck_Chain * btck_chainstate_manager_get_active_chain | ( | const btck_ChainstateManager * | chainstate_manager | ) |
Returns the best known currently active chain.
Its lifetime is dependent on the chainstate manager. It can be thought of as a view on a vector of block tree entries that form the best chain. The returned chain reference always points to the currently active best chain. However, state transitions within the chainstate manager (e.g., processing blocks) will update the chain's contents. Data retrieved from this chain is only consistent up to the point when new data is processed in the chainstate manager. It is the user's responsibility to guard against these inconsistencies.
| [in] | chainstate_manager | Non-null. |
Definition at line 1600 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API const btck_BlockTreeEntry * btck_chainstate_manager_get_best_entry | ( | const btck_ChainstateManager * | chainstate_manager | ) |
Get the btck_BlockTreeEntry whose associated btck_BlockHeader has the most known cumulative proof of work.
| [in] | chainstate_manager | Non-null. |
Definition at line 1318 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API const btck_BlockTreeEntry * btck_chainstate_manager_get_block_tree_entry_by_hash | ( | const btck_ChainstateManager * | chainstate_manager, |
| const btck_BlockHash * | block_hash | ||
| ) |
Retrieve a block tree entry by its block hash.
| [in] | chainstate_manager | Non-null. |
| [in] | block_hash | Non-null. |
| BITCOINKERNEL_API btck_BlockValidationState *BITCOINKERNEL_WARN_UNUSED_RESULT BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT btck_chainstate_manager_import_blocks | ( | btck_ChainstateManager * | chainstate_manager, |
| const char ** | block_file_paths_data, | ||
| size_t * | block_file_paths_lens, | ||
| size_t | block_file_paths_data_len | ||
| ) |
Triggers the start of a reindex if the wipe options were previously set for the chainstate manager.
Can also import an array of existing block files selected by the user.
| [in] | chainstate_manager | Non-null. |
| [in] | block_file_paths_data | Nullable, array of block files described by their full filesystem paths. |
| [in] | block_file_paths_lens | Nullable, array containing the lengths of each of the paths. |
| [in] | block_file_paths_data_len | Length of the block_file_paths_data and block_file_paths_len arrays. |
Definition at line 1339 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_ChainstateManagerOptions *BITCOINKERNEL_WARN_UNUSED_RESULT btck_chainstate_manager_options_create | ( | const btck_Context * | context, |
| const char * | data_directory, | ||
| size_t | data_directory_len, | ||
| const char * | blocks_directory, | ||
| size_t | blocks_directory_len | ||
| ) |
Create options for the chainstate manager.
| [in] | context | Non-null, the created options and through it the chainstate manager will associate with this kernel context for the duration of their lifetimes. |
| [in] | data_directory | Path string of the directory containing the chainstate data. If the directory does not exist yet, it will be created. |
| [in] | blocks_directory | Path string of the directory containing the block data. If the directory does not exist yet, it will be created. |
Definition at line 1192 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API void btck_chainstate_manager_options_destroy | ( | btck_ChainstateManagerOptions * | chainstate_manager_options | ) |
Destroy the chainstate manager options.
Definition at line 1232 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT btck_chainstate_manager_options_set_database_cache_bytes | ( | btck_ChainstateManagerOptions * | chainstate_manager_options, |
| uint64_t | database_cache_bytes | ||
| ) |
Set the total database cache used by the chainstate manager.
The total cache is split internally between the block tree database, chainstate database, and in-memory coins cache. If this function is not called, the total cache defaults to 450 MiB.
| [in] | chainstate_manager_options | Non-null, options to be set. |
| [in] | database_cache_bytes | The total database cache size in bytes. Values below 4 MiB are rejected. On 32-bit systems, values above 1 GiB are also rejected. |
Definition at line 1218 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT btck_chainstate_manager_options_set_wipe_dbs | ( | btck_ChainstateManagerOptions * | chainstate_manager_options, |
| int | wipe_block_tree_db, | ||
| int | wipe_chainstate_db | ||
| ) |
Sets wipe db in the options.
In combination with calling btck_chainstate_manager_import_blocks this triggers either a full reindex, or a reindex of just the chainstate database.
| [in] | chainstate_manager_options | Non-null, created by btck_chainstate_manager_options_create. |
| [in] | wipe_block_tree_db | Set wipe block tree db. Should only be 1 if wipe_chainstate_db is 1 too. |
| [in] | wipe_chainstate_db | Set wipe chainstate db. |
Definition at line 1237 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API void btck_chainstate_manager_options_set_worker_threads_num | ( | btck_ChainstateManagerOptions * | chainstate_manager_options, |
| int | worker_threads | ||
| ) |
Set the number of available worker threads used during validation.
| [in] | chainstate_manager_options | Non-null, options to be set. |
| [in] | worker_threads | The number of worker threads that should be spawned in the thread pool used for validation. When set to 0 no parallel verification is done. The value range is clamped internally between 0 and 15. |
Definition at line 1212 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API void btck_chainstate_manager_options_update_block_tree_db_in_memory | ( | btck_ChainstateManagerOptions * | chainstate_manager_options, |
| int | block_tree_db_in_memory | ||
| ) |
Sets block tree db in memory in the options.
| [in] | chainstate_manager_options | Non-null, created by btck_chainstate_manager_options_create. |
| [in] | block_tree_db_in_memory | Set block tree db in memory. |
Definition at line 1250 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API void btck_chainstate_manager_options_update_chainstate_db_in_memory | ( | btck_ChainstateManagerOptions * | chainstate_manager_options, |
| int | chainstate_db_in_memory | ||
| ) |
Sets chainstate db in memory in the options.
| [in] | chainstate_manager_options | Non-null, created by btck_chainstate_manager_options_create. |
| [in] | chainstate_db_in_memory | Set chainstate db in memory. |
Definition at line 1259 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT btck_chainstate_manager_process_block | ( | btck_ChainstateManager * | chainstate_manager, |
| const btck_Block * | block, | ||
| int * | new_block | ||
| ) |
Process and validate the passed in block with the chainstate manager.
Processing first does checks on the block, and if these passed, saves it to disk. It then validates the block against the utxo set. If it is valid, the chain is extended with it. The return value is not indicative of the block's validity. Detailed information on the validity of the block can be retrieved by registering the block_checked callback in the validation interface.
| [in] | chainstate_manager | Non-null. |
| [in] | block | Non-null, block to be validated. |
| [out] | new_block | Nullable, will be set to 1 if this block was not processed before. Note that this means it might also not be 1 if processing was attempted before, but the block was found invalid before its data was persisted. |
| BITCOINKERNEL_API btck_BlockValidationState *BITCOINKERNEL_WARN_UNUSED_RESULT btck_chainstate_manager_process_block_header | ( | btck_ChainstateManager * | chainstate_manager, |
| const btck_BlockHeader * | header | ||
| ) |
Processes and validates the provided btck_BlockHeader.
| [in] | chainstate_manager | Non-null. |
| [in] | header | Non-null btck_BlockHeader to be validated. |
| BITCOINKERNEL_API uint32_t btck_coin_confirmation_height | ( | const btck_Coin * | coin | ) |
Returns the block height where the transaction that created this coin was included in.
| [in] | coin | Non-null. |
Definition at line 1550 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_Coin *BITCOINKERNEL_WARN_UNUSED_RESULT btck_coin_copy | ( | const btck_Coin * | coin | ) |
Copy a coin.
| [in] | coin | Non-null. |
Definition at line 1545 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API void btck_coin_destroy | ( | btck_Coin * | coin | ) |
Destroy the coin.
Definition at line 1565 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API const btck_TransactionOutput * btck_coin_get_output | ( | const btck_Coin * | coin | ) |
Return the transaction output of a coin.
The returned pointer is unowned and only valid for the lifetime of the coin.
| [in] | coin | Non-null. |
Definition at line 1560 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int btck_coin_is_coinbase | ( | const btck_Coin * | coin | ) |
Returns whether the containing transaction was a coinbase.
| [in] | coin | Non-null. |
Definition at line 1555 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_Context *BITCOINKERNEL_WARN_UNUSED_RESULT btck_context_copy | ( | const btck_Context * | context | ) |
Copy the context.
Definition at line 1111 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_Context *BITCOINKERNEL_WARN_UNUSED_RESULT btck_context_create | ( | const btck_ContextOptions * | context_options | ) |
Create a new kernel context.
If the options have not been previously set, their corresponding fields will be initialized to default values; the context will assume mainnet chain parameters and won't attempt to call the kernel notification callbacks.
| [in] | context_options | Nullable, created by btck_context_options_create. |
Definition at line 1099 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API void btck_context_destroy | ( | btck_Context * | context | ) |
Destroy the context.
Definition at line 1121 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT btck_context_interrupt | ( | btck_Context * | context | ) |
Interrupt can be used to halt long-running validation functions like when reindexing, importing or processing blocks.
| [in] | context | Non-null. |
Definition at line 1116 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_ContextOptions *BITCOINKERNEL_WARN_UNUSED_RESULT btck_context_options_create | ( | ) |
Creates an empty context options.
Definition at line 1069 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API void btck_context_options_destroy | ( | btck_ContextOptions * | context_options | ) |
Destroy the context options.
Definition at line 1094 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API void btck_context_options_set_chainparams | ( | btck_ContextOptions * | context_options, |
| const btck_ChainParameters * | chain_parameters | ||
| ) |
Sets the chain params for the context options.
The context created with the options will be configured for these chain parameters.
| [in] | context_options | Non-null, previously created by btck_context_options_create. |
| [in] | chain_parameters | Is set to the context options. |
| BITCOINKERNEL_API void BITCOINKERNEL_API void btck_context_options_set_notifications | ( | btck_ContextOptions * | context_options, |
| btck_NotificationInterfaceCallbacks | notifications | ||
| ) |
Set the kernel notifications for the context options.
The context created with the options will be configured with these notifications.
| [in] | context_options | Non-null, previously created by btck_context_options_create. |
| [in] | notifications | Is set to the context options. |
Definition at line 1081 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API void btck_context_options_set_validation_interface | ( | btck_ContextOptions * | context_options, |
| btck_ValidationInterfaceCallbacks | validation_interface_callbacks | ||
| ) |
Set the validation interface callbacks for the context options.
The context created with the options will be configured for these validation interface callbacks. The callbacks will then be triggered from validation events issued by the chainstate manager created from the same context.
| [in] | context_options | Non-null, previously created with btck_context_options_create. |
| [in] | validation_interface_callbacks | The callbacks used for passing validation information to the user. |
Definition at line 1088 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_LoggingConnection *BITCOINKERNEL_WARN_UNUSED_RESULT btck_logging_connection_create | ( | btck_LogCallback | log_callback, |
| void * | user_data, | ||
| btck_DestroyCallback | user_data_destroy_callback | ||
| ) |
Start logging messages through the provided callback.
| [in] | log_callback | Non-null, function through which log entries will be delivered. |
| [in] | user_data | Nullable, holds a user-defined opaque structure. Is passed back to the user through the callback. If the user_data_destroy_callback is also defined it is assumed that ownership of the user_data is passed to the created logging connection. |
| [in] | user_data_destroy_callback | Nullable, function for freeing the user data. Not called if user_data is null. |
Definition at line 1001 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API void btck_logging_connection_destroy | ( | btck_LoggingConnection * | logging_connection | ) |
Stop logging and destroy the logging connection.
Definition at line 1015 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API void btck_logging_set_min_level | ( | btck_LogLevel | level | ) |
Set the minimum log level.
Messages below this level are not delivered to logging callbacks. Defaults to Info.
This changes a global setting and will affect all existing btck_LoggingConnection instances.
| [in] | level | Minimum log level. |
Definition at line 996 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_PrecomputedTransactionData *BITCOINKERNEL_WARN_UNUSED_RESULT btck_precomputed_transaction_data_copy | ( | const btck_PrecomputedTransactionData * | precomputed_txdata | ) |
Copy precomputed transaction data.
| [in] | precomputed_txdata | Non-null. |
Definition at line 804 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_PrecomputedTransactionData *BITCOINKERNEL_WARN_UNUSED_RESULT btck_precomputed_transaction_data_create | ( | const btck_Transaction * | tx_to, |
| const btck_TransactionOutput ** | spent_outputs, | ||
| size_t | spent_outputs_len | ||
| ) |
Create precomputed transaction data for script verification.
| [in] | tx_to | Non-null. |
| [in] | spent_outputs | Nullable for non-taproot verification. Points to an array of outputs spent by the transaction. |
| [in] | spent_outputs_len | Length of the spent_outputs array. |
Definition at line 778 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API void btck_precomputed_transaction_data_destroy | ( | btck_PrecomputedTransactionData * | precomputed_txdata | ) |
Destroy the precomputed transaction data.
Definition at line 809 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_ScriptPubkey *BITCOINKERNEL_WARN_UNUSED_RESULT btck_script_pubkey_copy | ( | const btck_ScriptPubkey * | script_pubkey | ) |
Copy a script pubkey.
| [in] | script_pubkey | Non-null. |
Definition at line 743 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_ScriptPubkey *BITCOINKERNEL_WARN_UNUSED_RESULT btck_script_pubkey_create | ( | const void * | script_pubkey, |
| size_t | script_pubkey_len | ||
| ) |
Create a script pubkey from serialized data.
| [in] | script_pubkey | Serialized script pubkey. |
| [in] | script_pubkey_len | Length of the script pubkey data. |
Definition at line 730 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT BITCOINKERNEL_API void btck_script_pubkey_destroy | ( | btck_ScriptPubkey * | script_pubkey | ) |
Destroy the script pubkey.
Definition at line 748 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT btck_script_pubkey_to_bytes | ( | const btck_ScriptPubkey * | script_pubkey, |
| btck_WriteBytes | writer, | ||
| void * | user_data | ||
| ) |
Serializes the script pubkey through the passed in callback to bytes.
| [in] | script_pubkey | Non-null. |
| [in] | writer | Non-null, callback to a write bytes function. |
| [in] | user_data | Holds a user-defined opaque structure that will be passed back through the writer callback. |
| BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT btck_script_pubkey_verify | ( | const btck_ScriptPubkey * | script_pubkey, |
| int64_t | amount, | ||
| const btck_Transaction * | tx_to, | ||
| const btck_PrecomputedTransactionData * | precomputed_txdata, | ||
| unsigned int | input_index, | ||
| btck_ScriptVerificationFlags | flags, | ||
| btck_ScriptVerifyStatus * | status | ||
| ) |
Verify if the input at input_index of tx_to spends the script pubkey under the constraints specified by flags.
If the btck_ScriptVerificationFlags_WITNESS flag is set in the flags bitfield, the amount parameter is used. If the taproot flag is set, the precomputed data must contain the spent outputs.
| [in] | script_pubkey | Non-null, script pubkey to be spent. |
| [in] | amount | Amount of the script pubkey's associated output. May be zero if the witness flag is not set. |
| [in] | tx_to | Non-null, transaction spending the script_pubkey. |
| [in] | precomputed_txdata | Nullable if the taproot flag is not set. Otherwise, precomputed data for tx_to with the spent outputs must be provided. |
| [in] | input_index | Index of the input in tx_to spending the script_pubkey. |
| [in] | flags | Bitfield of btck_ScriptVerificationFlags controlling validation constraints. |
| [out] | status | Nullable, will be set to an error code if the operation fails, or OK otherwise. |
| BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT btck_set_mock_time | ( | int64_t | timestamp | ) |
Override the current time with a fixed timestamp for testing.
Affects all kernel time reads globally. The caller is responsible for gating usage (e.g. restricting to regtest) if desired.
The upper bound (4294967295) matches the maximum value of a block header timestamp.
| [in] | timestamp | Unix epoch seconds, or 0 to restore the system clock. |
Definition at line 1740 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int btck_transaction_check | ( | const btck_Transaction * | tx, |
| btck_TxValidationState * | validation_state | ||
| ) |
Run context-free consensus validation on a btck_Transaction.
Performs basic structural consensus checks (consensus/tx_checkCheckTransaction) without requiring blockchain state.
| [in] | tx | Non-null, the transaction to validate. |
| [out] | validation_state | Non-null, previously created with btck_tx_validation_state_create. Overwritten in-place with the validation result. |
| BITCOINKERNEL_API btck_Transaction *BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_copy | ( | const btck_Transaction * | transaction | ) |
Copy a transaction.
Transactions are reference counted, so this just increments the reference count.
| [in] | transaction | Non-null. |
Definition at line 709 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API size_t btck_transaction_count_inputs | ( | const btck_Transaction * | transaction | ) |
Get the number of inputs of a transaction.
| [in] | transaction | Non-null. |
Definition at line 673 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT BITCOINKERNEL_API size_t btck_transaction_count_outputs | ( | const btck_Transaction * | transaction | ) |
Get the number of outputs of a transaction.
| [in] | transaction | Non-null. |
Definition at line 661 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_Transaction *BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_create | ( | const void * | raw_transaction, |
| size_t | raw_transaction_len | ||
| ) |
Create a new transaction from the serialized data.
| [in] | raw_transaction | Serialized transaction. |
| [in] | raw_transaction_len | Length of the serialized transaction. |
Definition at line 650 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int BITCOINKERNEL_API void btck_transaction_destroy | ( | btck_Transaction * | transaction | ) |
Destroy the transaction.
Definition at line 725 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API const btck_TransactionInput * btck_transaction_get_input_at | ( | const btck_Transaction * | transaction, |
| size_t | input_index | ||
| ) |
Get the transaction input at the provided index.
The returned transaction input is not owned and depends on the lifetime of the transaction.
| [in] | transaction | Non-null. |
| [in] | input_index | The index of the transaction input to be retrieved. |
Definition at line 678 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API uint32_t btck_transaction_get_locktime | ( | const btck_Transaction * | transaction | ) |
Get a transaction's nLockTime value.
| [in] | transaction | Non-null. |
Definition at line 689 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API const btck_TransactionOutput * btck_transaction_get_output_at | ( | const btck_Transaction * | transaction, |
| size_t | output_index | ||
| ) |
Get the transaction outputs at the provided index.
The returned transaction output is not owned and depends on the lifetime of the transaction.
| [in] | transaction | Non-null. |
| [in] | output_index | The index of the transaction output to be retrieved. |
Definition at line 666 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API const btck_Txid * btck_transaction_get_txid | ( | const btck_Transaction * | transaction | ) |
Get the txid of a transaction.
The returned txid is not owned and depends on the lifetime of the transaction.
| [in] | transaction | Non-null. |
Definition at line 694 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API uint32_t btck_transaction_get_version | ( | const btck_Transaction * | transaction | ) |
Get a transaction's version.
| [in] | transaction | Non-null. |
Definition at line 684 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API const btck_Wtxid * btck_transaction_get_wtxid | ( | const btck_Transaction * | transaction | ) |
Get the wtxid of a transaction.
The returned wtxid is not owned and depends on the lifetime of the transaction.
| [in] | transaction | Non-null. |
Definition at line 704 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int btck_transaction_has_witness | ( | const btck_Transaction * | transaction | ) |
Check whether a transaction has witness data.
| [in] | transaction | Non-null. |
Definition at line 699 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_TransactionInput *BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_input_copy | ( | const btck_TransactionInput * | transaction_input | ) |
Copy a transaction input.
| [in] | transaction_input | Non-null. |
Definition at line 851 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT BITCOINKERNEL_API void btck_transaction_input_destroy | ( | btck_TransactionInput * | transaction_input | ) |
Destroy the transaction input.
Definition at line 877 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API const btck_TransactionOutPoint * btck_transaction_input_get_out_point | ( | const btck_TransactionInput * | transaction_input | ) |
Get the transaction out point.
The returned transaction out point is not owned and depends on the lifetime of the transaction.
| [in] | transaction_input | Non-null. |
Definition at line 856 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_input_get_script_sig | ( | const btck_TransactionInput * | transaction_input, |
| btck_WriteBytes | writer, | ||
| void * | user_data | ||
| ) |
Serialize the script sig of a transaction input through the passed in callback.
| [in] | transaction_input | Non-null. |
| [in] | writer | Non-null, function pointer for writing bytes. |
| [in] | user_data | Nullable, passed back through the writer callback. |
| BITCOINKERNEL_API uint32_t btck_transaction_input_get_sequence | ( | const btck_TransactionInput * | transaction_input | ) |
Get a transaction input's nSequence value.
| [in] | transaction_input | Non-null. |
Definition at line 861 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API const btck_WitnessStack * btck_transaction_input_get_witness_stack | ( | const btck_TransactionInput * | transaction_input | ) |
Get the witness stack of a transaction input.
The returned witness stack is not owned and depends on the lifetime of the transaction input.
| [in] | transaction_input | Non-null. |
Definition at line 866 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_TransactionOutPoint *BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_out_point_copy | ( | const btck_TransactionOutPoint * | transaction_out_point | ) |
Copy a transaction out point.
| [in] | transaction_out_point | Non-null. |
Definition at line 904 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API void btck_transaction_out_point_destroy | ( | btck_TransactionOutPoint * | transaction_out_point | ) |
Destroy the transaction out point.
Definition at line 919 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API uint32_t btck_transaction_out_point_get_index | ( | const btck_TransactionOutPoint * | transaction_out_point | ) |
Get the output position from the transaction out point.
| [in] | transaction_out_point | Non-null. |
Definition at line 909 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API const btck_Txid * btck_transaction_out_point_get_txid | ( | const btck_TransactionOutPoint * | transaction_out_point | ) |
Get the txid from the transaction out point.
The returned txid is not owned and depends on the lifetime of the transaction out point.
| [in] | transaction_out_point | Non-null. |
Definition at line 914 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_TransactionOutput *BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_output_copy | ( | const btck_TransactionOutput * | transaction_output | ) |
Copy a transaction output.
| [in] | transaction_output | Non-null. |
Definition at line 758 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_TransactionOutput *BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_output_create | ( | const btck_ScriptPubkey * | script_pubkey, |
| int64_t | amount | ||
| ) |
Create a transaction output from a script pubkey and an amount.
| [in] | script_pubkey | Non-null. |
| [in] | amount | The amount associated with the script pubkey for this output. |
Definition at line 753 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API void btck_transaction_output_destroy | ( | btck_TransactionOutput * | transaction_output | ) |
Destroy the transaction output.
Definition at line 773 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int64_t btck_transaction_output_get_amount | ( | const btck_TransactionOutput * | transaction_output | ) |
Get the amount in the output.
| [in] | transaction_output | Non-null. |
Definition at line 768 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API const btck_ScriptPubkey * btck_transaction_output_get_script_pubkey | ( | const btck_TransactionOutput * | transaction_output | ) |
Get the script pubkey of the output.
The returned script pubkey is not owned and depends on the lifetime of the transaction output.
| [in] | transaction_output | Non-null. |
Definition at line 763 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_TransactionSpentOutputs *BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_spent_outputs_copy | ( | const btck_TransactionSpentOutputs * | transaction_spent_outputs | ) |
Copy a transaction's spent outputs.
| [in] | transaction_spent_outputs | Non-null. |
Definition at line 1523 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API size_t btck_transaction_spent_outputs_count | ( | const btck_TransactionSpentOutputs * | transaction_spent_outputs | ) |
Returns the number of previous transaction outputs contained in the transaction spent outputs data.
| [in] | transaction_spent_outputs | Non-null |
Definition at line 1528 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API void btck_transaction_spent_outputs_destroy | ( | btck_TransactionSpentOutputs * | transaction_spent_outputs | ) |
Destroy the transaction spent outputs.
Definition at line 1533 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API const btck_Coin * btck_transaction_spent_outputs_get_coin_at | ( | const btck_TransactionSpentOutputs * | transaction_spent_outputs, |
| size_t | coin_index | ||
| ) |
Returns a coin contained in the transaction spent outputs at a certain index.
The returned pointer is unowned and only valid for the lifetime of transaction_spent_outputs.
| [in] | transaction_spent_outputs | Non-null. |
| [in] | coin_index | The index of the to be retrieved coin within the transaction spent outputs. |
Definition at line 1538 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_to_bytes | ( | const btck_Transaction * | transaction, |
| btck_WriteBytes | writer, | ||
| void * | user_data | ||
| ) |
Serializes the transaction through the passed in callback to bytes.
This is consensus serialization that is also used for the P2P network.
| [in] | transaction | Non-null. |
| [in] | writer | Non-null, callback to a write bytes function. |
| [in] | user_data | Holds a user-defined opaque structure that will be passed back through the writer callback. |
| BITCOINKERNEL_API btck_TxValidationState *BITCOINKERNEL_WARN_UNUSED_RESULT btck_tx_validation_state_create | ( | ) |
Create a new btck_TxValidationState.
Definition at line 1702 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API void btck_tx_validation_state_destroy | ( | btck_TxValidationState * | state | ) |
Destroy the btck_TxValidationState.
Definition at line 1727 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_TxValidationResult btck_tx_validation_state_get_tx_validation_result | ( | const btck_TxValidationState * | state | ) |
Returns the validation result from an opaque btck_TxValidationState pointer.
btck_transaction_check currently produces only btck_TxValidationResult_UNSET for valid transactions and btck_TxValidationResult_CONSENSUS for invalid ones. Other values remain exposed for forward compatibility with higher-level validation entry points.
Definition at line 1707 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_ValidationMode btck_tx_validation_state_get_validation_mode | ( | const btck_TxValidationState * | state | ) |
Returns the validation mode from an opaque btck_TxValidationState pointer.
Definition at line 1694 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API btck_Txid *BITCOINKERNEL_WARN_UNUSED_RESULT btck_txid_copy | ( | const btck_Txid * | txid | ) |
Copy a txid.
| [in] | txid | Non-null. |
Definition at line 924 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int BITCOINKERNEL_API void BITCOINKERNEL_API void btck_txid_destroy | ( | btck_Txid * | txid | ) |
Destroy the txid.
Definition at line 939 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int btck_txid_equals | ( | const btck_Txid * | txid1, |
| const btck_Txid * | txid2 | ||
| ) |
Check if two txids are equal.
| [in] | txid1 | Non-null. |
| [in] | txid2 | Non-null. |
| BITCOINKERNEL_API int BITCOINKERNEL_API void btck_txid_to_bytes | ( | const btck_Txid * | txid, |
| unsigned char | output[32] | ||
| ) |
Serializes the txid to bytes.
| [in] | txid | Non-null. |
| [out] | output | The serialized txid. |
| BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT BITCOINKERNEL_API btck_WitnessStack *BITCOINKERNEL_WARN_UNUSED_RESULT btck_witness_stack_copy | ( | const btck_WitnessStack * | witness_stack | ) |
Copy a witness stack.
| [in] | witness_stack | Non-null. |
Definition at line 894 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API size_t btck_witness_stack_count_items | ( | const btck_WitnessStack * | witness_stack | ) |
Return the number of items in a witness stack.
| [in] | witness_stack | Non-null. |
Definition at line 882 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API void btck_witness_stack_destroy | ( | btck_WitnessStack * | witness_stack | ) |
Destroy the witness stack.
Definition at line 899 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT btck_witness_stack_get_item_at | ( | const btck_WitnessStack * | witness_stack, |
| size_t | index, | ||
| btck_WriteBytes | writer, | ||
| void * | user_data | ||
| ) |
Serialize a witness stack item at a given index through the passed in callback.
| [in] | witness_stack | Non-null. |
| [in] | index | Index of the item in the witness stack. |
| [in] | writer | Non-null, function pointer for writing bytes. |
| [in] | user_data | Nullable, passed back through the writer callback. |
| BITCOINKERNEL_API btck_Wtxid *BITCOINKERNEL_WARN_UNUSED_RESULT btck_wtxid_copy | ( | const btck_Wtxid * | wtxid | ) |
Copy a wtxid.
| [in] | wtxid | Non-null. |
Definition at line 944 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int BITCOINKERNEL_API void BITCOINKERNEL_API void btck_wtxid_destroy | ( | btck_Wtxid * | wtxid | ) |
Destroy the wtxid.
Definition at line 959 of file bitcoinkernel.cpp.
| BITCOINKERNEL_API int btck_wtxid_equals | ( | const btck_Wtxid * | wtxid1, |
| const btck_Wtxid * | wtxid2 | ||
| ) |
Check if two wtxids are equal.
| [in] | wtxid1 | Non-null. |
| [in] | wtxid2 | Non-null. |
| BITCOINKERNEL_API int BITCOINKERNEL_API void btck_wtxid_to_bytes | ( | const btck_Wtxid * | wtxid, |
| unsigned char | output[32] | ||
| ) |
Serializes the wtxid to bytes.
| [in] | wtxid | Non-null. |
| [out] | output | The serialized wtxid. |