BTC
Last updated
Last updated
The Bitcoin SDK provides an interface to interact with Bitcoin blockchains using SegWit (P2WPKH) transactions. It supports wallet connectivity, transaction preparation, and balance checking, using the bitcoinjs-lib library for core functionality.
To generate new Bitcoin WIF (Wallet Import Format) private keys for P2WPKH wallets, you can use the following tools:
(testnet)
For testing process, you can use following links to get token on the testnet
Import the SDK and create a new instance:
Connect your wallet using a private key in WIF format:
You can view the connected wallet’s address using the getAddress
method:
Prepare a signed transaction to transfer BTC using preparePay
method:
The signedTx
is a hex-encoded signed transaction ready for use in a DEMOS transaction.
You can create multiple Bitcoin transfer payloads by using the preparePays
method as shown:
The signedTxs
is an array of hex-encoded signed transaction payloads.
You can check the balance of the connected wallet, including change addresses as shown: