Пример #1
0
 public Transaction Parse(DecodedRawTransaction source)
 {
     return(new Transaction
     {
         Hash = source.TxId,
         Locktime = source.Locktime,
         Timestamp = source.Time,
         Version = source.Version,
         Inputs = source.VIn.Select(vin => new TransactionInput
         {
             Outpoint = new TransactionOutPoint
             {
                 Hash = vin.CoinBase.IsNull() ? vin.TxId : CryptoUtil.ToHex(CryptoUtil.ZeroHash(32)),
                 Index = vin.CoinBase.IsNull() ? vin.VOut : (long)uint.MaxValue
             },
             ScriptBytes = CryptoUtil.ConvertHex(vin.CoinBase.IsNull() ? vin.ScriptSig.Hex : vin.CoinBase),
             Sequence = vin.Sequence
         }).ToList(),
         Outputs = source.VOut.Select(vout => new TransactionOutput
         {
             Index = vout.N,
             Value = this.Serializer.ValueToNum(vout.Value),
             ScriptBytes = vout.ScriptPubKey.Hex.IsNullOrEmpty() ? Enumerable.Empty <byte>().ToArray() : CryptoUtil.ConvertHex(vout.ScriptPubKey.Hex)
         }).ToList()
     });
 }
Пример #2
0
        public DecodedRawTransaction GetRawTransaction(string txid, int verbose = 0)
        {
            if (verbose == 0)
            {
                string hex = Call <string>("getrawtransaction", txid, verbose);
                return(new DecodedRawTransaction {
                    Hex = hex
                });
            }

            DecodedRawTransaction res = Call <DecodedRawTransaction>("getrawtransaction", txid, verbose);

            return(res);
        }
Пример #3
0
        /// <inheritdoc />
        public async Task <DecodedRawTransaction> GetRawTransactionAsync(string txid, int verbose = 0)
        {
            if (verbose == 0)
            {
                string hex = await CallAsync <string>("getrawtransaction", txid, verbose);

                return(new DecodedRawTransaction {
                    Hex = hex
                });
            }

            DecodedRawTransaction res = await CallAsync <DecodedRawTransaction>("getrawtransaction", txid, verbose);

            return(res);
        }
Пример #4
0
        /// <summary>	Gets all pubkeys from bitcoin transactions in this collection. </summary>
        ///
        /// <remarks>	Paul, 05/02/2015. </remarks>
        ///
        /// <param name="txid">	The txid. </param>
        ///
        /// <returns>
        /// An enumerator that allows foreach to be used to process all pubkeys from bitcoin transactions
        /// in this collection.
        /// </returns>
        IEnumerable <string> GetAllPubkeysFromBitcoinTransaction(string txid)
        {
            DecodedRawTransaction rawDeposit = m_bitcoin.GetRawTransaction(txid, 1);

            return(rawDeposit.VIn.Select(vin => vin.ScriptSig.Asm.Split(' ')[1]));
        }
Пример #5
0
        /// <inheritdoc />
        public async Task <DecodedRawTransaction> DecodeRawTransactionAsync(string rawTransactionHex)
        {
            DecodedRawTransaction res = await CallAsync <DecodedRawTransaction>("decoderawtransaction", rawTransactionHex);

            return(res);
        }