public void SetKey(ExtPublicKey pubKey) { var prefix = RootService.Network.ExtPublicKey; var data = new byte[prefix.Length + ExtKey.Bip32KeySize]; prefix.CopyTo(data.Slice(0, prefix.Length)); pubKey.Encode(data.Slice(prefix.Length)); SetData(data, prefix.Length); }
public ExtPublicKey GetKey() { var pubKey = new ExtPublicKey(); if (KeyData.Length == ExtKey.Bip32KeySize) { pubKey.Decode(KeyData); } return(pubKey); }
/// <summary> /// Derives a child hierarchical deterministic public key specified by a key path. /// </summary> /// <param name="index"></param> /// <param name="hardened"></param> /// <returns></returns> protected override ExtKey DeriveBase(int index, bool hardened) { var cek = new ExtPublicKey { Depth = (byte)(Depth + 1), Child = (uint)index | (hardened ? HardenedBit : 0), Fingerprint = BitConverter.ToInt32(PublicKey.GetId().Span.Slice(0, 4)) }; bool ok; (ok, cek.PublicKey, cek.ChainCode) = PublicKey.Derive(cek.Child, ChainCode); return(ok ? cek : null); }
public bool Equals(ExtPublicKey o) => !(o is null) && base.Equals(o) && PublicKey == o.PublicKey;
/// <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 ExtPublicKey GetExtPublicKey() => ExtPublicKey.FromPrivateKey(this);
public Base58ExtPublicKey(ExtPublicKey pubKey) { SetKey(pubKey); }