Show / Hide Table of Contents

Struct BlockHeader

Block header containing information about Block<T>s except transactions.

Implements
IBlockExcerpt
Inherited Members
ValueType.Equals(Object)
ValueType.GetHashCode()
ValueType.ToString()
Object.Equals(Object, Object)
Object.GetType()
Object.ReferenceEquals(Object, Object)
Namespace: Libplanet.Blocks
Assembly: Libplanet.dll
Syntax
public struct BlockHeader : IBlockExcerpt

Constructors

| Improve this Doc View Source

BlockHeader(Bencodex.Types.Dictionary)

Declaration
public BlockHeader(Bencodex.Types.Dictionary dict)
Parameters
Type Name Description
Bencodex.Types.Dictionary dict
| Improve this Doc View Source

BlockHeader(Int32, Int64, String, ImmutableArray<Byte>, ImmutableArray<Byte>, Int64, BigInteger, ImmutableArray<Byte>, ImmutableArray<Byte>, ImmutableArray<Byte>, ImmutableArray<Byte>, ImmutableArray<Byte>)

Creates a BlockHeader instance.

Declaration
public BlockHeader(int protocolVersion, long index, string timestamp, ImmutableArray<byte> nonce, ImmutableArray<byte> miner, long difficulty, BigInteger totalDifficulty, ImmutableArray<byte> previousHash, ImmutableArray<byte> txHash, ImmutableArray<byte> hash, ImmutableArray<byte> preEvaluationHash, ImmutableArray<byte> stateRootHash)
Parameters
Type Name Description
Int32 protocolVersion

The protocol version. Goes to the ProtocolVersion.

Int64 index

The height of the block. Goes to the Index.

String timestamp

The time this block is created. Goes to the Timestamp.

ImmutableArray<Byte> nonce

The nonce which satisfy the given difficulty with any other field values. Goes to the Nonce.

ImmutableArray<Byte> miner

An optional address refers to who mines this block. Goes to the Miner.

Int64 difficulty

The mining difficulty that nonce has to satisfy. Goes to the Difficulty.

BigInteger totalDifficulty

The total mining difficulty until this block. See also Difficulty.

ImmutableArray<Byte> previousHash

The previous block's Hash. If it's a genesis block (i.e., index is 0) this should be null. Goes to the PreviousHash.

ImmutableArray<Byte> txHash

The result of hashing the transactions the block has. Goes to the TxHash.

ImmutableArray<Byte> hash

The hash of the Block<T>. Goes to the Hash.

ImmutableArray<Byte> preEvaluationHash

The hash derived from the block except of stateRootHash (i.e., without action evaluation). Used for Libplanet.Blocks.BlockHeader.Validate(System.DateTimeOffset) checking nonce.

ImmutableArray<Byte> stateRootHash

The Hash of the states on the block.

Properties

| Improve this Doc View Source

Difficulty

Declaration
public long Difficulty { get; }
Property Value
Type Description
Int64
| Improve this Doc View Source

Hash

Declaration
public ImmutableArray<byte> Hash { get; }
Property Value
Type Description
ImmutableArray<Byte>
| Improve this Doc View Source

Index

Declaration
public long Index { get; }
Property Value
Type Description
Int64
| Improve this Doc View Source

Miner

Declaration
public ImmutableArray<byte> Miner { get; }
Property Value
Type Description
ImmutableArray<Byte>
| Improve this Doc View Source

Nonce

Declaration
public ImmutableArray<byte> Nonce { get; }
Property Value
Type Description
ImmutableArray<Byte>
| Improve this Doc View Source

PreEvaluationHash

Declaration
public ImmutableArray<byte> PreEvaluationHash { get; }
Property Value
Type Description
ImmutableArray<Byte>
| Improve this Doc View Source

PreviousHash

Declaration
public ImmutableArray<byte> PreviousHash { get; }
Property Value
Type Description
ImmutableArray<Byte>
| Improve this Doc View Source

ProtocolVersion

The protocol version number.

Declaration
public int ProtocolVersion { get; }
Property Value
Type Description
Int32
| Improve this Doc View Source

StateRootHash

Declaration
public ImmutableArray<byte> StateRootHash { get; }
Property Value
Type Description
ImmutableArray<Byte>
| Improve this Doc View Source

Timestamp

Declaration
public string Timestamp { get; }
Property Value
Type Description
String
| Improve this Doc View Source

TotalDifficulty

Declaration
public BigInteger TotalDifficulty { get; }
Property Value
Type Description
BigInteger
| Improve this Doc View Source

TxHash

Declaration
public ImmutableArray<byte> TxHash { get; }
Property Value
Type Description
ImmutableArray<Byte>

Methods

| Improve this Doc View Source

Deserialize(Byte[])

Gets BlockHeader instance from serialized bytes.

Declaration
public static BlockHeader Deserialize(byte[] bytes)
Parameters
Type Name Description
Byte[] bytes

Serialized BlockHeader.

Returns
Type Description
BlockHeader

Deserialized BlockHeader.

| Improve this Doc View Source

Serialize()

Gets serialized byte array of the BlockHeader.

Declaration
public byte[] Serialize()
Returns
Type Description
Byte[]

Serialized byte array of BlockHeader.

| Improve this Doc View Source

ToBencodex()

Gets representation of BlockHeader.

Declaration
public Bencodex.Types.Dictionary ToBencodex()
Returns
Type Description
Bencodex.Types.Dictionary

representation of BlockHeader.

Explicit Interface Implementations

| Improve this Doc View Source

IBlockExcerpt.Hash

Declaration
HashDigest<SHA256> IBlockExcerpt.Hash { get; }
Returns
Type Description
HashDigest<SHA256>

Implements

IBlockExcerpt

Extension Methods

BlockExcerpt.ToExcerptString(IBlockExcerpt)
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2018–2021 Planetarium