public void ShouldCreateAddrssFeomMasterKey() { var accountExtendedPrivateKey = "xprv9yB7gYqxZdR4AUGppodn1XL7RpJkRUnDE1fM6oEY4LQrvstH1qCdfFHmW9msdqAsPEPqr9LhYmw2nZQfk8uBbk1KYhzjNVzWdwsugTTgNvc"; IAccountHDWallet <TronWallet> accountHDWallet = new AccountHDWallet <TronWallet>(accountExtendedPrivateKey, 0, new HDWallet.Tron.AddressGenerator()); var depositWallet0 = accountHDWallet.GetAccount().GetExternalWallet(0); Assert.AreEqual("031a97d1707d7cc37a1e61830554a40c47edc7fb03a4098fdfa690020376d99870", depositWallet0.PublicKey.ToHex()); Assert.AreEqual("TMQ3RtdjwCCoeA2RAYiTrFNZTKtzh5t9YQ", depositWallet0.Address); }
public void ShouldCreateAccount() { // Account Extended Private Key for m/44'/0'/0' of mnemonic; // conduct stadium ask orange vast impose depend assume income sail chunk tomorrow life grape dutch // Checked from https://iancoleman.io/bip39 var accountExtendedPrivateKey = "xprv9xyvwx1jBEBKwjZtXYogBwDyfXTyTa3Af6urV2dU843CyBxLu9J5GLQL4vMWvaW4q3skqAtarUvdGmBoWQZnU2RBLnmJdCM4FnbMa72xWNy"; IAccountHDWallet <BitcoinWallet> accountHDWallet = new AccountHDWallet <BitcoinWallet>(accountExtendedPrivateKey, 0, new NullAddressGenerator()); // m/44'/0'/0'/0/0 var depositWallet0 = accountHDWallet.GetAccount().GetExternalWallet(0); Assert.AreEqual("0374c393e8f757fa4b6af5aba4545fd984eae28ab84bda09df93d32562123b7a1c", depositWallet0.PublicKey.ToHex()); // m/44'/0'/0'/0/1 var depositWallet1 = accountHDWallet.GetAccount().GetExternalWallet(1); Assert.AreEqual("025166e4e70b4ae6fd0deab416ab1c3704f2aa5dbf451be7639ca48fe6d273773c", depositWallet1.PublicKey.ToHex()); }
public void ShouldCreateAccount() { string words = "conduct stadium ask orange vast impose depend assume income sail chunk tomorrow life grape dutch"; IHDWallet <TronWallet> wallet = new TronHDWallet(words); var account0wallet0 = wallet.GetAccount(0).GetExternalWallet(0); // m/44'/195'/0'/0/0 Assert.AreEqual("031a97d1707d7cc37a1e61830554a40c47edc7fb03a4098fdfa690020376d99870", account0wallet0.PublicKey.ToHex()); // TMQ3RtdjwCCoeA2RAYiTrFNZTKtzh5t9YQ // Account Extended Private Key for m/44'/195'/0'; var accountExtendedPrivateKey = "xprv9yB7gYqxZdR4AUGppodn1XL7RpJkRUnDE1fM6oEY4LQrvstH1qCdfFHmW9msdqAsPEPqr9LhYmw2nZQfk8uBbk1KYhzjNVzWdwsugTTgNvc"; IAccountHDWallet <TronWallet> accountHDWallet = new AccountHDWallet <TronWallet>(accountExtendedPrivateKey, 0, new NullAddressGenerator()); // m/44'/195'/0'/0/0 var depositWallet0 = accountHDWallet.GetAccount().GetExternalWallet(0); Assert.AreEqual("031a97d1707d7cc37a1e61830554a40c47edc7fb03a4098fdfa690020376d99870", depositWallet0.PublicKey.ToHex()); Assert.AreEqual(account0wallet0.PublicKey, depositWallet0.PublicKey); }
/// <summary> /// Generates Account from master. Doesn't derive new path by accountIndexInfo /// </summary> /// <param name="accountMasterKey">Used to generate wallet</param> /// <param name="accountIndexInfo">Used only to store information</param> /// <returns></returns> public static IAccount <TronWallet> GetAccountFromMasterKey(string accountMasterKey, uint accountIndexInfo) { IAccountHDWallet <TronWallet> accountHDWallet = new AccountHDWallet <TronWallet>(accountMasterKey, accountIndexInfo, new AddressGenerator()); return(accountHDWallet.GetAccount()); }