MCPcopy Create free account
hub / github.com/LUX-Core/lux / dumphdinfo

Function dumphdinfo

src/rpcdump.cpp:565–607  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

563}
564
565UniValue dumphdinfo(const UniValue& params, bool fHelp)
566{
567 if (!EnsureWalletIsAvailable(fHelp))
568 return NullUniValue;
569
570 if (fHelp || params.size() != 0)
571 throw runtime_error(
572 "dumphdinfo\n"
573 "Returns an object containing sensitive private info about this HD wallet.\n"
574 "\nResult:\n"
575 "{\n"
576 " \"hdseed\": \"seed\", (string) The HD seed (bip32, in hex)\n"
577 " \"mnemonic\": \"words\", (string) The mnemonic for this HD wallet (bip39, english words) \n"
578 " \"mnemonicpassphrase\": \"passphrase\", (string) The mnemonic passphrase for this HD wallet (bip39)\n"
579 "}\n"
580 "\nExamples:\n"
581 + HelpExampleCli("dumphdinfo", "")
582 + HelpExampleRpc("dumphdinfo", "")
583 );
584
585 LOCK(pwalletMain->cs_wallet);
586
587 EnsureWalletIsUnlocked();
588
589 // add the base58check encoded extended master if the wallet uses HD
590 CHDChain hdChainCurrent;
591 if (!pwalletMain->GetHDChain(hdChainCurrent))
592 throw JSONRPCError(RPC_WALLET_ERROR, "This wallet is not an HD wallet.");
593
594 if (!pwalletMain->GetDecryptedHDChain(hdChainCurrent))
595 throw JSONRPCError(RPC_INTERNAL_ERROR, "Cannot decrypt HD seed");
596
597 SecureString ssMnemonic;
598 SecureString ssMnemonicPassphrase;
599 hdChainCurrent.GetMnemonic(ssMnemonic, ssMnemonicPassphrase);
600
601 UniValue obj(UniValue::VOBJ);
602 obj.push_back(Pair("hdseed", HexStr(hdChainCurrent.GetSeed())));
603 obj.push_back(Pair("mnemonic", ssMnemonic.c_str()));
604 obj.push_back(Pair("mnemonicpassphrase", ssMnemonicPassphrase.c_str()));
605
606 return obj;
607}
608
609
610UniValue dumpwallet(const UniValue& params, bool fHelp)

Callers

nothing calls this directly

Calls 13

EnsureWalletIsAvailableFunction · 0.85
HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
EnsureWalletIsUnlockedFunction · 0.85
JSONRPCErrorFunction · 0.85
PairFunction · 0.85
HexStrFunction · 0.85
GetDecryptedHDChainMethod · 0.80
GetMnemonicMethod · 0.80
sizeMethod · 0.45
GetHDChainMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected