/// <returns>A human readable version of the transaction useful for debugging.</returns> public override string ToString() { var s = new StringBuilder(); s.Append(" "); s.Append(HashAsString); s.AppendLine(); if (IsCoinBase) { string script; string script2; try { script = _inputs[0].ScriptSig.ToString(); script2 = _outputs[0].ScriptPubKey.ToString(); } catch (ScriptException) { script = "???"; script2 = "???"; } return(" == COINBASE TXN (scriptSig " + script + ") (scriptPubKey " + script2 + ")"); } foreach (var @in in _inputs) { s.Append(" "); s.Append("from "); try { s.Append(@in.ScriptSig.FromAddress.ToString()); } catch (Exception e) { s.Append("[exception: ").Append(e.Message).Append("]"); throw; } s.AppendLine(); } foreach (var @out in _outputs) { s.Append(" "); s.Append("to "); try { var toAddr = new Address(Params, @out.ScriptPubKey.PubKeyHash); s.Append(toAddr.ToString()); s.Append(" "); s.Append(Utils.BitcoinValueToFriendlyString(@out.Value)); s.Append(" BTC"); } catch (Exception e) { s.Append("[exception: ").Append(e.Message).Append("]"); } s.AppendLine(); } return(s.ToString()); }
/// <summary> /// Returns a human readable debug string. /// </summary> public override string ToString() { return("TxOut of " + Utils.BitcoinValueToFriendlyString(_value) + " to " + ScriptPubKey.ToAddress + " script:" + ScriptPubKey); }