btcGetPublicKey
Bitcoin: get public key
Retrieves the BIP32 extended public key derived from the given BIP32 path. The user is asked to confirm the export on Ukey Wallet.
const result = await HardwareSDK.btcGetPublicKey(connectId, deviceId, params);
Params
Exporting single public key
path- requiredstring | Array<number>minimum length is1. read moreshowOnUKey- optionalbooleandetermines whether the public key will be displayed on the device. Default istrue.coin- optionalstringdetermines the network definition specified in the coins.json file. Coinshortcut,name, orlabelcan be used. Ifcoinis not set, the API will try to get the network definition frompath.scriptType- optionalInputScriptTypeaddress script type
Exporting bundle of public keys
bundle-Arrayof objects withpathandcoinfields
Example
Return the public key of the fourth bitcoin account:
HardwareSDK.btcGetPublicKey(connectId, deviceId, {
path: "m/49'/0'/3'",
coin: "btc",
});
Return a bundle of public keys for multiple bitcoin accounts:
HardwareSDK.btcGetPublicKey(connectId, deviceId, {
bundle: [
{ path: "m/49'/0'/7'" }, // account 8
{ path: "m/49'/0'/8'" }, // account 9
{ path: "m/49'/0'/9'" }, // account 10
],
});
Result
Result with only one public key
{
success: true,
payload: {
path: Array<number>, // hardened path
xpub: string, // xpub in legacy format
xpubSegwit?: string, // optional for segwit accounts: xpub in segwit format
chainCode: string, // BIP32 serialization format
childNum: number, // BIP32 serialization format
publicKey: string, // BIP32 serialization format
fingerprint: number, // BIP32 serialization format
depth: number, // BIP32 serialization format
}
}
Read more about BIP32 serialization format
Result with a bundle of public keys in the same order as the request
{
success: true,
payload: [
{ path, serializedPath, xpub, xpubSegwit?, chainCode, childNum, publicKey, fingerprint, depth }, // account 8
{ path, serializedPath, xpub, xpubSegwit?, chainCode, childNum, publicKey, fingerprint, depth }, // account 9
{ path, serializedPath, xpub, xpubSegwit?, chainCode, childNum, publicKey, fingerprint, depth } // account 10
]
}
Error
{
success: false,
payload: {
error: string, // error message
code: number // error code
}
}