Show / Hide Table of Contents

Struct BlockHeader

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

Namespace: Libplanet.Blocks
Assembly: Libplanet.dll
Syntax
public struct BlockHeader

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(Int64, String, ImmutableArray<Byte>, ImmutableArray<Byte>, Int64, ImmutableArray<Byte>, ImmutableArray<Byte>, ImmutableArray<Byte>)

Creates a BlockHeader instance.

Declaration
public BlockHeader(long index, string timestamp, ImmutableArray<byte> nonce, ImmutableArray<byte> miner, long difficulty, ImmutableArray<byte> previousHash, ImmutableArray<byte> txHash, ImmutableArray<byte> hash)
Parameters
Type Name Description
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.

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.

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

PreviousHash

Declaration
public ImmutableArray<byte> PreviousHash { 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

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.

  • Improve this Doc
  • View Source
Back to top Copyright © 2019–2020 Planetarium