Bitcoin Core 30.99.0
P2P Digital Currency
Classes | Macros | Typedefs
bitcoinkernel.h File Reference
#include <stddef.h>
#include <stdint.h>
Include dependency graph for bitcoinkernel.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  btck_ValidationInterfaceCallbacks
 Holds the validation interface callbacks. More...
 
struct  btck_NotificationInterfaceCallbacks
 A struct for holding the kernel notification callbacks. More...
 
struct  btck_LoggingOptions
 Options controlling the format of log messages. More...
 

Macros

#define BITCOINKERNEL_API
 
#define BITCOINKERNEL_WARN_UNUSED_RESULT
 
#define BITCOINKERNEL_ARG_NONNULL(...)
 
#define btck_SynchronizationState_INIT_REINDEX   ((btck_SynchronizationState)(0))
 
#define btck_SynchronizationState_INIT_DOWNLOAD   ((btck_SynchronizationState)(1))
 
#define btck_SynchronizationState_POST_INIT   ((btck_SynchronizationState)(2))
 
#define btck_Warning_UNKNOWN_NEW_RULES_ACTIVATED   ((btck_Warning)(0))
 
#define btck_Warning_LARGE_WORK_INVALID_CHAIN   ((btck_Warning)(1))
 
#define btck_ValidationMode_VALID   ((btck_ValidationMode)(0))
 
#define btck_ValidationMode_INVALID   ((btck_ValidationMode)(1))
 
#define btck_ValidationMode_INTERNAL_ERROR   ((btck_ValidationMode)(2))
 
#define btck_BlockValidationResult_UNSET   ((btck_BlockValidationResult)(0))
 initial value. Block has not yet been rejected More...
 
#define btck_BlockValidationResult_CONSENSUS   ((btck_BlockValidationResult)(1))
 invalid by consensus rules (excluding any below reasons) More...
 
#define btck_BlockValidationResult_CACHED_INVALID   ((btck_BlockValidationResult)(2))
 this block was cached as being invalid and we didn't store the reason why More...
 
#define btck_BlockValidationResult_INVALID_HEADER   ((btck_BlockValidationResult)(3))
 invalid proof of work or time too old More...
 
#define btck_BlockValidationResult_MUTATED   ((btck_BlockValidationResult)(4))
 the block's data didn't match the data committed to by the PoW More...
 
#define btck_BlockValidationResult_MISSING_PREV   ((btck_BlockValidationResult)(5))
 We don't have the previous block the checked one is built on. More...
 
#define btck_BlockValidationResult_INVALID_PREV   ((btck_BlockValidationResult)(6))
 A block this one builds on is invalid. More...
 
#define btck_BlockValidationResult_TIME_FUTURE   ((btck_BlockValidationResult)(7))
 block timestamp was > 2 hours in the future (or our clock is bad) More...
 
#define btck_BlockValidationResult_HEADER_LOW_WORK   ((btck_BlockValidationResult)(8))
 the block header may be on a too-little-work chain More...
 
#define btck_LogCategory_ALL   ((btck_LogCategory)(0))
 
#define btck_LogCategory_BENCH   ((btck_LogCategory)(1))
 
#define btck_LogCategory_BLOCKSTORAGE   ((btck_LogCategory)(2))
 
#define btck_LogCategory_COINDB   ((btck_LogCategory)(3))
 
#define btck_LogCategory_LEVELDB   ((btck_LogCategory)(4))
 
#define btck_LogCategory_MEMPOOL   ((btck_LogCategory)(5))
 
#define btck_LogCategory_PRUNE   ((btck_LogCategory)(6))
 
#define btck_LogCategory_RAND   ((btck_LogCategory)(7))
 
#define btck_LogCategory_REINDEX   ((btck_LogCategory)(8))
 
#define btck_LogCategory_VALIDATION   ((btck_LogCategory)(9))
 
#define btck_LogCategory_KERNEL   ((btck_LogCategory)(10))
 
#define btck_LogLevel_TRACE   ((btck_LogLevel)(0))
 
#define btck_LogLevel_DEBUG   ((btck_LogLevel)(1))
 
#define btck_LogLevel_INFO   ((btck_LogLevel)(2))
 
#define btck_ScriptVerifyStatus_OK   ((btck_ScriptVerifyStatus)(0))
 
#define btck_ScriptVerifyStatus_ERROR_INVALID_FLAGS_COMBINATION   ((btck_ScriptVerifyStatus)(1))
 The flags were combined in an invalid way. More...
 
#define btck_ScriptVerifyStatus_ERROR_SPENT_OUTPUTS_REQUIRED   ((btck_ScriptVerifyStatus)(2))
 The taproot flag was set, so valid spent_outputs have to be provided. More...
 
#define btck_ScriptVerificationFlags_NONE   ((btck_ScriptVerificationFlags)(0))
 
#define btck_ScriptVerificationFlags_P2SH   ((btck_ScriptVerificationFlags)(1U << 0))
 evaluate P2SH (BIP16) subscripts More...
 
#define btck_ScriptVerificationFlags_DERSIG   ((btck_ScriptVerificationFlags)(1U << 2))
 enforce strict DER (BIP66) compliance More...
 
#define btck_ScriptVerificationFlags_NULLDUMMY   ((btck_ScriptVerificationFlags)(1U << 4))
 enforce NULLDUMMY (BIP147) More...
 
#define btck_ScriptVerificationFlags_CHECKLOCKTIMEVERIFY   ((btck_ScriptVerificationFlags)(1U << 9))
 enable CHECKLOCKTIMEVERIFY (BIP65) More...
 
#define btck_ScriptVerificationFlags_CHECKSEQUENCEVERIFY   ((btck_ScriptVerificationFlags)(1U << 10))
 enable CHECKSEQUENCEVERIFY (BIP112) More...
 
#define btck_ScriptVerificationFlags_WITNESS   ((btck_ScriptVerificationFlags)(1U << 11))
 enable WITNESS (BIP141) More...
 
#define btck_ScriptVerificationFlags_TAPROOT   ((btck_ScriptVerificationFlags)(1U << 17))
 enable TAPROOT (BIPs 341 & 342) More...
 
#define btck_ScriptVerificationFlags_ALL
 
#define btck_ChainType_MAINNET   ((btck_ChainType)(0))
 
#define btck_ChainType_TESTNET   ((btck_ChainType)(1))
 
#define btck_ChainType_TESTNET_4   ((btck_ChainType)(2))
 
#define btck_ChainType_SIGNET   ((btck_ChainType)(3))
 
#define btck_ChainType_REGTEST   ((btck_ChainType)(4))
 

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_Chain btck_Chain
 Opaque data structure for holding the currently known best-chain associated with a chainstate. 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_TransactionOutPoint btck_TransactionOutPoint
 Opaque data structure for holding a transaction out point. More...
 
typedef struct btck_Txid btck_Txid
 
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 void(* btck_LogCallback) (void *user_data, const char *message, size_t message_len)
 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 uint8_t btck_LogCategory
 A collection of logging categories that may be encountered by kernel code. More...
 
typedef uint8_t btck_LogLevel
 The level at which logs should be produced. 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
 

Functions

Transaction

Functions for working with transactions.

BITCOINKERNEL_API btck_Transaction *BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_create (const void *raw_transaction, size_t raw_transaction_len) BITCOINKERNEL_ARG_NONNULL(1)
 Create a new transaction from the serialized data. More...
 
BITCOINKERNEL_API btck_Transaction *BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_copy (const btck_Transaction *transaction) BITCOINKERNEL_ARG_NONNULL(1)
 Copy a transaction. More...
 
