using System; using System.Text; using System.Collections.Generic; namespace Novacoin { /// /// Transaction output. /// public class CTxOut { /// /// Input value. /// public ulong nValue; /// /// Second half of script which contains spending instructions. /// public byte[] scriptPubKey; /// /// Initialize new CTxOut instance as a copy of another instance. /// /// CTxOut instance. public CTxOut(CTxOut o) { nValue = o.nValue; scriptPubKey = o.scriptPubKey; } /// /// Get raw bytes representation of our output. /// /// Byte sequence. public IList ToBytes() { List resultBytes = new List(); resultBytes.AddRange(Interop.LEBytes(nValue)); // txout value resultBytes.AddRange(VarInt.EncodeVarInt(scriptPubKey.LongLength)); // scriptPubKey length resultBytes.AddRange(scriptPubKey); // scriptPubKey return resultBytes; } public override string ToString () { StringBuilder sb = new StringBuilder (); sb.AppendFormat ("CTxOut(nValue={0},scriptPubKey={1}", nValue, scriptPubKey.ToString()); return sb.ToString (); } } }