Skip to Content
ハードウェア
このページの内容

btcGetPublicKey

Bitcoin: 公開鍵を取得

指定パスから導出した公開鍵を返します。showOnOneKey を使用すると、デバイス上での確認を要求できます。

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

パラメーター

任意の共通パラメーター

単一の公開鍵

  • path - 必須 string | Array<number> SDK の最小長は 1. 詳細を読む
  • showOnOneKey - 任意 boolean 公開鍵をデバイスに表示するかどうか。デフォルトは true.
  • coin - 任意 string coins.json ファイルで指定されたネットワーク定義を決定します。コインの shortcut, name または label を使用できます。coin が設定されていない場合、API は path からネットワーク定義の取得を試みます。
  • scriptType - 任意 InputScriptType、アドレスのスクリプトタイプ

複数の公開鍵

  • bundle - path, coin フィールドを持つオブジェクトの配列

例

5 番目の bitcoin アカウントの公開鍵を返します:

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

複数の bitcoin アカウントの公開鍵をまとめて返します:

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 ] });

結果

単一公開鍵のレスポンス

{ 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, }, } }

BIP32 のシリアライズ形式について詳しく読む 

公開鍵のバッチレスポンス

{ 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 ] }

エラー

{ success: false, payload: { error: string, // error message code?: string | number // error code } }
最終更新日