Creates a new Bitcoin chain instance
Configuration parameters
Network identifier (mainnet/testnet)
Instance of the chain signature contract for MPC operations
Bitcoin RPC adapter for network interactions
Static
toConverts satoshis to BTC
Amount in satoshis
Amount in BTC
Static
toConverts BTC to satoshis
Amount in BTC
Amount in satoshis (rounded)
Creates a Partially Signed Bitcoin Transaction (PSBT)
Parameters for creating the PSBT
Transaction request containing inputs and outputs
Created PSBT instance
Gets the native token balance and decimals for a given address
The address to check
Promise resolving to an object containing: - balance: The balance as a bigint, in the chain's base units - decimals: The number of decimals used to format the balance
Uses Sig Network Key Derivation Function to derive the address and public key. from a signer ID and string path.
The id/address of the account requesting signature
The string path used to derive the key
Promise resolving to the derived address and public key
Serializes an unsigned transaction to a string format. This is useful for storing or transmitting the transaction.
The unsigned transaction to serialize
The serialized transaction string
Deserializes a transaction string back into an unsigned transaction object. This reverses the serialization done by serializeTransaction().
The serialized transaction string
The deserialized unsigned transaction
Prepares a transaction for Sig Network MPC signing by creating the necessary payloads. This method handles chain-specific transaction preparation including:
The transaction request containing parameters like recipient, amount, etc.
Promise resolving to an object containing: - transaction: The unsigned transaction - hashesToSign: Array of payloads to be signed by MPC. The order of these payloads must match the order of signatures provided to finalizeTransactionSigning()
Adds Sig Network MPC-generated signatures to an unsigned transaction.
Parameters for adding signatures
The unsigned transaction to add signatures to
Array of RSV signatures generated through MPC. Must be in the same order as the payloads returned by prepareTransactionForSigning()
The serialized signed transaction ready for broadcast
Broadcasts a signed transaction to the network.
The serialized signed transaction
Promise resolving to an object containing the transaction hash/ID
Implementation of the ChainAdapter interface for Bitcoin network. Handles interactions with both Bitcoin mainnet and testnet, supporting P2WPKH transactions.