/// <summary> /// Recover an existing Bitcoin wallet /// </summary> public static string RecoverWallet(string mnemonicString, string password) { string walletFilePath = GetWalletFilePath(_walletFileName); /// Make sure wallet exists and passphrase is valid Assertion.AssertWalletNotExists(_walletFilePath); Assertion.AssertCorrectMnemonicFormat(mnemonicString); /// Initiate recovering var mnemonic = new Mnemonic(mnemonicString); Safe safe = Safe.Recover(mnemonic, password, _walletFilePath, Config.Network); /// If no exception thrown the wallet is successfully recovered. return($"Wallet {_walletFileName} is successfully recovered."); }