public void CanGenerateValidPrivateKey() { var network = Network.Main; var generator = new WalletGenerator(network); var generatedWallet = generator.Generate(); var key = Key.Parse(generatedWallet.PrivateKey, network); var addressFromKey = key.PubKey.WitHash.ScriptPubKey.Hash.GetAddress(network).ToString(); Assert.True(generatedWallet.Address == addressFromKey); Assert.True(generatedWallet.PubKey == key.PubKey.ToHex()); Assert.True(generatedWallet.PrivateKey == key.ToString(network)); }
public void CanGenerateValidPrivateKey() { PrepareNetworks.EnsureLiteCoinPrepared(); var network = Network.TestNet; var generator = new WalletGenerator(network); var generatedWallet = generator.Generate(); var key = Key.Parse(generatedWallet.PrivateKey, network); var addressFromKey = key.PubKey.GetAddress(network).ToString(); var btcAddress = BitcoinAddress.Create(generatedWallet.Address, network); Assert.True(generatedWallet.Address == addressFromKey); Assert.True(generatedWallet.Address == btcAddress.ToString()); Assert.True(generatedWallet.PrivateKey == key.ToString(network)); }