The Hemi Bitcoin Kit smart contract provides utilities for interacting with Bitcoin data on the Hemi blockchain.
It includes methods to retrieve Bitcoin address balances, UTXOs, transaction details, and block headers.
The contract leverages hVM's new precompiles to perform Bitcoin-related queries.
Latest hBK release on Hemi testnet:
🚧 Phase 0 - Essentials
This initial phase is focused on core Bitcoin protocol data:
Script/Address Balances
UTXO Set
Full Transactions w/ Output Availability
Transaction Confirmations
BTC Headers (Last and N)
🏗️ Struct Definitions
UTXO
Represents an unspent transaction output (UTXO).
struct UTXO {
bytes32 txId; // Transaction ID
uint256 index; // Index of the UTXO
uint256 value; // Value in satoshis
bytes scriptPubKey; // Script public key
}
Transaction
Represents a Bitcoin transaction.
struct Transaction {
bytes32 containingBlockHash; // Hash of the containing block
uint256 transactionVersion; // Transaction version
uint256 size; // Transaction size
uint256 vSize; // Virtual size of the transaction
uint256 lockTime; // Lock time
Input[] inputs; // Array of inputs
Output[] outputs; // Array of outputs
uint256 totalInputs; // Total number of inputs in the original transaction
uint256 totalOutputs; // Total number of outputs in the original transaction
bool containsAllInputs; // Indicates if all inputs are contained
bool containsAllOutputs; // Indicates if all outputs are contained
}
Input
Represents a Bitcoin transaction input.
struct Input {
uint256 inValue; // Value spent by the input in satoshis
bytes32 inputTxId; // Transaction ID of the input source
uint256 sourceIndex; // Index of the input in its transaction
bytes scriptSig; // Script signature
uint256 sequence; // Sequence number
uint256 fullScriptSigLength; // Full length of the script signature
bool containsFullScriptSig; // Indicates if the full script signature is contained
}
Output
Represents a Bitcoin transaction output.
struct Output {
uint256 outValue; // Value of the output in satoshis
bytes script; // Output script
string outputAddress; // Output address
bool isOpReturn; // Indicates if the output is an OP_RETURN output
bytes opReturnData; // Data contained in the OP_RETURN output
bool isSpent; // Indicates if the output is spent
uint256 fullScriptLength; // Full length of the output script
bool containsFullScript; // Indicates if the full output script is contained
SpentDetail spentDetail; // Details of the spent output
}
SpentDetail
Represents details of a spent output.
struct SpentDetail {
bytes32 spendingTxId; // Transaction ID of the spending transaction
uint256 inputIndex; // Index of the input in the spending transaction
}