BTC
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.Wallet setup
To generate new Bitcoin WIF (Wallet Import Format) private keys for P2WPKH wallets, you can use the following tools:- Bitcoin Tools (testnet)
- Bitaddress.org
Get tokens on the testnet
For testing process, you can use following links to get token on the testnetInitialization
Import the SDK and create a new instance:Wallet connect
Connect your wallet using a private key in WIF format:getAddress method:
Create payload for the token transfer
Prepare a signed transaction to transfer BTC usingpreparePay method:
signedTx is a hex-encoded signed transaction ready for use in a DEMOS transaction.
Create payload for the multiple transfers
You can create multiple Bitcoin transfer payloads by using thepreparePays method as shown:
signedTxs is an array of hex-encoded signed transaction payloads.