HD Wallets Overview
Hierarchical Deterministic (HD) Wallets are different to other wallets, as they use a key pair management system that allows generating multiple new addresses from a single seed phrase or private key.
Hierarchical
refers to the structure of HD wallets, which resembles a tree, where parent keys can produce children keys, which can produce grandchildren keys, and so on, all from the same root seed.
Deterministic
means that the addresses generated in this tree will always be the same for the same root seed phrase.
HD wallets offer several advantages over traditional wallets:
- Convenience: HD wallets allow users to generate multiple public and private keys from a single seed phrase, making it easier to manage multiple addresses in one place.
- Privacy: HD wallets can generate new addresses for each transaction, making it more difficult for malicious parties to track a user’s transaction history.
- Access Control: A user who controls the root seed can create new addresses & keypairs which can be shared with a 3rd party, providing limited or regulated access to funds held under specific pairs.
To use HD wallet functionality with the Komodo DeFi Framework API, you must include "enable_hd":true
in your MM2.json
file.
Hardware wallets like Trezor are always in HD mode, and this parameter must to be set to true
.
In some cases, the methods used to interact with HD wallets are the same as those used with legacy wallets. However, there are some differences, which are detailed in the links below.
- Initialise connection with your Trezor with task::init_trezor::init
- Check the status of the connecton with task::init_trezor::status
- Cancel authentication process with task::init_trezor::cancel
- Authenticate using PIN or phrase with task::init_trezor::user_action
These methods (and others with a task::
prefix) will be linked to a numeric
task_id
value which is used to query the status or outcome of the task.
As HD mode activation performs address scanning to return addresses and balances for enabled accounts, we use task
methods because fetching this data can take some time.
- Use task::enable_utxo::init for UTXO coins like KMD, BTC and DOGE.
- Check the activation status with task::enable_utxo::status
- Authenticate the activation with task::enable_utxo::user_action (hardware wallet only)
- Use task::enable_qtum::init for QTUM Ecosystem coins.
- Check the activation status with task::enable_qtum::status
- Authenticate the activation with task::enable_qtum::user_action (hardware wallet only)
When using the activation methods with a Trezor, "priv_key_policy": "Trezor"
needs to be included in the request.
- Prepare a transaction with withdraw (v2)
- Broadcast the transaction with send_raw_transaction
- Prepare a transaction with task::withdraw::init
- Check the status of the transaction preparation with task::withdraw::status
- Cancel the transaction preparation with task::withdraw::cancel
- Initialise the balance request with task::account_balance::init
- Check the status of the balance request with task::account_balance::status
- Use get_new_address to generate a new address
- Transaction history using an
account_id
my_tx_history - Transaction history using an
address_id
my_tx_history