Skip to Content
Hardware

btcGetPublicKey

Bitcoin: get public key

Returns the public key derived from the specified path. Use showOnOneKey to request confirmation on the device.

const result = await HardwareSDK.btcGetPublicKey(connectId, deviceId, params);

Params

Optional common params

Single public key

  • path - required string | Array<number> SDK minimum length is 1. read more
  • showOnOneKey - optional boolean Whether to display the public key 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.
  • scriptType - optional InputScriptType, address script type

Multiple public keys

  • bundle - array of objects with path, coin fields

Example

Return the public key for fifth bitcoin account:

HardwareSDK.btcGetPublicKey(connectId, deviceId, { path: "m/49'/0'/4'", coin: "btc" });

Return a bundle of public keys for multiple bitcoin accounts:

HardwareSDK.btcGetPublicKey(connectId, deviceId, { bundle: [ { path: "m/49'/0'/0'" }, // account 1 { path: "m/49'/0'/1'" }, // account 2 { path: "m/49'/0'/2'" } // account 3 ] });

Result

Single-public-key response

{ success: true, payload: { path: string, // serialized BIP32 path xpub: string, // xpub in legacy format xpubSegwit?: string, // optional for segwit accounts: xpub in segwit format root_fingerprint?: number, node: { depth: number, fingerprint: number, child_num: number, chain_code: string, public_key: string, }, } }

Read more about BIP32 serialization format 

Batch public-key response

{ success: true, payload: [ { path, xpub, xpubSegwit, root_fingerprint, node }, // account 1 { path, xpub, xpubSegwit, root_fingerprint, node }, // account 2 { path, xpub, xpubSegwit, root_fingerprint, node } // account 3 ] }

Error

{ success: false, payload: { error: string, // error message code?: string | number // error code } }
Last updated on