get_private_keys
The get_private_keys method provides unified offline private key export functionality, with optional HD support.
There are two export modes: iguana and hd. The mode to be used should match the MM2.json enable_hd configuration.
This method supports various coin protocols including UTXO-based coins (Bitcoin, Komodo, etc.), Ethereum-based tokens, Tendermint-based coins, and ZHTLC.
| Structure | Type | Description |
|---|---|---|
| coins | array of strings | array of coin tickers to export private keys for |
| mode | string (optional) | export mode: "hd" for HD wallet export, "iguana" for legacy Iguana format. Defaults based on MM2.json config |
| start_index | integer (optional) | "mode": hd only. starting address index for HD mode (default: 0). |
| end_index | integer (optional) | "mode": hd only. ending address index for HD mode (default: start_index + 10). |
| account_index | integer (optional) | "mode": hd only. account index for HD derivation path (default: 0). |
The response format depends on the mode value:
| Structure | Type | Description |
|---|---|---|
| result | array of HdCoinKeys | array of coin key information with HD derivation data |
| Structure | Type | Description |
|---|---|---|
| result | array of IguanaKeysInfo | array of coin key information in Iguana format |
For detailed information about the structure fields and examples for different coin types (UTXO, ETH, ZHTLC, Tendermint), refer to the HdKeysInfo and IguanaKeysInfo common structures.
- This method replaces the legacy
show_priv_key, and works with coins that are not currently activated in MM2 (as long as they are in thecoinsconfiguration). - For HD mode, the maximum range is 100 addresses per request to prevent excessive resource usage. Make multiple requests if you need more addresses.
- For HD mode, keys from any account or address index are available for any coin which includes a
derivation_pathvalue in thecoinsconfiguration. - ZHTLC coins like ARRR include additional
viewing_keyfield in HD mode responses for enhanced privacy features.
POST
get_private_keys{
"userpass": "RPC_UserP@SSW0RD",
"mmrpc": "2.0",
"method": "get_private_keys",
"params": {
"mode": "hd",
"coins": [
"KMD",
"ETH",
"ARRR",
"ATOM",
"LTC-segwit"
],
"start_index": 0,
"end_index": 1,
"account_index": 0
}
}
POST
get_private_keys{
"userpass": "RPC_UserP@SSW0RD",
"method": "get_private_keys",
"coins": [
"KMD",
"ETH",
"ARRR",
"ATOM",
"LTC-segwit"
],
"mode": "iguana"
}
| Error Type | Description |
|---|---|
| HdRangeTooLarge | end_index must not be > 100 higher than start_index |
| InvalidHdRange | start_indexmust be ≤ end_index |
| InvalidRequest | start_index, end_index or account_index value must not be negative |
| KeyDerivationFailed | Many causes, see examples below for more information |
| CoinConfigNotFound | Requested coin does not exist in coins configuration |
| InvalidParametersForMode | HD-specific parameters provided when using Iguana mode |