On this page

latest contributor to this doc

Last Edit:

@gcharang↗

Hierarchical Deterministic Address Management

A hierarchical-deterministic (HD) wallet generates a new key pair from a master key pair, allowing for multiple addresses to be generated from the same seed so that change from transactions go to a previously unused address, enhancing privacy and security. The hierarchical structure resembles that of a tree, with the master key β€œdetermining” the key pairs that follow it in the hierarchy. If you have activated a coin with the task::enable_utxo::init or task::enable_qtum::init and used the "priv_key_policy": "Trezor" parameter, you can use the methods below to generate new addresses.

If we don't already have too many unused addresses, we can use the get_new_address method to generate a new address. The generated address will be shown in account_balance and init_account_balance RPCs and on the next coin activation.

ParameterTypeDescription
coinstringThe ticker of the coin you want to get a new address for
account_idintegerGenerally this will be 0 unless you have multiple accounts registered on your Trezor
chainstringInternal, or External. Defaults to External. External is used for addresses that are intended to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used to return the leftover change from a transaction.
gap_limitintegerOptional. The maximum number of empty addresses in a row. Defaults to the value provided on activation or 20 if no value was provided

ParameterTypeDescription
new_addressobjectA standard NewAddressInfo object.

Some reasons you might not be able to get a new address are:

  • EmptyAddressesLimitReached - Last gap_limit addresses are still unused.
  • AddressLimitReached - Addresses limit reached. Currently, the limit is 2^31

POST
get_new_address
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "method": "get_new_address",
  "params": {
    "coin": "DOC",
    "account_id": 0,
    "chain": "External",
    "gap_limit": 20
  }
}

ParameterTypeDescription
coinstringThe ticker of the coin you want to scan addresses for
account_idintegerOptional, HD wallets only. Generally this will be 0 unless you have multiple accounts registered on your HD wallet
gap_limitintegerOptional. The maximum number of empty addresses in a row. Defaults to the value provided on activation or 20 if no value was provided

ParameterTypeDescription
task_idintegerAn identifying number which is used to query task status.

POST
get_new_address
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "method": "task::scan_for_new_addresses::init",
  "params": {
    "coin": "DGB",
    "account_index": 0,
    "gap_limit": 20
  }
}

Use the task::scan_for_new_addresses::status method to query the status of a HD address scanning task.

ParameterTypeDescription
task_idintegerThe identifying number returned when initiating the withdrawal process.
forget_if_finishedbooleanIf false, will return final response for completed tasks. Optional, defaults to true.

ParameterTypeDescription
statusstringStatus of the task. Ok, InProgress or Error.
detailsstring or objectOnce complete, a standard ScanAddressesInfo object.

POST
get_new_address
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "method": "task::scan_for_new_addresses::status",
  "params": {
    "task_id": 3
  }
}