Beispiel #1
0
        public void TrustWalletTezosExtKeyTest()
        {
            var messageBytes = Encoding.UTF8.GetBytes(Message);

            using var seed                 = new SecureBytes(new Mnemonic(Mnemonic).DeriveSeed());
            using var extKey               = new TezosExtKey(seed);
            using var childKey             = extKey.Derive(new KeyPath("m/44'/1729'/0'/0'"));
            using var secureChildPublicKey = childKey.GetPublicKey();
            using var childPublicKey       = secureChildPublicKey.ToUnsecuredBytes();

            var signature = childKey.SignMessage(messageBytes);

            Assert.True(childKey.VerifyMessage(messageBytes, signature));

            var address = Common.CurrenciesTestNet.Get <TezosConfig>("XTZ").AddressFromKey(childPublicKey);

            Assert.NotNull(address);
        }
        public void TezosExtKeyDerivationTest()
        {
            var messageBytes = Encoding.UTF8.GetBytes(Message);

            var seed = new Mnemonic(Mnemonic).DeriveSeed();

            var extKey = new TezosExtKey(seed);

            for (var i = 0; i < 100; ++i)
            {
                var childKey = extKey.Derive(new KeyPath($"m/44'/1729'/0'/0/{i}"));
                childKey.GetPublicKey(out var childPublicKey);

                var signature = childKey.SignMessage(messageBytes);
                Assert.True(childKey.VerifyMessage(messageBytes, signature));

                var address = Common.CurrenciesTestNet.Get <Tezos>().AddressFromKey(childPublicKey);
                Assert.NotNull(address);
            }
        }