コード例 #1
0
ファイル: Coin.cs プロジェクト: SerafinTech/NBitcoin
 public StealthCoin(OutPoint outpoint, TxOut txOut, Script redeem, StealthMetadata stealthMetadata, BitcoinStealthAddress address)
     : base(outpoint, txOut)
 {
     StealthMetadata = stealthMetadata;
     Address         = address;
     Redeem          = redeem;
 }
コード例 #2
0
ファイル: Coin.cs プロジェクト: SerafinTech/NBitcoin
        /// <summary>
        /// Scan the Transaction for StealthCoin given address and scan key
        /// </summary>
        /// <param name="tx">The transaction to scan</param>
        /// <param name="address">The stealth address</param>
        /// <param name="scan">The scan private key</param>
        /// <returns></returns>
        public static StealthCoin Find(Transaction tx, BitcoinStealthAddress address, Key scan)
        {
            var payment = address.GetPayments(tx, scan).FirstOrDefault();

            if (payment == null)
            {
                return(null);
            }
            var txId  = tx.GetHash();
            var txout = tx.Outputs.First(o => o.ScriptPubKey == payment.ScriptPubKey);

            return(new StealthCoin(new OutPoint(txId, tx.Outputs.IndexOf(txout)), txout, payment.Redeem, payment.Metadata, address));
        }
コード例 #3
0
        public TransactionBuilder Send(BitcoinStealthAddress address, Money money, Key ephemKey = null)
        {
            if (_OpReturnUser == null)
            {
                _OpReturnUser = "******";
            }
            else
            {
                throw new InvalidOperationException("Op return already used for " + _OpReturnUser);
            }

            CurrentGroup.Builders.Add(ctx =>
            {
                var payment = address.CreatePayment(ephemKey);
                payment.AddToTransaction(ctx.Transaction, money);
                return(money);
            });
            return(this);
        }