hBK Smart Contract
Last updated
Was this helpful?
Was this helpful?
struct UTXO {
bytes32 txId; // Transaction ID
uint256 index; // Index of the UTXO
uint256 value; // Value in satoshis
bytes scriptPubKey; // Script public key
}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
}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
}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
}struct SpentDetail {
bytes32 spendingTxId; // Transaction ID of the spending transaction
uint256 inputIndex; // Index of the input in the spending transaction
}struct BitcoinHeader {
uint32 height; // Block height
bytes32 blockHash; // Block hash
uint32 version; // Version
bytes32 previousBlockHash; // Previous block hash
bytes32 merkleRoot; // Merkle root
uint32 timestamp; // Timestamp
uint32 bits; // Bits
uint32 nonce; // Nonce
}interface IBitcoinKit {
function getUTXOsForBitcoinAddress(string calldata btcAddress, uint256 pageNumber, uint256 pageSize) external view returns (UTXO[] memory);
function getTxConfirmations(bytes32 txId) external view returns (uint32 confirmations);
function getBitcoinAddressBalance(string calldata btcAddress) external view returns (uint256 balance);
function getTransactionByTxId(bytes32 txId) external view returns (Transaction memory);
function getTransactionInputsByTxId(bytes32 txId) external view returns (Input[] memory);
function getTransactionOutputsByTxId(bytes32 txId) external view returns (Output[] memory);
function getLastHeader() external view returns (BitcoinHeader memory);
function getHeaderN(uint32 height) external view returns (BitcoinHeader memory);
}function getBitcoinAddressBalance(string calldata btcAddress) public view returns (uint256 balance)function getUTXOsForBitcoinAddress(string calldata btcAddress, uint256 pageNumber, uint256 pageSize) public view returns (UTXO[] memory)function getTransactionByTxId(bytes32 txId) external view returns (Transaction memory);function getTxConfirmations(bytes32 txId) public view returns (uint32 confirmations)function getLastHeader() public view returns (BitcoinHeader memory)function getHeaderN(uint32 height) public view returns (BitcoinHeader memory)