Language

Choose a language

/build/rpc / btc

gethdkeys

gethdkeys ( {"active_only":bool,"private":bool,...} ) List all BIP 32 HD keys in the wallet and which descriptors use them. Arguments: 1. options (json object, optional) Options object that can be used to pass named arguments, listed below. Named Arguments: active_only (boolean, optional, default=false) Show the keys for only active descriptors private (boolean, optional, default=false) Show private keys Result: [ (json array) { (json object) "xpub" : "str", (string) The extended public key "has_private" : true|false, (boolean) Whether the wallet has the private key for this xpub "xprv" : "str", (string, optional) The extended private key if "private" is true "descriptors" : [ (json array) Array of descriptor objects that use this HD key { (json object) "desc" : "str", (string) Descriptor string representation "active" : true|false (boolean) Whether this descriptor is currently used to generate new addresses }, ... ] }, ... ] Examples: > bitcoin-cli gethdkeys > curl --user myusername --data-binary '{"jsonrpc": "2.0", "id": "curltest", "method": "gethdkeys", "params": []}' -H 'content-type: application/json' http://127.0.0.1:8332/ > bitcoin-cli -named gethdkeys active_only=true private=true > curl --user myusername --data-binary '{"jsonrpc": "2.0", "id": "curltest", "method": "gethdkeys", "params": {"active_only":"true","private":"true"}}' -H 'content-type: application/json' http://127.0.0.1:8332/

Signature

gethdkeys(options?: object) → any

Code samples

curl --user "$RPC_USER:$RPC_PASS" \
  --data-binary '{"jsonrpc":"1.0","id":"docs","method":"gethdkeys","params":[{}]}' \
  -H 'content-type: text/plain;' \
  http://127.0.0.1:8332/

Parameters

NameTypeReq.Description
optionsobjectOptions object that can be used to pass named arguments, listed below. Named Arguments: active_only (boolean, optional, default=false) Show the keys for only active descriptors private (boolean, optional, default=false) Show private keys

Result

Type:  any

[ (json array) { (json object) "xpub" : "str", (string) The extended public key "has_private" : true|false, (boolean) Whether the wallet has the private key for this xpub "xprv" : "str", (string, optional) The extended private key if "private" is true "descriptors" : [ (json array) Array of descriptor objects that use this HD key { (json object) "desc" : "str", (string) Descriptor string representation "active" : true|false (boolean) Whether this descriptor is currently used to generate new addresses }, ... ] }, ... ]

Source: services/core-node/bcore/src/wallet/rpc/wallet.cpp:735

C++ symbol: gethdkeys