Exemplo n.º 1
0
 public BitcoinExtKey Derive(KeyPath keyPath)
 {
     if (keyPath == null)
     {
         throw new ArgumentNullException(nameof(keyPath));
     }
     return(new BitcoinExtKey(ExtKey.Derive(keyPath), Network));
 }
Exemplo n.º 2
0
        public ExtKey Derive(KeyPath derivation)
        {
            ExtKey result = this;

            foreach (var index in derivation.Indexes)
            {
                result = result.Derive(index);
            }
            return(result);
        }
        public PSBT SignAll(ExtKey extkey, KeyPath keyPath, SigHash sigHash)
        {
            if (extkey == null)
            {
                throw new ArgumentNullException(nameof(extkey));
            }
            if (keyPath == null)
            {
                throw new ArgumentNullException(nameof(keyPath));
            }
            var privKey = extkey.Derive(keyPath).PrivateKey;

            foreach (var input in this.Inputs)
            {
                if (input.HDKeyPaths.TryGetValue(privKey.PubKey, out var v) &&
                    v.Item1 != default &&
                    v.Item1 == extkey.PrivateKey.PubKey.GetHDFingerPrint())
                {
                    input.Sign(privKey);
                }
            }
            return(this);
        }
Exemplo n.º 4
0
 public BitcoinExtKey Derive(uint index)
 {
     return(new BitcoinExtKey(ExtKey.Derive(index), Network));
 }