3 using System.Collections.Generic;
13 /// Hash of parent transaction.
15 public Hash256 txID = new Hash256();
18 /// Parent input number.
23 /// First half of script, signatures for the scriptPubKey
25 public byte[] scriptSig;
28 /// Transaction variant number, irrelevant if nLockTime isn't specified. Its value is 0xffffffff by default.
30 public uint nSequence = 0xffffffff;
33 /// Initialize new CTxIn instance as copy of another one.
35 /// <param name="i">CTxIn instance.</param>
40 scriptSig = i.scriptSig;
41 nSequence = i.nSequence;
45 /// Get raw bytes representation of our input.
47 /// <returns>Byte sequence.</returns>
48 public IList<byte> ToBytes()
50 List<byte> inputBytes = new List<byte>();
52 inputBytes.AddRange(txID.hashBytes); // Input transaction id
53 inputBytes.AddRange(Interop.LEBytes(n)); // Output number
54 inputBytes.AddRange(VarInt.EncodeVarInt(scriptSig.LongLength)); // scriptSig length
55 inputBytes.AddRange(scriptSig); // scriptSig
56 inputBytes.AddRange(Interop.LEBytes(nSequence)); // Sequence
61 public override string ToString ()
63 StringBuilder sb = new StringBuilder ();
64 sb.AppendFormat ("CTxIn(txId={0},n={1},scriptSig={2}", txID.ToString(), n, scriptSig.ToString());
66 return sb.ToString ();