Esempio n. 1
0
        public static KzExtPubKey FromPriv(KzExtPrivKey priv)
        {
            var key = new KzExtPubKey {
                _depth       = priv.Depth,
                _fingerprint = priv.Fingerprint,
                _child       = priv.IndexWithHardened,
                _chaincode   = priv.Chaincode,
                pubkey       = priv.PrivKey.GetPubKey()
            };

            return(key);
        }
Esempio n. 2
0
        public override KzExtKey DeriveBase(int index, bool hardened)
        {
            var cek = new KzExtPubKey {
                _depth = (byte)(_depth + 1),
                _child = (uint)index | (hardened ? HardenedBit : 0)
            };

            pubkey.GetID().Span.Slice(0, 4).CopyTo(cek._fingerprint.AsSpan());
            bool ok;

            (ok, cek.pubkey, cek._chaincode) = pubkey.Derive(cek._child, _chaincode);
            return(ok ? cek : null);
        }
Esempio n. 3
0
 public bool Equals(KzExtPubKey o) => (object)o != null && base.Equals(o) && pubkey == o.pubkey;
Esempio n. 4
0
 /// <summary>
 /// BIP32 uses "Neuter" to describe adding the extended key information to the public key
 /// associated with an extended private key.
 /// </summary>
 /// <returns></returns>
 public KzExtPubKey GetExtPubKey() => KzExtPubKey.FromPriv(this);