public StealthCoin(OutPoint outpoint, TxOut txOut, Script redeem, StealthMetadata stealthMetadata, BitcoinStealthAddress address) : base(outpoint, txOut) { StealthMetadata = stealthMetadata; Address = address; Redeem = redeem; }
/// <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)); }
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); }