3 using System.Collections.Generic;
10 public class CBlockHeader
13 /// Version of block schema.
15 public uint nVersion = 6;
18 /// Previous block hash.
20 public Hash256 prevHash = new Hash256();
25 public Hash256 merkleRoot = new Hash256();
30 public uint nTime = 0;
33 /// Compressed difficulty representation.
35 public uint nBits = 0;
40 public uint nNonce = 0;
43 /// Initialize an empty instance
45 public CBlockHeader ()
50 /// Convert current block header instance into sequence of bytes
52 /// <returns>Byte sequence</returns>
53 public IList<byte> Bytes
57 List<byte> r = new List<byte>();
59 r.AddRange(BitConverter.GetBytes(nVersion));
60 r.AddRange(prevHash.hashBytes);
61 r.AddRange(merkleRoot.hashBytes);
62 r.AddRange(BitConverter.GetBytes(nTime));
63 r.AddRange(BitConverter.GetBytes(nBits));
64 r.AddRange(BitConverter.GetBytes(nNonce));
70 public override string ToString()
72 StringBuilder sb = new StringBuilder();
73 sb.AppendFormat("CBlockHeader(nVersion={0}, prevHash={1}, merkleRoot={2}, nTime={3}, nBits={4}, nNonce={5})", nVersion, prevHash.ToString(), merkleRoot.ToString(), nTime, nBits, nNonce);