BITCOINKERNEL_API int btck_transaction_to_bytes (const btck_Transaction *transaction, btck_WriteBytes writer, void *user_data) BITCOINKERNEL_ARG_NONNULL(1
 Serializes the transaction through the passed in callback to bytes. More...
 
BITCOINKERNEL_API int BITCOINKERNEL_API size_t BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_count_outputs (const btck_Transaction *transaction) BITCOINKERNEL_ARG_NONNULL(1)
 Get the number of outputs of a transaction. More...
 
BITCOINKERNEL_API const btck_TransactionOutput *BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_get_output_at (const btck_Transaction *transaction, size_t output_index) BITCOINKERNEL_ARG_NONNULL(1)
 Get the transaction outputs at the provided index. More...
 
BITCOINKERNEL_API const btck_TransactionInput *BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_get_input_at (const btck_Transaction *transaction, size_t input_index) BITCOINKERNEL_ARG_NONNULL(1)
 Get the transaction input at the provided index. More...
 
BITCOINKERNEL_API size_t BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_count_inputs (const btck_Transaction *transaction) BITCOINKERNEL_ARG_NONNULL(1)
 Get the number of inputs of a transaction. More...
 
BITCOINKERNEL_API const btck_Txid *BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_get_txid (const btck_Transaction *transaction) BITCOINKERNEL_ARG_NONNULL(1)
 Get the txid of a transaction. More...
 
BITCOINKERNEL_API void btck_transaction_destroy (btck_Transaction *transaction)
 Destroy the transaction. More...
 
ScriptPubkey

Functions for working with script pubkeys.

BITCOINKERNEL_API btck_ScriptPubkey *BITCOINKERNEL_WARN_UNUSED_RESULT btck_script_pubkey_create (const void *script_pubkey, size_t script_pubkey_len) BITCOINKERNEL_ARG_NONNULL(1)
 Create a script pubkey from serialized data. More...
 
BITCOINKERNEL_API btck_ScriptPubkey *BITCOINKERNEL_WARN_UNUSED_RESULT btck_script_pubkey_copy (const btck_ScriptPubkey *script_pubkey) BITCOINKERNEL_ARG_NONNULL(1)
 Copy a script pubkey. More...
 
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_TransactionOutput **spent_outputs, size_t spent_outputs_len, unsigned int input_index, unsigned int flags, btck_ScriptVerifyStatus *status) BITCOINKERNEL_ARG_NONNULL(1
 Verify if the input at input_index of tx_to spends the script pubkey under the constraints specified by flags. More...
 
BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT BITCOINKERNEL_API int btck_script_pubkey_to_bytes (const btck_ScriptPubkey *script_pubkey, btck_WriteBytes writer, void *user_data) BITCOINKERNEL_ARG_NONNULL(1
 Serializes the script pubkey through the passed in callback to bytes. More...
 
BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT BITCOINKERNEL_API int BITCOINKERNEL_API void btck_script_pubkey_destroy (btck_ScriptPubkey *script_pubkey)
 Destroy the script pubkey. More...
 
TransactionOutput

Functions for working with transaction outputs.

BITCOINKERNEL_API btck_TransactionOutput *BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_output_create (const btck_ScriptPubkey *script_pubkey, int64_t amount) BITCOINKERNEL_ARG_NONNULL(1)
 Create a transaction output from a script pubkey and an amount. More...
 
BITCOINKERNEL_API const btck_ScriptPubkey *BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_output_get_script_pubkey (const btck_TransactionOutput *transaction_output) BITCOINKERNEL_ARG_NONNULL(1)
 Get the script pubkey of the output. More...
 
BITCOINKERNEL_API int64_t BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_output_get_amount (const btck_TransactionOutput *transaction_output) BITCOINKERNEL_ARG_NONNULL(1)
 Get the amount in the output. More...
 
BITCOINKERNEL_API btck_TransactionOutput *BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_output_copy (const btck_TransactionOutput *transaction_output) BITCOINKERNEL_ARG_NONNULL(1)
 Copy a transaction output. More...
 
BITCOINKERNEL_API void btck_transaction_output_destroy (btck_TransactionOutput *transaction_output)
 Destroy the transaction output. More...
 
Logging

Logging-related functions.

BITCOINKERNEL_API void btck_logging_disable ()
 This disables the global internal logger. More...
 
BITCOINKERNEL_API void btck_logging_set_options (const btck_LoggingOptions options)
 Set some options for the global internal logger. More...
 
BITCOINKERNEL_API void btck_logging_set_level_category (btck_LogCategory category, btck_LogLevel level)
 Set the log level of the global internal logger. More...
 
BITCOINKERNEL_API void btck_logging_enable_category (btck_LogCategory category)
 Enable a specific log category for the global internal logger. More...
 
BITCOINKERNEL_API void btck_logging_disable_category (btck_LogCategory category)
 Disable a specific log category for the global internal logger. More...
 
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) BITCOINKERNEL_ARG_NONNULL(1)
 Start logging messages through the provided callback. More...
 
BITCOINKERNEL_API void btck_logging_connection_destroy (btck_LoggingConnection *logging_connection)
 Stop logging and destroy the logging connection. More...
 
ChainParameters

Functions for working with chain parameters.

BITCOINKERNEL_API btck_ChainParameters *BITCOINKERNEL_WARN_UNUSED_RESULT btck_chain_parameters_create (const btck_ChainType chain_type)
 Creates a chain parameters struct with default parameters based on the passed in chain type. More...
 
BITCOINKERNEL_API btck_ChainParameters *BITCOINKERNEL_WARN_UNUSED_RESULT btck_chain_parameters_copy (const btck_ChainParameters *chain_parameters) BITCOINKERNEL_ARG_NONNULL(1)
 Copy the chain parameters. More...
 
BITCOINKERNEL_API void btck_chain_parameters_destroy (btck_ChainParameters *chain_parameters)
 Destroy the chain parameters. More...
 
ContextOptions

Functions for working with context options.

BITCOINKERNEL_API btck_ContextOptions *BITCOINKERNEL_WARN_UNUSED_RESULT btck_context_options_create ()
 Creates an empty context options. More...
 
BITCOINKERNEL_API void btck_context_options_set_chainparams (btck_ContextOptions *context_options, const btck_ChainParameters *chain_parameters) BITCOINKERNEL_ARG_NONNULL(1
 Sets the chain params for the context options. More...
 
BITCOINKERNEL_API void BITCOINKERNEL_API void btck_context_options_set_notifications (btck_ContextOptions *context_options, btck_NotificationInterfaceCallbacks notifications) BITCOINKERNEL_ARG_NONNULL(1)
 Set the kernel notifications for the context options. More...
 
BITCOINKERNEL_API void btck_context_options_set_validation_interface (btck_ContextOptions *context_options, btck_ValidationInterfaceCallbacks validation_interface_callbacks) BITCOINKERNEL_ARG_NONNULL(1)
 Set the validation interface callbacks for the context options. More...
 
BITCOINKERNEL_API void btck_context_options_destroy (btck_ContextOptions *context_options)
 Destroy the context options. More...
 
Context

Functions for working with contexts.

BITCOINKERNEL_API btck_Context *BITCOINKERNEL_WARN_UNUSED_RESULT btck_context_create (const btck_ContextOptions *context_options)
 Create a new kernel context. More...
 
BITCOINKERNEL_API btck_Context *BITCOINKERNEL_WARN_UNUSED_RESULT btck_context_copy (const btck_Context *context) BITCOINKERNEL_ARG_NONNULL(1)
 Copy the context. More...
 
BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT btck_context_interrupt (btck_Context *context) BITCOINKERNEL_ARG_NONNULL(1)
 Interrupt can be used to halt long-running validation functions like when reindexing, importing or processing blocks. More...
 
BITCOINKERNEL_API void btck_context_destroy (btck_Context *context)
 Destroy the context. More...
 
BlockTreeEntry

Functions for working with block tree entries.

BITCOINKERNEL_API const btck_BlockTreeEntry *BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_tree_entry_get_previous (const btck_BlockTreeEntry *block_tree_entry) BITCOINKERNEL_ARG_NONNULL(1)
 Returns the previous block tree entry in the tree, or null if the current block tree entry is the genesis block. More...
 
BITCOINKERNEL_API int32_t BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_tree_entry_get_height (const btck_BlockTreeEntry *block_tree_entry) BITCOINKERNEL_ARG_NONNULL(1)
 Return the height of a certain block tree entry. More...
 
BITCOINKERNEL_API const btck_BlockHash *BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_tree_entry_get_block_hash (const btck_BlockTreeEntry *block_tree_entry) BITCOINKERNEL_ARG_NONNULL(1)
 Return the block hash associated with a block tree entry. More...
 
ChainstateManagerOptions

Functions for working with chainstate manager options.

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) BITCOINKERNEL_ARG_NONNULL(1
 Create options for the chainstate manager. More...
 
BITCOINKERNEL_API btck_ChainstateManagerOptions *BITCOINKERNEL_WARN_UNUSED_RESULT BITCOINKERNEL_API void btck_chainstate_manager_options_set_worker_threads_num (btck_ChainstateManagerOptions *chainstate_manager_options, int worker_threads) BITCOINKERNEL_ARG_NONNULL(1)
 Set the number of available worker threads used during validation. More...
 
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) BITCOINKERNEL_ARG_NONNULL(1)
 Sets wipe db in the options. More...
 
BITCOINKERNEL_API void btck_chainstate_manager_options_update_block_tree_db_in_memory (btck_ChainstateManagerOptions *chainstate_manager_options, int block_tree_db_in_memory) BITCOINKERNEL_ARG_NONNULL(1)
 Sets block tree db in memory in the options. More...
 
BITCOINKERNEL_API void btck_chainstate_manager_options_update_chainstate_db_in_memory (btck_ChainstateManagerOptions *chainstate_manager_options, int chainstate_db_in_memory) BITCOINKERNEL_ARG_NONNULL(1)
 Sets chainstate db in memory in the options. More...
 
BITCOINKERNEL_API void btck_chainstate_manager_options_destroy (btck_ChainstateManagerOptions *chainstate_manager_options)
 Destroy the chainstate manager options. More...
 
ChainstateManager

Functions for chainstate management.

BITCOINKERNEL_API btck_ChainstateManager *BITCOINKERNEL_WARN_UNUSED_RESULT btck_chainstate_manager_create (const btck_ChainstateManagerOptions *chainstate_manager_options) BITCOINKERNEL_ARG_NONNULL(1)
 Create a chainstate manager. More...
 
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) BITCOINKERNEL_ARG_NONNULL(1)
 Triggers the start of a reindex if the wipe options were previously set for the chainstate manager. More...
 
BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT btck_chainstate_manager_process_block (btck_ChainstateManager *chainstate_manager, const btck_Block *block, int *new_block) BITCOINKERNEL_ARG_NONNULL(1
 Process and validate the passed in block with the chainstate manager. More...
 
BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT BITCOINKERNEL_API const btck_Chain *BITCOINKERNEL_WARN_UNUSED_RESULT btck_chainstate_manager_get_active_chain (const btck_ChainstateManager *chainstate_manager) BITCOINKERNEL_ARG_NONNULL(1)
 Returns the best known currently active chain. More...
 
BITCOINKERNEL_API const btck_BlockTreeEntry *BITCOINKERNEL_WARN_UNUSED_RESULT btck_chainstate_manager_get_block_tree_entry_by_hash (const btck_ChainstateManager *chainstate_manager, const btck_BlockHash *block_hash) BITCOINKERNEL_ARG_NONNULL(1
 Retrieve a block tree entry by its block hash. More...
 
BITCOINKERNEL_API const btck_BlockTreeEntry *BITCOINKERNEL_WARN_UNUSED_RESULT BITCOINKERNEL_API void btck_chainstate_manager_destroy (btck_ChainstateManager *chainstate_manager)
 Destroy the chainstate manager. More...
 
Block

Functions for working with blocks.

BITCOINKERNEL_API btck_Block *BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_read (const btck_ChainstateManager *chainstate_manager, const btck_BlockTreeEntry *block_tree_entry) BITCOINKERNEL_ARG_NONNULL(1
 Reads the block the passed in block tree entry points to from disk and returns it. More...
 
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) BITCOINKERNEL_ARG_NONNULL(1)
 Parse a serialized raw block into a new block object. More...
 
BITCOINKERNEL_API btck_Block *BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_copy (const btck_Block *block) BITCOINKERNEL_ARG_NONNULL(1)
 Copy a block. More...
 
BITCOINKERNEL_API size_t BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_count_transactions (const btck_Block *block) BITCOINKERNEL_ARG_NONNULL(1)
 Count the number of transactions contained in a block. More...
 
BITCOINKERNEL_API const btck_Transaction *BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_get_transaction_at (const btck_Block *block, size_t transaction_index) BITCOINKERNEL_ARG_NONNULL(1)
 Get the transaction at the provided index. More...
 
BITCOINKERNEL_API btck_BlockHash *BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_get_hash (const btck_Block *block) BITCOINKERNEL_ARG_NONNULL(1)
 Calculate and return the hash of a block. More...
 
BITCOINKERNEL_API int btck_block_to_bytes (const btck_Block *block, btck_WriteBytes writer, void *user_data) BITCOINKERNEL_ARG_NONNULL(1
 Serializes the block through the passed in callback to bytes. More...
 
BITCOINKERNEL_API int BITCOINKERNEL_API void btck_block_destroy (btck_Block *block)
 Destroy the block. More...
 
BlockValidationState

Functions for working with block validation states.

BITCOINKERNEL_API btck_ValidationMode btck_block_validation_state_get_validation_mode (const btck_BlockValidationState *block_validation_state) BITCOINKERNEL_ARG_NONNULL(1)
 Returns the validation mode from an opaque block validation state pointer. More...
 
BITCOINKERNEL_API btck_BlockValidationResult btck_block_validation_state_get_block_validation_result (const btck_BlockValidationState *block_validation_state) BITCOINKERNEL_ARG_NONNULL(1)
 Returns the validation result from an opaque block validation state pointer. More...
 
Chain

Functions for working with the chain

BITCOINKERNEL_API const btck_BlockTreeEntry *BITCOINKERNEL_WARN_UNUSED_RESULT btck_chain_get_tip (const btck_Chain *chain) BITCOINKERNEL_ARG_NONNULL(1)
 Get the block tree entry of the current chain tip. More...
 
BITCOINKERNEL_API int32_t BITCOINKERNEL_WARN_UNUSED_RESULT btck_chain_get_height (const btck_Chain *chain) BITCOINKERNEL_ARG_NONNULL(1)
 Return the height of the tip of the chain. More...
 
BITCOINKERNEL_API const btck_BlockTreeEntry *BITCOINKERNEL_WARN_UNUSED_RESULT btck_chain_get_genesis (const btck_Chain *chain) BITCOINKERNEL_ARG_NONNULL(1)
 Get the block tree entry of the genesis block. More...
 
BITCOINKERNEL_API const btck_BlockTreeEntry *BITCOINKERNEL_WARN_UNUSED_RESULT btck_chain_get_by_height (const btck_Chain *chain, int block_height) BITCOINKERNEL_ARG_NONNULL(1)
 Retrieve a block tree entry by its height in the currently active chain. More...
 
BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT btck_chain_contains (const btck_Chain *chain, const btck_BlockTreeEntry *block_tree_entry) BITCOINKERNEL_ARG_NONNULL(1
 Return true if the passed in chain contains the block tree entry. More...
 
BlockSpentOutputs

Functions for working with block spent outputs.

BITCOINKERNEL_API btck_BlockSpentOutputs *BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_spent_outputs_read (const btck_ChainstateManager *chainstate_manager, const btck_BlockTreeEntry *block_tree_entry) BITCOINKERNEL_ARG_NONNULL(1
 Reads the block spent coins data the passed in block tree entry points to from disk and returns it. More...
 
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) BITCOINKERNEL_ARG_NONNULL(1)
 Copy a block's spent outputs. More...
 
BITCOINKERNEL_API size_t BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_spent_outputs_count (const btck_BlockSpentOutputs *block_spent_outputs) BITCOINKERNEL_ARG_NONNULL(1)
 Returns the number of transaction spent outputs whose data is contained in block spent outputs. More...
 
BITCOINKERNEL_API const btck_TransactionSpentOutputs *BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_spent_outputs_get_transaction_spent_outputs_at (const btck_BlockSpentOutputs *block_spent_outputs, size_t transaction_spent_outputs_index) BITCOINKERNEL_ARG_NONNULL(1)
 Returns a transaction spent outputs contained in the block spent outputs at a certain index. More...
 
BITCOINKERNEL_API void btck_block_spent_outputs_destroy (btck_BlockSpentOutputs *block_spent_outputs)
 Destroy the block spent outputs. More...
 
TransactionSpentOutputs

Functions for working with the spent coins of a transaction

BITCOINKERNEL_API btck_TransactionSpentOutputs *BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_spent_outputs_copy (const btck_TransactionSpentOutputs *transaction_spent_outputs) BITCOINKERNEL_ARG_NONNULL(1)
 Copy a transaction's spent outputs. More...
 
BITCOINKERNEL_API size_t BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_spent_outputs_count (const btck_TransactionSpentOutputs *transaction_spent_outputs) BITCOINKERNEL_ARG_NONNULL(1)
 Returns the number of previous transaction outputs contained in the transaction spent outputs data. More...
 
BITCOINKERNEL_API const btck_Coin *BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_spent_outputs_get_coin_at (const btck_TransactionSpentOutputs *transaction_spent_outputs, size_t coin_index) BITCOINKERNEL_ARG_NONNULL(1)
 Returns a coin contained in the transaction spent outputs at a certain index. More...
 
BITCOINKERNEL_API void btck_transaction_spent_outputs_destroy (btck_TransactionSpentOutputs *transaction_spent_outputs)
 Destroy the transaction spent outputs. More...
 
Transaction Input

Functions for working with transaction inputs.

BITCOINKERNEL_API btck_TransactionInput *BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_input_copy (const btck_TransactionInput *transaction_input) BITCOINKERNEL_ARG_NONNULL(1)
 Copy a transaction input. More...
 
BITCOINKERNEL_API const btck_TransactionOutPoint *BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_input_get_out_point (const btck_TransactionInput *transaction_input) BITCOINKERNEL_ARG_NONNULL(1)
 Get the transaction out point. More...
 
BITCOINKERNEL_API void btck_transaction_input_destroy (btck_TransactionInput *transaction_input)
 Destroy the transaction input. More...
 
Transaction Out Point

Functions for working with transaction out points.

BITCOINKERNEL_API btck_TransactionOutPoint *BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_out_point_copy (const btck_TransactionOutPoint *transaction_out_point) BITCOINKERNEL_ARG_NONNULL(1)
 Copy a transaction out point. More...
 
BITCOINKERNEL_API uint32_t BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_out_point_get_index (const btck_TransactionOutPoint *transaction_out_point) BITCOINKERNEL_ARG_NONNULL(1)
 Get the output position from the transaction out point. More...
 
BITCOINKERNEL_API const btck_Txid *BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_out_point_get_txid (const btck_TransactionOutPoint *transaction_out_point) BITCOINKERNEL_ARG_NONNULL(1)
 Get the txid from the transaction out point. More...
 
BITCOINKERNEL_API void btck_transaction_out_point_destroy (btck_TransactionOutPoint *transaction_out_point)
 Destroy the transaction out point. More...
 
Txid

Functions for working with txids.

BITCOINKERNEL_API btck_Txid *BITCOINKERNEL_WARN_UNUSED_RESULT btck_txid_copy (const btck_Txid *txid) BITCOINKERNEL_ARG_NONNULL(1)
 Copy a txid. More...
 
BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT btck_txid_equals (const btck_Txid *txid1, const btck_Txid *txid2) BITCOINKERNEL_ARG_NONNULL(1
 Check if two txids are equal. More...
 
BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT BITCOINKERNEL_API void btck_txid_to_bytes (const btck_Txid *txid, unsigned char output[32]) BITCOINKERNEL_ARG_NONNULL(1
 Serializes the txid to bytes. More...
 
BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT BITCOINKERNEL_API void BITCOINKERNEL_API void btck_txid_destroy (btck_Txid *txid)
 Destroy the txid. More...
 
Coin

Functions for working with coins.

BITCOINKERNEL_API btck_Coin *BITCOINKERNEL_WARN_UNUSED_RESULT btck_coin_copy (const btck_Coin *coin) BITCOINKERNEL_ARG_NONNULL(1)
 Copy a coin. More...
 
BITCOINKERNEL_API uint32_t BITCOINKERNEL_WARN_UNUSED_RESULT btck_coin_confirmation_height (const btck_Coin *coin) BITCOINKERNEL_ARG_NONNULL(1)
 Returns the block height where the transaction that created this coin was included in. More...
 
BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT btck_coin_is_coinbase (const btck_Coin *coin) BITCOINKERNEL_ARG_NONNULL(1)
 Returns whether the containing transaction was a coinbase. More...
 
BITCOINKERNEL_API const btck_TransactionOutput *BITCOINKERNEL_WARN_UNUSED_RESULT btck_coin_get_output (const btck_Coin *coin) BITCOINKERNEL_ARG_NONNULL(1)
 Return the transaction output of a coin. More...
 
BITCOINKERNEL_API void btck_coin_destroy (btck_Coin *coin)
 Destroy the coin. More...
 
BlockHash

Functions for working with block hashes.

BITCOINKERNEL_API btck_BlockHash *BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_hash_create (const unsigned char block_hash[32]) BITCOINKERNEL_ARG_NONNULL(1)
 Create a block hash from its raw data. More...
 
BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_hash_equals (const btck_BlockHash *hash1, const btck_BlockHash *hash2) BITCOINKERNEL_ARG_NONNULL(1
 Check if two block hashes are equal. More...
 
BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT BITCOINKERNEL_API btck_BlockHash *BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_hash_copy (const btck_BlockHash *block_hash) BITCOINKERNEL_ARG_NONNULL(1)
 Copy a block hash. More...
 
BITCOINKERNEL_API void btck_block_hash_to_bytes (const btck_BlockHash *block_hash, unsigned char output[32]) BITCOINKERNEL_ARG_NONNULL(1
 Serializes the block hash to bytes. More...
 
BITCOINKERNEL_API void BITCOINKERNEL_API void btck_block_hash_destroy (btck_BlockHash *block_hash)
 Destroy the block hash. More...
 

Macro Definition Documentation

◆ BITCOINKERNEL_API

#define BITCOINKERNEL_API

Definition at line 27 of file bitcoinkernel.h.

◆ BITCOINKERNEL_ARG_NONNULL

#define BITCOINKERNEL_ARG_NONNULL (   ...)

Definition at line 41 of file bitcoinkernel.h.

◆ BITCOINKERNEL_WARN_UNUSED_RESULT

#define BITCOINKERNEL_WARN_UNUSED_RESULT

Definition at line 36 of file bitcoinkernel.h.

◆ btck_BlockValidationResult_CACHED_INVALID

#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 339 of file bitcoinkernel.h.

◆ btck_BlockValidationResult_CONSENSUS

#define btck_BlockValidationResult_CONSENSUS   ((btck_BlockValidationResult)(1))

invalid by consensus rules (excluding any below reasons)

Definition at line 338 of file bitcoinkernel.h.

◆ btck_BlockValidationResult_HEADER_LOW_WORK

#define btck_BlockValidationResult_HEADER_LOW_WORK   ((btck_BlockValidationResult)(8))

the block header may be on a too-little-work chain

Definition at line 345 of file bitcoinkernel.h.

◆ btck_BlockValidationResult_INVALID_HEADER

#define btck_BlockValidationResult_INVALID_HEADER   ((btck_BlockValidationResult)(3))

invalid proof of work or time too old

Definition at line 340 of file bitcoinkernel.h.

◆ btck_BlockValidationResult_INVALID_PREV

#define btck_BlockValidationResult_INVALID_PREV   ((btck_BlockValidationResult)(6))

A block this one builds on is invalid.

Definition at line 343 of file bitcoinkernel.h.

◆ btck_BlockValidationResult_MISSING_PREV

#define btck_BlockValidationResult_MISSING_PREV   ((btck_BlockValidationResult)(5))

We don't have the previous block the checked one is built on.

Definition at line 342 of file bitcoinkernel.h.

◆ btck_BlockValidationResult_MUTATED

#define btck_BlockValidationResult_MUTATED   ((btck_BlockValidationResult)(4))

the block's data didn't match the data committed to by the PoW

Definition at line 341 of file bitcoinkernel.h.

◆ btck_BlockValidationResult_TIME_FUTURE

#define btck_BlockValidationResult_TIME_FUTURE   ((btck_BlockValidationResult)(7))

block timestamp was > 2 hours in the future (or our clock is bad)

Definition at line 344 of file bitcoinkernel.h.

◆ btck_BlockValidationResult_UNSET

#define btck_BlockValidationResult_UNSET   ((btck_BlockValidationResult)(0))

initial value. Block has not yet been rejected

Definition at line 337 of file bitcoinkernel.h.

◆ btck_ChainType_MAINNET

#define btck_ChainType_MAINNET   ((btck_ChainType)(0))

Definition at line 458 of file bitcoinkernel.h.

◆ btck_ChainType_REGTEST

#define btck_ChainType_REGTEST   ((btck_ChainType)(4))

Definition at line 462 of file bitcoinkernel.h.

◆ btck_ChainType_SIGNET

#define btck_ChainType_SIGNET   ((btck_ChainType)(3))

Definition at line 461 of file bitcoinkernel.h.

◆ btck_ChainType_TESTNET

#define btck_ChainType_TESTNET   ((btck_ChainType)(1))

Definition at line 459 of file bitcoinkernel.h.

◆ btck_ChainType_TESTNET_4

#define btck_ChainType_TESTNET_4   ((btck_ChainType)(2))

Definition at line 460 of file bitcoinkernel.h.

◆ btck_LogCategory_ALL

#define btck_LogCategory_ALL   ((btck_LogCategory)(0))

Definition at line 396 of file bitcoinkernel.h.

◆ btck_LogCategory_BENCH

#define btck_LogCategory_BENCH   ((btck_LogCategory)(1))

Definition at line 397 of file bitcoinkernel.h.

◆ btck_LogCategory_BLOCKSTORAGE

#define btck_LogCategory_BLOCKSTORAGE   ((btck_LogCategory)(2))

Definition at line 398 of file bitcoinkernel.h.

◆ btck_LogCategory_COINDB

#define btck_LogCategory_COINDB   ((btck_LogCategory)(3))

Definition at line 399 of file bitcoinkernel.h.

◆ btck_LogCategory_KERNEL

#define btck_LogCategory_KERNEL   ((btck_LogCategory)(10))

Definition at line 406 of file bitcoinkernel.h.

◆ btck_LogCategory_LEVELDB

#define btck_LogCategory_LEVELDB   ((btck_LogCategory)(4))

Definition at line 400 of file bitcoinkernel.h.

◆ btck_LogCategory_MEMPOOL

#define btck_LogCategory_MEMPOOL   ((btck_LogCategory)(5))

Definition at line 401 of file bitcoinkernel.h.

◆ btck_LogCategory_PRUNE

#define btck_LogCategory_PRUNE   ((btck_LogCategory)(6))

Definition at line 402 of file bitcoinkernel.h.

◆ btck_LogCategory_RAND

#define btck_LogCategory_RAND   ((btck_LogCategory)(7))

Definition at line 403 of file bitcoinkernel.h.

◆ btck_LogCategory_REINDEX

#define btck_LogCategory_REINDEX   ((btck_LogCategory)(8))

Definition at line 404 of file bitcoinkernel.h.

◆ btck_LogCategory_VALIDATION

#define btck_LogCategory_VALIDATION   ((btck_LogCategory)(9))

Definition at line 405 of file bitcoinkernel.h.

◆ btck_LogLevel_DEBUG

#define btck_LogLevel_DEBUG   ((btck_LogLevel)(1))

Definition at line 413 of file bitcoinkernel.h.

◆ btck_LogLevel_INFO

#define btck_LogLevel_INFO   ((btck_LogLevel)(2))

Definition at line 414 of file bitcoinkernel.h.

◆ btck_LogLevel_TRACE

#define btck_LogLevel_TRACE   ((btck_LogLevel)(0))

Definition at line 412 of file bitcoinkernel.h.

◆ btck_ScriptVerificationFlags_ALL

#define btck_ScriptVerificationFlags_ALL
Value:
#define btck_ScriptVerificationFlags_P2SH
evaluate P2SH (BIP16) subscripts
#define btck_ScriptVerificationFlags_CHECKLOCKTIMEVERIFY
enable CHECKLOCKTIMEVERIFY (BIP65)
#define btck_ScriptVerificationFlags_TAPROOT
enable TAPROOT (BIPs 341 & 342)
#define btck_ScriptVerificationFlags_WITNESS
enable WITNESS (BIP141)
uint32_t btck_ScriptVerificationFlags
Script verification flags that may be composed with each other.
#define btck_ScriptVerificationFlags_NULLDUMMY
enforce NULLDUMMY (BIP147)
#define btck_ScriptVerificationFlags_CHECKSEQUENCEVERIFY
enable CHECKSEQUENCEVERIFY (BIP112)
#define btck_ScriptVerificationFlags_DERSIG
enforce strict DER (BIP66) compliance

Definition at line 449 of file bitcoinkernel.h.

◆ btck_ScriptVerificationFlags_CHECKLOCKTIMEVERIFY

#define btck_ScriptVerificationFlags_CHECKLOCKTIMEVERIFY   ((btck_ScriptVerificationFlags)(1U << 9))

enable CHECKLOCKTIMEVERIFY (BIP65)

Definition at line 445 of file bitcoinkernel.h.

◆ btck_ScriptVerificationFlags_CHECKSEQUENCEVERIFY

#define btck_ScriptVerificationFlags_CHECKSEQUENCEVERIFY   ((btck_ScriptVerificationFlags)(1U << 10))

enable CHECKSEQUENCEVERIFY (BIP112)

Definition at line 446 of file bitcoinkernel.h.

◆ btck_ScriptVerificationFlags_DERSIG

#define btck_ScriptVerificationFlags_DERSIG   ((btck_ScriptVerificationFlags)(1U << 2))

enforce strict DER (BIP66) compliance

Definition at line 443 of file bitcoinkernel.h.

◆ btck_ScriptVerificationFlags_NONE

#define btck_ScriptVerificationFlags_NONE   ((btck_ScriptVerificationFlags)(0))

Definition at line 441 of file bitcoinkernel.h.

◆ btck_ScriptVerificationFlags_NULLDUMMY

#define btck_ScriptVerificationFlags_NULLDUMMY   ((btck_ScriptVerificationFlags)(1U << 4))

enforce NULLDUMMY (BIP147)

Definition at line 444 of file bitcoinkernel.h.

◆ btck_ScriptVerificationFlags_P2SH

#define btck_ScriptVerificationFlags_P2SH   ((btck_ScriptVerificationFlags)(1U << 0))

evaluate P2SH (BIP16) subscripts

Definition at line 442 of file bitcoinkernel.h.

◆ btck_ScriptVerificationFlags_TAPROOT

#define btck_ScriptVerificationFlags_TAPROOT   ((btck_ScriptVerificationFlags)(1U << 17))

enable TAPROOT (BIPs 341 & 342)

Definition at line 448 of file bitcoinkernel.h.

◆ btck_ScriptVerificationFlags_WITNESS

#define btck_ScriptVerificationFlags_WITNESS   ((btck_ScriptVerificationFlags)(1U << 11))

enable WITNESS (BIP141)

Definition at line 447 of file bitcoinkernel.h.

◆ btck_ScriptVerifyStatus_ERROR_INVALID_FLAGS_COMBINATION

#define btck_ScriptVerifyStatus_ERROR_INVALID_FLAGS_COMBINATION   ((btck_ScriptVerifyStatus)(1))

The flags were combined in an invalid way.

Definition at line 434 of file bitcoinkernel.h.

◆ btck_ScriptVerifyStatus_ERROR_SPENT_OUTPUTS_REQUIRED

#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 435 of file bitcoinkernel.h.

◆ btck_ScriptVerifyStatus_OK

#define btck_ScriptVerifyStatus_OK   ((btck_ScriptVerifyStatus)(0))

Definition at line 433 of file bitcoinkernel.h.

◆ btck_SynchronizationState_INIT_DOWNLOAD

#define btck_SynchronizationState_INIT_DOWNLOAD   ((btck_SynchronizationState)(1))

Definition at line 279 of file bitcoinkernel.h.

◆ btck_SynchronizationState_INIT_REINDEX

#define btck_SynchronizationState_INIT_REINDEX   ((btck_SynchronizationState)(0))

Definition at line 278 of file bitcoinkernel.h.

◆ btck_SynchronizationState_POST_INIT

#define btck_SynchronizationState_POST_INIT   ((btck_SynchronizationState)(2))

Definition at line 280 of file bitcoinkernel.h.

◆ btck_ValidationMode_INTERNAL_ERROR

#define btck_ValidationMode_INTERNAL_ERROR   ((btck_ValidationMode)(2))

Definition at line 331 of file bitcoinkernel.h.

◆ btck_ValidationMode_INVALID

#define btck_ValidationMode_INVALID   ((btck_ValidationMode)(1))

Definition at line 330 of file bitcoinkernel.h.

◆ btck_ValidationMode_VALID

#define btck_ValidationMode_VALID   ((btck_ValidationMode)(0))

Definition at line 329 of file bitcoinkernel.h.

◆ btck_Warning_LARGE_WORK_INVALID_CHAIN

#define btck_Warning_LARGE_WORK_INVALID_CHAIN   ((btck_Warning)(1))

Definition at line 285 of file bitcoinkernel.h.

◆ btck_Warning_UNKNOWN_NEW_RULES_ACTIVATED

#define btck_Warning_UNKNOWN_NEW_RULES_ACTIVATED   ((btck_Warning)(0))

Definition at line 284 of file bitcoinkernel.h.

Typedef Documentation

◆ btck_Block

typedef struct btck_Block btck_Block

Opaque data structure for holding a block.

Definition at line 207 of file bitcoinkernel.h.

◆ btck_BlockHash

Opaque data structure for holding a block hash.

This is a type-safe identifier for a block.

Definition at line 258 of file bitcoinkernel.h.

◆ 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 234 of file bitcoinkernel.h.

◆ 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 182 of file bitcoinkernel.h.

◆ btck_BlockValidationResult

typedef uint32_t btck_BlockValidationResult

A granular "reason" why a block was invalid.

Definition at line 336 of file bitcoinkernel.h.

◆ 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 215 of file bitcoinkernel.h.

◆ btck_Chain

typedef struct btck_Chain btck_Chain

Opaque data structure for holding the currently known best-chain associated with a chainstate.

Definition at line 221 of file bitcoinkernel.h.

◆ 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 141 of file bitcoinkernel.h.

◆ 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 202 of file bitcoinkernel.h.

◆ 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 191 of file bitcoinkernel.h.

◆ btck_ChainType

typedef uint8_t btck_ChainType

Definition at line 457 of file bitcoinkernel.h.

◆ btck_Coin

typedef struct btck_Coin btck_Coin

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 251 of file bitcoinkernel.h.

◆ btck_Context

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 169 of file bitcoinkernel.h.

◆ 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 153 of file bitcoinkernel.h.

◆ btck_DestroyCallback

typedef void(* btck_DestroyCallback) (void *user_data)

Function signature for freeing user data.

Definition at line 298 of file bitcoinkernel.h.

◆ btck_LogCallback

typedef void(* btck_LogCallback) (void *user_data, const char *message, size_t message_len)

Callback function types.

Function signature for the global logging callback. All bitcoin kernel internal logs will pass through this callback.

Definition at line 293 of file bitcoinkernel.h.

◆ btck_LogCategory

typedef uint8_t btck_LogCategory

A collection of logging categories that may be encountered by kernel code.

Definition at line 395 of file bitcoinkernel.h.

◆ btck_LoggingConnection

Opaque data structure for holding a logging connection.

The logging connection can be used to manually stop logging.

Messages that were logged before a connection is created are buffered in a 1MB buffer. Logging can alternatively be permanently disabled by calling btck_logging_disable. Functions changing the logging settings are global and change the settings for all existing btck_LoggingConnection instances.

Definition at line 132 of file bitcoinkernel.h.

◆ btck_LogLevel

typedef uint8_t btck_LogLevel

The level at which logs should be produced.

Definition at line 411 of file bitcoinkernel.h.

◆ btck_NotifyBlockTip

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 303 of file bitcoinkernel.h.

◆ btck_NotifyFatalError

typedef void(* btck_NotifyFatalError) (void *user_data, const char *message, size_t message_len)

Definition at line 309 of file bitcoinkernel.h.

◆ btck_NotifyFlushError

typedef void(* btck_NotifyFlushError) (void *user_data, const char *message, size_t message_len)

Definition at line 308 of file bitcoinkernel.h.

◆ btck_NotifyHeaderTip

typedef void(* btck_NotifyHeaderTip) (void *user_data, btck_SynchronizationState state, int64_t height, int64_t timestamp, int presync)

Definition at line 304 of file bitcoinkernel.h.

◆ btck_NotifyProgress

typedef void(* btck_NotifyProgress) (void *user_data, const char *title, size_t title_len, int progress_percent, int resume_possible)

Definition at line 305 of file bitcoinkernel.h.

◆ btck_NotifyWarningSet

typedef void(* btck_NotifyWarningSet) (void *user_data, btck_Warning warning, const char *message, size_t message_len)

Definition at line 306 of file bitcoinkernel.h.

◆ btck_NotifyWarningUnset

typedef void(* btck_NotifyWarningUnset) (void *user_data, btck_Warning warning)

Definition at line 307 of file bitcoinkernel.h.

◆ btck_ScriptPubkey

Opaque data structure for holding a script pubkey.

Definition at line 114 of file bitcoinkernel.h.

◆ btck_ScriptVerificationFlags

typedef uint32_t btck_ScriptVerificationFlags

Script verification flags that may be composed with each other.

Definition at line 440 of file bitcoinkernel.h.

◆ btck_ScriptVerifyStatus

typedef uint8_t btck_ScriptVerifyStatus

A collection of status codes that may be issued by the script verify function.

Definition at line 432 of file bitcoinkernel.h.

◆ btck_SynchronizationState

typedef uint8_t btck_SynchronizationState

Current sync state passed to tip changed callbacks.

Definition at line 277 of file bitcoinkernel.h.

◆ btck_Transaction

Opaque data structure for holding a transaction.

Definition at line 109 of file bitcoinkernel.h.

◆ btck_TransactionInput

Opaque data structure for holding a transaction input.

Holds information on the btck_TransactionOutPoint held within.

Definition at line 265 of file bitcoinkernel.h.

◆ btck_TransactionOutPoint

Opaque data structure for holding a transaction out point.

Holds the txid and output index it is pointing to.

Definition at line 272 of file bitcoinkernel.h.

◆ btck_TransactionOutput

Opaque data structure for holding a transaction output.

Definition at line 119 of file bitcoinkernel.h.

◆ 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 243 of file bitcoinkernel.h.

◆ btck_Txid

typedef struct btck_Txid btck_Txid

Definition at line 274 of file bitcoinkernel.h.

◆ btck_ValidationInterfaceBlockChecked

typedef void(* btck_ValidationInterfaceBlockChecked) (void *user_data, btck_Block *block, const btck_BlockValidationState *state)

Function signatures for the validation interface.

Definition at line 314 of file bitcoinkernel.h.

◆ btck_ValidationInterfaceBlockConnected

typedef void(* btck_ValidationInterfaceBlockConnected) (void *user_data, btck_Block *block, const btck_BlockTreeEntry *entry)

Definition at line 316 of file bitcoinkernel.h.

◆ btck_ValidationInterfaceBlockDisconnected

typedef void(* btck_ValidationInterfaceBlockDisconnected) (void *user_data, btck_Block *block, const btck_BlockTreeEntry *entry)

Definition at line 317 of file bitcoinkernel.h.

◆ btck_ValidationInterfacePoWValidBlock

typedef void(* btck_ValidationInterfacePoWValidBlock) (void *user_data, btck_Block *block, const btck_BlockTreeEntry *entry)

Definition at line 315 of file bitcoinkernel.h.

◆ btck_ValidationMode

typedef uint8_t btck_ValidationMode

Whether a validated data structure is valid, invalid, or an error was encountered during processing.

Definition at line 328 of file bitcoinkernel.h.

◆ btck_Warning

typedef uint8_t btck_Warning

Possible warning types issued by validation.

Definition at line 283 of file bitcoinkernel.h.

◆ btck_WriteBytes

typedef int(* btck_WriteBytes) (const void *bytes, size_t size, void *userdata)

Function signature for serializing data.

Definition at line 322 of file bitcoinkernel.h.

Function Documentation

◆ btck_block_copy()

Copy a block.

Blocks are reference counted, so this just increments the reference count.

Parameters
[in]blockNon-null.
Returns
The copied block.

Definition at line 1050 of file bitcoinkernel.cpp.

◆ btck_block_count_transactions()

BITCOINKERNEL_API size_t BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_count_transactions ( const btck_Block block)

Count the number of transactions contained in a block.

Parameters
[in]blockNon-null.
Returns
The number of transactions in the block.

Definition at line 1055 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_block_create()

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.

Parameters
[in]raw_blockNon-null, serialized block.
[in]raw_block_lenLength of the serialized block.
Returns
The allocated block, or null on error.

Definition at line 1034 of file bitcoinkernel.cpp.

◆ btck_block_destroy()

BITCOINKERNEL_API int BITCOINKERNEL_API void btck_block_destroy ( btck_Block block)

Destroy the block.

Definition at line 1082 of file bitcoinkernel.cpp.

◆ btck_block_get_hash()

Calculate and return the hash of a block.

Parameters
[in]blockNon-null.
Returns
The block hash.

Definition at line 1077 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_block_get_transaction_at()

BITCOINKERNEL_API const btck_Transaction *BITCOINKERNEL_WARN_UNUSED_RESULT 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.

Parameters
[in]blockNon-null.
[in]transaction_indexThe index of the transaction to be retrieved.
Returns
The transaction.

Definition at line 1060 of file bitcoinkernel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ btck_block_hash_copy()

Copy a block hash.

Parameters
[in]block_hashNon-null.
Returns
The copied block hash.

Definition at line 1112 of file bitcoinkernel.cpp.

◆ btck_block_hash_create()

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 1107 of file bitcoinkernel.cpp.

◆ btck_block_hash_destroy()

BITCOINKERNEL_API void BITCOINKERNEL_API void btck_block_hash_destroy ( btck_BlockHash block_hash)

Destroy the block hash.

Definition at line 1127 of file bitcoinkernel.cpp.

◆ btck_block_hash_equals()

BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_hash_equals ( const btck_BlockHash hash1,
const btck_BlockHash hash2 
)

Check if two block hashes are equal.

Parameters
[in]hash1Non-null.
[in]hash2Non-null.
Returns
0 if the block hashes are not equal.

◆ btck_block_hash_to_bytes()

BITCOINKERNEL_API void btck_block_hash_to_bytes ( const btck_BlockHash block_hash,
unsigned char  output[32] 
)

Serializes the block hash to bytes.

Parameters
[in]block_hashNon-null.
[in]outputThe serialized block hash.

◆ btck_block_read()

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.

Parameters
[in]chainstate_managerNon-null.
[in]block_tree_entryNon-null.
Returns
The read out block, or null on error.

◆ btck_block_spent_outputs_copy()

Copy a block's spent outputs.

Parameters
[in]block_spent_outputsNon-null.
Returns
The copied block spent outputs.

Definition at line 1146 of file bitcoinkernel.cpp.

◆ btck_block_spent_outputs_count()

BITCOINKERNEL_API size_t BITCOINKERNEL_WARN_UNUSED_RESULT 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.

Parameters
[in]block_spent_outputsNon-null.
Returns
The number of transaction spent outputs data in the block spent outputs.

Definition at line 1151 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_block_spent_outputs_destroy()

BITCOINKERNEL_API void btck_block_spent_outputs_destroy ( btck_BlockSpentOutputs block_spent_outputs)

Destroy the block spent outputs.

Definition at line 1163 of file bitcoinkernel.cpp.

◆ btck_block_spent_outputs_get_transaction_spent_outputs_at()

BITCOINKERNEL_API const btck_TransactionSpentOutputs *BITCOINKERNEL_WARN_UNUSED_RESULT 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.

Parameters
[in]block_spent_outputsNon-null.
[in]transaction_spent_outputs_indexThe index of the transaction spent outputs within the block spent outputs.
Returns
A transaction spent outputs pointer.

Definition at line 1156 of file bitcoinkernel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ btck_block_spent_outputs_read()

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.

Parameters
[in]chainstate_managerNon-null.
[in]block_tree_entryNon-null.
Returns
The read out block spent outputs, or null on error.

◆ btck_block_to_bytes()

BITCOINKERNEL_API int 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.

Parameters
[in]blockNon-null.
[in]writerNon-null, callback to a write bytes function.
[in]user_dataHolds a user-defined opaque structure that will be passed back through the writer callback.
Returns
0 on success.

◆ btck_block_tree_entry_get_block_hash()

BITCOINKERNEL_API const btck_BlockHash *BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_tree_entry_get_block_hash ( const btck_BlockTreeEntry block_tree_entry)

Return the block hash associated with a block tree entry.

Parameters
[in]block_tree_entryNon-null.
Returns
The block hash.

Definition at line 1102 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_block_tree_entry_get_height()

BITCOINKERNEL_API int32_t BITCOINKERNEL_WARN_UNUSED_RESULT btck_block_tree_entry_get_height ( const btck_BlockTreeEntry block_tree_entry)

Return the height of a certain block tree entry.

Parameters
[in]block_tree_entryNon-null.
Returns
The block height.

Definition at line 1097 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_block_tree_entry_get_previous()

BITCOINKERNEL_API const btck_BlockTreeEntry *BITCOINKERNEL_WARN_UNUSED_RESULT 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.

Parameters
[in]block_tree_entryNon-null.
Returns
The previous block tree entry, or null on error or if the current block tree entry is the genesis block.

Definition at line 847 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_block_validation_state_get_block_validation_result()

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 block validation state pointer.

Definition at line 865 of file bitcoinkernel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ btck_block_validation_state_get_validation_mode()

BITCOINKERNEL_API btck_ValidationMode btck_block_validation_state_get_validation_mode ( const btck_BlockValidationState block_validation_state)

Returns the validation mode from an opaque block validation state pointer.

Definition at line 857 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_chain_contains()

BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT 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.

Parameters
[in]chainNon-null.
[in]block_tree_entryNon-null.
Returns
1 if the block_tree_entry is in the chain, 0 otherwise.

◆ btck_chain_get_by_height()

BITCOINKERNEL_API const btck_BlockTreeEntry *BITCOINKERNEL_WARN_UNUSED_RESULT btck_chain_get_by_height ( const btck_Chain chain,
int  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.

Parameters
[in]chainNon-null.
[in]block_heightHeight in the chain of the to be retrieved block tree entry.
Returns
The block tree entry at a certain height in the currently active chain, or null if the height is out of bounds.

Definition at line 1251 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_chain_get_genesis()

BITCOINKERNEL_API const btck_BlockTreeEntry *BITCOINKERNEL_WARN_UNUSED_RESULT btck_chain_get_genesis ( const btck_Chain chain)

Get the block tree entry of the genesis block.

Parameters
[in]chainNon-null.
Returns
The block tree entry of the genesis block, or null if the chain is empty.

Definition at line 1245 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_chain_get_height()

BITCOINKERNEL_API int32_t BITCOINKERNEL_WARN_UNUSED_RESULT btck_chain_get_height ( const btck_Chain chain)

Return the height of the tip of the chain.

Parameters
[in]chainNon-null.
Returns
The current height.

Definition at line 1239 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_chain_get_tip()

Get the block tree entry of the current chain tip.

Once returned, there is no guarantee that it remains in the active chain.

Parameters
[in]chainNon-null.
Returns
The block tree entry of the current tip, or null if the chain is empty.

Definition at line 1233 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_chain_parameters_copy()

BITCOINKERNEL_API btck_ChainParameters *BITCOINKERNEL_WARN_UNUSED_RESULT btck_chain_parameters_copy ( const btck_ChainParameters chain_parameters)

Copy the chain parameters.

Definition at line 780 of file bitcoinkernel.cpp.

◆ btck_chain_parameters_create()

BITCOINKERNEL_API btck_ChainParameters *BITCOINKERNEL_WARN_UNUSED_RESULT btck_chain_parameters_create ( const btck_ChainType  chain_type)

Creates a chain parameters struct with default parameters based on the passed in chain type.

Parameters
[in]chain_typeControls the chain parameters type created.
Returns
An allocated chain parameters opaque struct.

Definition at line 758 of file bitcoinkernel.cpp.

Here is the call graph for this function:

◆ btck_chain_parameters_destroy()

BITCOINKERNEL_API void btck_chain_parameters_destroy ( btck_ChainParameters chain_parameters)

Destroy the chain parameters.

Definition at line 785 of file bitcoinkernel.cpp.

◆ btck_chainstate_manager_create()

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.

Parameters
[in]chainstate_manager_optionsNon-null, created by btck_chainstate_manager_options_create.
Returns
The allocated chainstate manager, or null on error.

Definition at line 947 of file bitcoinkernel.cpp.

Here is the call graph for this function:

◆ btck_chainstate_manager_destroy()

BITCOINKERNEL_API const btck_BlockTreeEntry *BITCOINKERNEL_WARN_UNUSED_RESULT BITCOINKERNEL_API void btck_chainstate_manager_destroy ( btck_ChainstateManager chainstate_manager)

Destroy the chainstate manager.

Definition at line 1001 of file bitcoinkernel.cpp.

◆ btck_chainstate_manager_get_active_chain()

BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT BITCOINKERNEL_API const btck_Chain *BITCOINKERNEL_WARN_UNUSED_RESULT 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.

Parameters
[in]chainstate_managerNon-null.
Returns
The chain.

Definition at line 1228 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_chainstate_manager_get_block_tree_entry_by_hash()

BITCOINKERNEL_API const btck_BlockTreeEntry *BITCOINKERNEL_WARN_UNUSED_RESULT 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.

Parameters
[in]chainstate_managerNon-null.
[in]block_hashNon-null.
Returns
The block tree entry of the block with the passed in hash, or null if the block hash is not found.

◆ btck_chainstate_manager_import_blocks()

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.

Parameters
[in]chainstate_managerNon-null.
[in]block_file_paths_dataNullable, array of block files described by their full filesystem paths.
[in]block_file_paths_lensNullable, array containing the lengths of each of the paths.
[in]block_file_paths_data_lenLength of the block_file_paths_data and block_file_paths_len arrays.
Returns
0 if the import blocks call was completed successfully, non-zero otherwise.

Definition at line 1016 of file bitcoinkernel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ btck_chainstate_manager_options_create()

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.

Parameters
[in]contextNon-null, the created options and through it the chainstate manager will associate with this kernel context for the duration of their lifetimes.
[in]data_directoryNon-null, path string of the directory containing the chainstate data. If the directory does not exist yet, it will be created.
[in]blocks_directoryNon-null, path string of the directory containing the block data. If the directory does not exist yet, it will be created.
Returns
The allocated chainstate manager options, or null on error.

◆ btck_chainstate_manager_options_destroy()

BITCOINKERNEL_API void btck_chainstate_manager_options_destroy ( btck_ChainstateManagerOptions chainstate_manager_options)

Destroy the chainstate manager options.

Definition at line 911 of file bitcoinkernel.cpp.

◆ btck_chainstate_manager_options_set_wipe_dbs()

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.

Parameters
[in]chainstate_manager_optionsNon-null, created by btck_chainstate_manager_options_create.
[in]wipe_block_tree_dbSet wipe block tree db. Should only be 1 if wipe_chainstate_db is 1 too.
[in]wipe_chainstate_dbSet wipe chainstate db.
Returns
0 if the set was successful, non-zero if the set failed.

Definition at line 916 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_chainstate_manager_options_set_worker_threads_num()

BITCOINKERNEL_API btck_ChainstateManagerOptions *BITCOINKERNEL_WARN_UNUSED_RESULT 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.

Parameters
[in]chainstate_manager_optionsNon-null, options to be set.
[in]worker_threadsThe 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 905 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_chainstate_manager_options_update_block_tree_db_in_memory()

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.

Parameters
[in]chainstate_manager_optionsNon-null, created by btck_chainstate_manager_options_create.
[in]block_tree_db_in_memorySet block tree db in memory.

Definition at line 929 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_chainstate_manager_options_update_chainstate_db_in_memory()

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.

Parameters
[in]chainstate_manager_optionsNon-null, created by btck_chainstate_manager_options_create.
[in]chainstate_db_in_memorySet chainstate db in memory.

Definition at line 938 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_chainstate_manager_process_block()

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.

Parameters
[in]chainstate_managerNon-null.
[in]blockNon-null, block to be validated.
[out]new_blockNullable, 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.
Returns
0 if processing the block was successful. Will also return 0 for valid, but duplicate blocks.

◆ btck_coin_confirmation_height()

BITCOINKERNEL_API uint32_t BITCOINKERNEL_WARN_UNUSED_RESULT btck_coin_confirmation_height ( const btck_Coin coin)

Returns the block height where the transaction that created this coin was included in.

Parameters
[in]coinNon-null.
Returns
The block height of the coin.

Definition at line 1195 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_coin_copy()

Copy a coin.

Parameters
[in]coinNon-null.
Returns
The copied coin.

Definition at line 1190 of file bitcoinkernel.cpp.

◆ btck_coin_destroy()

BITCOINKERNEL_API void btck_coin_destroy ( btck_Coin coin)

Destroy the coin.

Definition at line 1210 of file bitcoinkernel.cpp.

◆ btck_coin_get_output()

Return the transaction output of a coin.

The returned pointer is unowned and only valid for the lifetime of the coin.

Parameters
[in]coinNon-null.
Returns
A transaction output pointer.

Definition at line 1205 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_coin_is_coinbase()

BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT btck_coin_is_coinbase ( const btck_Coin coin)

Returns whether the containing transaction was a coinbase.

Parameters
[in]coinNon-null.
Returns
1 if the coin is a coinbase coin, 0 otherwise.

Definition at line 1200 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_context_copy()

Copy the context.

Definition at line 832 of file bitcoinkernel.cpp.

◆ btck_context_create()

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.

Parameters
[in]context_optionsNullable, created by btck_context_options_create.
Returns
The allocated context, or null on error.

Definition at line 820 of file bitcoinkernel.cpp.

◆ btck_context_destroy()

BITCOINKERNEL_API void btck_context_destroy ( btck_Context context)

Destroy the context.

Definition at line 842 of file bitcoinkernel.cpp.

◆ btck_context_interrupt()

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.

Parameters
[in]contextNon-null.
Returns
0 if the interrupt was successful, non-zero otherwise.

Definition at line 837 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_context_options_create()

Creates an empty context options.

Definition at line 790 of file bitcoinkernel.cpp.

◆ btck_context_options_destroy()

BITCOINKERNEL_API void btck_context_options_destroy ( btck_ContextOptions context_options)

Destroy the context options.

Definition at line 815 of file bitcoinkernel.cpp.

◆ btck_context_options_set_chainparams()

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.

Parameters
[in]context_optionsNon-null, previously created by btck_context_options_create.
[in]chain_parametersIs set to the context options.

◆ btck_context_options_set_notifications()

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.

Parameters
[in]context_optionsNon-null, previously created by btck_context_options_create.
[in]notificationsIs set to the context options.

Definition at line 802 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_context_options_set_validation_interface()

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.

Parameters
[in]context_optionsNon-null, previously created with btck_context_options_create.
[in]validation_interface_callbacksThe callbacks used for passing validation information to the user.

Definition at line 809 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_logging_connection_create()

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.

Log messages produced before this function is first called are buffered and on calling this function are logged immediately.

Parameters
[in]log_callbackNon-null, function through which messages will be logged.
[in]user_dataNullable, 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_callbackNullable, function for freeing the user data.
Returns
A new kernel logging connection, or null on error.

Definition at line 744 of file bitcoinkernel.cpp.

◆ btck_logging_connection_destroy()

BITCOINKERNEL_API void btck_logging_connection_destroy ( btck_LoggingConnection logging_connection)

Stop logging and destroy the logging connection.

Definition at line 753 of file bitcoinkernel.cpp.

◆ btck_logging_disable()

BITCOINKERNEL_API void btck_logging_disable ( )

This disables the global internal logger.

No log messages will be buffered internally anymore once this is called and the buffer is cleared. This function should only be called once and is not thread or re-entry safe. Log messages will be buffered until this function is called, or a logging connection is created. This must not be called while a logging connection already exists.

Definition at line 739 of file bitcoinkernel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ btck_logging_disable_category()

BITCOINKERNEL_API void btck_logging_disable_category ( btck_LogCategory  category)

Disable a specific log category for the global internal logger.

This changes a global setting and will override settings for all existing btck_LoggingConnection instances.

Parameters
[in]categoryIf btck_LogCategory_ALL is chosen, all categories will be disabled.

Definition at line 734 of file bitcoinkernel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ btck_logging_enable_category()

BITCOINKERNEL_API void btck_logging_enable_category ( btck_LogCategory  category)

Enable a specific log category for the global internal logger.

This changes a global setting and will override settings for all existing btck_LoggingConnection instances.

Parameters
[in]categoryIf btck_LogCategory_ALL is chosen, all categories will be enabled.

Definition at line 729 of file bitcoinkernel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ btck_logging_set_level_category()

BITCOINKERNEL_API void btck_logging_set_level_category ( btck_LogCategory  category,
btck_LogLevel  level 
)

Set the log level of the global internal logger.

This does not enable the selected categories. Use btck_logging_enable_category to start logging from a specific, or all categories. This changes a global setting and will override settings for all existing btck_LoggingConnection instances.

Parameters
[in]categoryIf btck_LogCategory_ALL is chosen, sets both the global fallback log level used by all categories that don't have a specific level set, and also sets the log level for messages logged with the btck_LogCategory_ALL category itself. For any other category, sets a category-specific log level that overrides the global fallback for that category only.
[in]levelLog level at which the log category is set.

Definition at line 719 of file bitcoinkernel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ btck_logging_set_options()

BITCOINKERNEL_API void btck_logging_set_options ( const btck_LoggingOptions  options)

Set some options for the global internal logger.

This changes global settings and will override settings for all existing btck_LoggingConnection instances.

Parameters
[in]optionsSets formatting options of the log messages.

Definition at line 709 of file bitcoinkernel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ btck_script_pubkey_copy()

BITCOINKERNEL_API btck_ScriptPubkey *BITCOINKERNEL_WARN_UNUSED_RESULT btck_script_pubkey_copy ( const btck_ScriptPubkey script_pubkey)

Copy a script pubkey.

Parameters
[in]script_pubkeyNon-null.
Returns
The copied script pubkey.

Definition at line 569 of file bitcoinkernel.cpp.

◆ btck_script_pubkey_create()

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.

Parameters
[in]script_pubkeyNon-null.
[in]script_pubkey_lenLength of the script pubkey data.
Returns
The script pubkey.

Definition at line 557 of file bitcoinkernel.cpp.

◆ btck_script_pubkey_destroy()

BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT BITCOINKERNEL_API int BITCOINKERNEL_API void btck_script_pubkey_destroy ( btck_ScriptPubkey script_pubkey)

Destroy the script pubkey.

Definition at line 574 of file bitcoinkernel.cpp.

◆ btck_script_pubkey_to_bytes()

BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT BITCOINKERNEL_API int 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.

Parameters
[in]script_pubkeyNon-null.
[in]writerNon-null, callback to a write bytes function.
[in]user_dataHolds a user-defined opaque structure that will be passed back through the writer callback.
Returns
0 on success.

◆ btck_script_pubkey_verify()

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_TransactionOutput **  spent_outputs,
size_t  spent_outputs_len,
unsigned int  input_index,
unsigned int  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 spent outputs parameter is used to validate taproot transactions.

Parameters
[in]script_pubkeyNon-null, script pubkey to be spent.
[in]amountAmount of the script pubkey's associated output. May be zero if the witness flag is not set.
[in]tx_toNon-null, transaction spending the script_pubkey.
[in]spent_outputsNullable if the taproot flag is not set. Points to an array of outputs spent by the transaction.
[in]spent_outputs_lenLength of the spent_outputs array.
[in]input_indexIndex of the input in tx_to spending the script_pubkey.
[in]flagsBitfield of btck_ScriptVerificationFlags controlling validation constraints.
[out]statusNullable, will be set to an error code if the operation fails, or OK otherwise.
Returns
1 if the script is valid, 0 otherwise.

◆ btck_transaction_copy()

Copy a transaction.

Transactions are reference counted, so this just increments the reference count.

Parameters
[in]transactionNon-null.
Returns
The copied transaction.

Definition at line 536 of file bitcoinkernel.cpp.

◆ btck_transaction_count_inputs()

BITCOINKERNEL_API size_t BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_count_inputs ( const btck_Transaction transaction)

Get the number of inputs of a transaction.

Parameters
[in]transactionNon-null.
Returns
The number of inputs.

Definition at line 520 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_transaction_count_outputs()

BITCOINKERNEL_API int BITCOINKERNEL_API size_t BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_count_outputs ( const btck_Transaction transaction)

Get the number of outputs of a transaction.

Parameters
[in]transactionNon-null.
Returns
The number of outputs.

Definition at line 508 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_transaction_create()

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.

Parameters
[in]raw_transactionNon-null.
[in]raw_transaction_lenLength of the serialized transaction.
Returns
The transaction, or null on error.

Definition at line 498 of file bitcoinkernel.cpp.

◆ btck_transaction_destroy()

BITCOINKERNEL_API void btck_transaction_destroy ( btck_Transaction transaction)

Destroy the transaction.

Definition at line 552 of file bitcoinkernel.cpp.

◆ btck_transaction_get_input_at()

BITCOINKERNEL_API const btck_TransactionInput *BITCOINKERNEL_WARN_UNUSED_RESULT 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.

Parameters
[in]transactionNon-null.
[in]input_indexThe index of the transaction input to be retrieved.
Returns
The transaction input

Definition at line 525 of file bitcoinkernel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ btck_transaction_get_output_at()

BITCOINKERNEL_API const btck_TransactionOutput *BITCOINKERNEL_WARN_UNUSED_RESULT 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.

Parameters
[in]transactionNon-null.
[in]output_indexThe index of the transaction output to be retrieved.
Returns
The transaction output

Definition at line 513 of file bitcoinkernel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ btck_transaction_get_txid()

BITCOINKERNEL_API const btck_Txid *BITCOINKERNEL_WARN_UNUSED_RESULT 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.

Parameters
[in]transactionNon-null.
Returns
The txid.

Definition at line 531 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_transaction_input_copy()

BITCOINKERNEL_API btck_TransactionInput *BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_input_copy ( const btck_TransactionInput transaction_input)

Copy a transaction input.

Parameters
[in]transaction_inputNon-null.
Returns
The copied transaction input.

Definition at line 654 of file bitcoinkernel.cpp.

◆ btck_transaction_input_destroy()

BITCOINKERNEL_API void btck_transaction_input_destroy ( btck_TransactionInput transaction_input)

Destroy the transaction input.

Definition at line 664 of file bitcoinkernel.cpp.

◆ btck_transaction_input_get_out_point()

BITCOINKERNEL_API const btck_TransactionOutPoint *BITCOINKERNEL_WARN_UNUSED_RESULT 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.

Parameters
[in]transaction_inputNon-null.
Returns
The transaction out point.

Definition at line 659 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_transaction_out_point_copy()

BITCOINKERNEL_API btck_TransactionOutPoint *BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_out_point_copy ( const btck_TransactionOutPoint transaction_out_point)

Copy a transaction out point.

Parameters
[in]transaction_out_pointNon-null.
Returns
The copied transaction out point.

Definition at line 669 of file bitcoinkernel.cpp.

◆ btck_transaction_out_point_destroy()

BITCOINKERNEL_API void btck_transaction_out_point_destroy ( btck_TransactionOutPoint transaction_out_point)

Destroy the transaction out point.

Definition at line 684 of file bitcoinkernel.cpp.

◆ btck_transaction_out_point_get_index()

BITCOINKERNEL_API uint32_t BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_out_point_get_index ( const btck_TransactionOutPoint transaction_out_point)

Get the output position from the transaction out point.

Parameters
[in]transaction_out_pointNon-null.
Returns
The output index.

Definition at line 674 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_transaction_out_point_get_txid()

BITCOINKERNEL_API const btck_Txid *BITCOINKERNEL_WARN_UNUSED_RESULT 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.

Parameters
[in]transaction_out_pointNon-null.
Returns
The txid.

Definition at line 679 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_transaction_output_copy()

BITCOINKERNEL_API btck_TransactionOutput *BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_output_copy ( const btck_TransactionOutput transaction_output)

Copy a transaction output.

Parameters
[in]transaction_outputNon-null.
Returns
The copied transaction output.

Definition at line 584 of file bitcoinkernel.cpp.

◆ btck_transaction_output_create()

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.

Parameters
[in]script_pubkeyNon-null.
[in]amountThe amount associated with the script pubkey for this output.
Returns
The transaction output.

Definition at line 579 of file bitcoinkernel.cpp.

◆ btck_transaction_output_destroy()

BITCOINKERNEL_API void btck_transaction_output_destroy ( btck_TransactionOutput transaction_output)

Destroy the transaction output.

Definition at line 599 of file bitcoinkernel.cpp.

◆ btck_transaction_output_get_amount()

BITCOINKERNEL_API int64_t BITCOINKERNEL_WARN_UNUSED_RESULT btck_transaction_output_get_amount ( const btck_TransactionOutput transaction_output)

Get the amount in the output.

Parameters
[in]transaction_outputNon-null.
Returns
The amount.

Definition at line 594 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_transaction_output_get_script_pubkey()

BITCOINKERNEL_API const btck_ScriptPubkey *BITCOINKERNEL_WARN_UNUSED_RESULT 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.

Parameters
[in]transaction_outputNon-null.
Returns
The script pubkey.

Definition at line 589 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_transaction_spent_outputs_copy()

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.

Parameters
[in]transaction_spent_outputsNon-null.
Returns
The copied transaction spent outputs.

Definition at line 1168 of file bitcoinkernel.cpp.

◆ btck_transaction_spent_outputs_count()

BITCOINKERNEL_API size_t BITCOINKERNEL_WARN_UNUSED_RESULT 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.

Parameters
[in]transaction_spent_outputsNon-null
Returns
The number of spent transaction outputs for the transaction.

Definition at line 1173 of file bitcoinkernel.cpp.

Here is the caller graph for this function:

◆ btck_transaction_spent_outputs_destroy()

BITCOINKERNEL_API void btck_transaction_spent_outputs_destroy ( btck_TransactionSpentOutputs transaction_spent_outputs)

Destroy the transaction spent outputs.

Definition at line 1178 of file bitcoinkernel.cpp.

◆ btck_transaction_spent_outputs_get_coin_at()

BITCOINKERNEL_API const btck_Coin *BITCOINKERNEL_WARN_UNUSED_RESULT 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.

Parameters
[in]transaction_spent_outputsNon-null.
[in]coin_indexThe index of the to be retrieved coin within the transaction spent outputs.
Returns
A coin pointer.

Definition at line 1183 of file bitcoinkernel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ btck_transaction_to_bytes()

BITCOINKERNEL_API int 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.

Parameters
[in]transactionNon-null.
[in]writerNon-null, callback to a write bytes function.
[in]user_dataHolds a user-defined opaque structure that will be passed back through the writer callback.
Returns
0 on success.

◆ btck_txid_copy()

Copy a txid.

Parameters
[in]txidNon-null.
Returns
The copied txid.

Definition at line 689 of file bitcoinkernel.cpp.

◆ btck_txid_destroy()

Destroy the txid.

Definition at line 704 of file bitcoinkernel.cpp.

◆ btck_txid_equals()

BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT btck_txid_equals ( const btck_Txid txid1,
const btck_Txid txid2 
)

Check if two txids are equal.

Parameters
[in]txid1Non-null.
[in]txid2Non-null.
Returns
0 if the txid is not equal.

◆ btck_txid_to_bytes()

BITCOINKERNEL_API int BITCOINKERNEL_WARN_UNUSED_RESULT BITCOINKERNEL_API void btck_txid_to_bytes ( const btck_Txid txid,
unsigned char  output[32] 
)

Serializes the txid to bytes.

Parameters
[in]txidNon-null.
[out]outputThe serialized txid.