public TxOutpoint(Hash transactionHash, uint index) { Contract.Requires<ArgumentNullException>(transactionHash != null); TransactionHash = transactionHash; Index = index; ByteSize = (uint)TxOutpoint.ConstantByteSize; }
public GetHeadersPayload(uint version, Hash[] hashStart, Hash hashStop) { Contract.Requires<ArgumentNullException>(hashStart != null, "hashStart"); Contract.Requires<ArgumentNullException>(hashStop != null, "hashStop"); Version = version; HashStart = new VarArray<Hash>(hashStart); StartCount = new VarInt((uint)hashStart.Length); HashStop = hashStop; ByteSize = Version.ByteSize() + StartCount.ByteSize + HashStart.ByteSize + HashStop.ByteSize; }
public TxOutpoint(byte[] buffer, int offset) : base(buffer, offset) { Contract.Requires<ArgumentNullException>(buffer != null, "buffer"); Contract.Requires<ArgumentException>(buffer.Length >= TxOutpoint.ConstantByteSize, "buffer"); Contract.Requires<ArgumentOutOfRangeException>(offset >= 0, "offset"); Contract.Requires<ArgumentOutOfRangeException>(offset <= buffer.Length - TxOutpoint.ConstantByteSize, "offset"); TransactionHash = new Hash(buffer, offset); Index = buffer.ReadUInt32(offset + INDEX_OFFSET); ByteSize = (uint)TxOutpoint.ConstantByteSize; }
public Block(uint version, Hash previousBlock, Hash merkleRoot, uint timestamp, uint bits, uint nonce, VarArray<Tx> transactions) { Contract.Requires<ArgumentNullException>(previousBlock != null); Contract.Requires<ArgumentNullException>(merkleRoot != null); Version = version; PreviousBlock = previousBlock; MerkleRoot = merkleRoot; Timestamp = Timestamp; Bits = bits; Nonce = nonce; Transactions = transactions; }
public GetHeadersPayload(byte[] buffer, int offset) : base(buffer, offset) { Contract.Requires<ArgumentNullException>(buffer != null, "buffer"); Contract.Requires<ArgumentException>(buffer.Length >= GetHeadersPayload.MinimumByteSize, "buffer"); Contract.Requires<ArgumentOutOfRangeException>(offset >= 0, "offset"); Contract.Requires<ArgumentOutOfRangeException>(offset <= buffer.Length - GetHeadersPayload.MinimumByteSize, "offset"); Version = buffer.ReadUInt32(offset); StartCount = new VarInt(buffer, StartCount_Offset(ref offset)); HashStart = new VarArray<Hash>(buffer, HashStart_Offset(ref offset)); HashStop = new Hash(buffer, HashStop_Offset(ref offset)); ByteSize = Version.ByteSize() + StartCount.ByteSize + HashStart.ByteSize + HashStop.ByteSize; }
public Block(byte[] buffer, int offset) : base(buffer, offset) { Contract.Requires<ArgumentNullException>(buffer != null, "buffer"); Contract.Requires<ArgumentException>(buffer.Length > Block.MinimumByteSize, "buffer"); Contract.Requires<ArgumentOutOfRangeException>(offset >= 0, "offset"); Contract.Requires<ArgumentOutOfRangeException>(offset < buffer.Length - Block.MinimumByteSize, "offset"); Version = buffer.ReadUInt32(offset); PreviousBlock = new Hash(buffer, PreviousBlock_Offset(ref offset)); MerkleRoot = new Hash(buffer, MerkleRoot_Offset(ref offset)); Timestamp = buffer.ReadUInt32(Timestamp_Offset(ref offset)); Bits = buffer.ReadUInt32(Bits_Offset(ref offset)); Nonce = buffer.ReadUInt32(Nonce_Offset(ref offset)); Transactions = new VarArray<Tx>(buffer, Transactions_Offset(ref offset)); }