3 using System.Collections.Generic;
8 /// Transaction output.
18 /// Second half of script which contains spending instructions.
20 public byte[] scriptPubKey;
23 /// Initialize new CTxOut instance as a copy of another instance.
25 /// <param name="o">CTxOut instance.</param>
26 public CTxOut(CTxOut o)
29 scriptPubKey = o.scriptPubKey;
33 /// Get raw bytes representation of our output.
35 /// <returns>Byte sequence.</returns>
36 public IList<byte> ToBytes()
38 List<byte> resultBytes = new List<byte>();
40 resultBytes.AddRange(Interop.LEBytes(nValue)); // txout value
41 resultBytes.AddRange(VarInt.EncodeVarInt(scriptPubKey.LongLength)); // scriptPubKey length
42 resultBytes.AddRange(scriptPubKey); // scriptPubKey
47 public override string ToString ()
49 StringBuilder sb = new StringBuilder ();
50 sb.AppendFormat ("CTxOut(nValue={0},scriptPubKey={1}", nValue, scriptPubKey.ToString());
52 return sb.ToString ();