Skip to Content
Hardware

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

Optional common params

Single address

  • path - required string | Array<number> SDK minimum length is 1. read more
  • showOnOneKey - optional boolean Whether to display the address on the device. Defaults to true.
  • coin - optional string determines network definition specified in coins.json  file. Coin shortcut, name or label can be used. If coin is not set API will try to get network definition from path.
  • multisig - optional MultisigRedeemScriptType, redeem script information (multisig addresses only)
  • scriptType - optional InputScriptType, address script type

Multiple addresses

  • bundle - array of objects with path, showOnOneKey, coin fields

Get different types of addresses

Different BTC address types require different derivation path parameters.

TypePathEg.
Legacy BIP44m/44’/0’/x’/x/xIt starts with a “1” and consists of 26 to 35 characters
Nested SegWit BIP49m/49’/0’/x’/x/xIt starts with a “3” and consists of 26 to 35 characters
Native SegWit BIP84m/84’/0’/x’/x/xMainnet starts with bc1q; testnet starts with tb1q
Taproot BIP86m/86’/0’/x’/x/xMainnet 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