On this page
btcGetAddress
Bitcoin: get address
Derives and returns the address at the specified path. When showOnOneKey is true, the user must confirm the address on the device.
const result = await HardwareSDK.btcGetAddress(connectId, deviceId, params);Params
Single address
path- requiredstring | Array<number>SDK minimum length is1. read moreshowOnOneKey- optionalbooleanWhether to display the address on the device. Defaults totrue.coin- optionalstringdetermines network definition specified in coins.json file. Coinshortcut,nameorlabelcan be used. Ifcoinis not set API will try to get network definition frompath.multisig- optional MultisigRedeemScriptType, redeem script information (multisig addresses only)scriptType- optional InputScriptType, address script type
Multiple addresses
bundle- array of objects withpath,showOnOneKey,coinfields
Get different types of addresses
Different BTC address types require different derivation path parameters.
| Type | Path | Eg. |
|---|---|---|
| Legacy BIP44 | m/44’/0’/x’/x/x | It starts with a “1” and consists of 26 to 35 characters |
| Nested SegWit BIP49 | m/49’/0’/x’/x/x | It starts with a “3” and consists of 26 to 35 characters |
| Native SegWit BIP84 | m/84’/0’/x’/x/x | Mainnet starts with bc1q; testnet starts with tb1q |
| Taproot BIP86 | m/86’/0’/x’/x/x | Mainnet starts with bc1p; testnet starts with tb1p |
Example
Display third address of first bitcoin account:
HardwareSDK.btcGetAddress(connectId, deviceId, {
path: "m/49'/0'/0'/0/2",
coin: "btc"
});Return a bundle of addresses from first bitcoin account without displaying them on the device:
HardwareSDK.btcGetAddress(connectId, deviceId, {
bundle: [
{ path: "m/49'/0'/0'/0/0", showOnOneKey: false }, // address 1
{ path: "m/49'/0'/0'/0/1", showOnOneKey: false }, // address 2
{ path: "m/49'/0'/0'/0/2", showOnOneKey: false } // address 3
]
});Result
Single-address response
{
success: true,
payload: {
address: string, // displayed address
path: string // serialized BIP32 path
}
}Batch address response
{
success: true,
payload: [
{ address: string, path: string }, // address 1
{ address: string, path: string }, // address 2
{ address: string, path: string }, // address 3
]
}Error
{
success: false,
payload: {
error: string, // error message
code?: string | number // error code
}
}Last updated on