public void ShouldGenerateWalletFromPrivateKey()
        {
            IHDWallet <StacksWallet> stacksHDWallet = new StacksHDWallet("labor slow cloud ecology teach price cousin mountain cushion digital refuse priority dawn balcony step luxury obvious bracket lion insect brother code cave excess", "");
            var          account0 = stacksHDWallet.GetAccount(0);
            StacksWallet wallet0  = account0.GetExternalWallet(0);

            Assert.AreEqual("c216ddb515f247a7463be98569ba0c526d9da33ddf345e73ef78f0221c3427f3", wallet0.PrivateKey.ToHex());
            Assert.AreEqual("STMQVWWA1JA2HSGB4KX02VN185DA3W8B5V7WAXK", wallet0.GetAddress(NetworkVersion.Testnet));

            var stacksWallet = new StacksWallet("c216ddb515f247a7463be98569ba0c526d9da33ddf345e73ef78f0221c3427f3");

            Assert.AreEqual(wallet0.PrivateKey.ToHex(), stacksWallet.PrivateKey.ToHex());
            Assert.AreEqual(wallet0.Address, stacksWallet.Address);
        }
Beispiel #2
0
        public void ShouldCreateAccount()
        {
            string words = "labor slow cloud ecology teach price cousin mountain cushion digital refuse priority dawn balcony step luxury obvious bracket lion insect brother code cave excess";
            IHDWallet <StacksWallet> wallet = new StacksHDWallet(words);
            var account0wallet0             = wallet.GetAccount(0).GetExternalWallet(0); // m/44'/195'/0'/0/0
            var t = account0wallet0.PublicKey.ToHex();

            Assert.AreEqual("037e83b6453f77b523a7f48d980e8aa294ae46b1dbc7e966799b151c151c49e2ac", account0wallet0.PublicKey.ToHex());

            // Account Extended Private Key for m/44'/195'/0';
            var accountExtendedPrivateKey = "xprv9zBCnh1bQSSWZhN1mkbZW33MGX1hiWLRtnXfpXqtZWnj5oEmR5wsaan2TZzk5h3AiDUqM3DQUddqeg2gHxKgpxwEEPA1pqncjjc1kFighEn";
            IAccountHDWallet <StacksWallet> accountHDWallet = new AccountHDWallet <StacksWallet>(accountExtendedPrivateKey, 0);

            // m/44'/195'/0'/0/0
            var depositWallet0 = accountHDWallet.Account.GetExternalWallet(0);

            Assert.AreEqual("037e83b6453f77b523a7f48d980e8aa294ae46b1dbc7e966799b151c151c49e2ac", depositWallet0.PublicKey.ToHex());

            Assert.AreEqual(account0wallet0.PublicKey, depositWallet0.PublicKey);
        }