示例#1
0
        private string GetScriptString(NBitcoin.Transaction transaction)
        {
            var output = transaction.Outputs.FirstOrDefault(c => c.Value.Equals(Money.Zero));

            if (output == null)
            {
                transaction.ToString(); //TODO: UnCOmment exception
            }
            //throw new Exception("Transaction without integration output:  " + transaction.GetHash().ToString());
            else
            {
                try
                {
                    var coin   = new NBitcoin.Coin(transaction, output);
                    var script = coin.GetScriptCode().ToString();
                    script = script.Replace("OP_RETURN ", "");
                    return(HexToString(script));
                }
                catch (Exception e)
                {
                    throw new Exception("Failed to process transaction output", e);
                }
            }

            return("");
        }
示例#2
0
 public override string ToString()
 {
     return(transaction.ToString());
 }