public void ShouldGenerateDepositAddress() { IHDWallet <EthereumWallet> hdWallet = new EthereumHDWallet(mnemonic, ""); var seed = ((HdWalletBase)hdWallet).BIP39Seed; Assert.AreEqual("ba78b733ffe929e400f844751a48dded5ebc7c62635a1590e97b066e3b9e8b890741602a69279c45ed5d17dfd6e8703e3c575de4ea4712868df5f1997e2b97b2", seed); var walletDeposit = hdWallet.GetAccount(0).GetExternalWallet(0); var publicKey = walletDeposit.PublicKey; var depositAddress = walletDeposit.Address; Assert.AreEqual(expected: "0xA2ae76fb87C154580a034c116115cE39441Add6F", actual: depositAddress); Console.WriteLine($"Public key[0]: {publicKey.ToHex()}"); walletDeposit = hdWallet.GetAccount(0).GetExternalWallet(1); publicKey = walletDeposit.PublicKey; depositAddress = walletDeposit.Address; Assert.AreEqual(expected: "0x95820f30d528a41AC753D44702c3073b5Bdc806c", actual: depositAddress); Console.WriteLine($"Public key[1]: {publicKey.ToHex()}"); walletDeposit = hdWallet.GetAccount(0).GetExternalWallet(2); publicKey = walletDeposit.PublicKey; depositAddress = walletDeposit.Address; Assert.AreEqual(expected: "0xCa32f209805C851a4c7D964Dcb7D82F66048F207", actual: depositAddress); Console.WriteLine($"Public key[2]: {publicKey.ToHex()}"); }
public void ShouldGenerateExtendedPrivateKey() { var privateKey = "xprv9y4J1KoATgJXvDA4qjyZKnfHFR1SEWjYS8qufHbALT9tNmjcZ8LKrmYgqgdgAijM35kWT9KGccPChj1qvWsE94XgJQRKk6rykmgQVfsjDh4"; var hdWallet = EthereumHDWallet.GetAccountFromMasterKey(privateKey, 0); var walletDeposit = hdWallet.GetExternalWallet(0); var publicKey = walletDeposit.PublicKey; var depositAddress = walletDeposit.Address; Assert.AreEqual(expected: "0xA2ae76fb87C154580a034c116115cE39441Add6F", actual: depositAddress); Console.WriteLine($"Public key: {publicKey.ToHex()}"); }