Class BlockMetadata
A block metadata without transactions or any proof hash. This represents metadata of a block that is not yet mined nor proven.
To represent a block content including its metadata and transactions, use
Block
Inheritance
Implements
Namespace: Libplanet.Types.Blocks
Assembly: Libplanet.Types.dll
Syntax
public class BlockMetadata : object, IBlockMetadata
Constructors
| Improve this Doc View SourceBlockMetadata(IBlockMetadata)
Creates a Blockmetadata
.
Declaration
public BlockMetadata(IBlockMetadata metadata)
Parameters
Type | Name | Description |
---|---|---|
IBlock |
metadata | The source block metadata to copy. This needn't be
an actual Block |
Remarks
As metadata
needn't be an actual Block
This gets redirected to
See Also
| Improve this Doc View SourceBlockMetadata(Int32, Int64, DateTimeOffset, Address, PublicKey, Nullable<BlockHash>, Nullable<HashDigest<SHA256>>, BlockCommit, Nullable<HashDigest<SHA256>>)
Creates a Block
Declaration
public BlockMetadata(int protocolVersion, long index, DateTimeOffset timestamp, Address miner, PublicKey publicKey, BlockHash? previousHash, HashDigest<SHA256>? txHash, BlockCommit lastCommit, HashDigest<SHA256>? evidenceHash)
Parameters
Type | Name | Description |
---|---|---|
System. |
protocolVersion | Goes to Protocol |
System. |
index | Goes to Index. |
Date |
timestamp | Goes to Timestamp. |
Address | miner | Goes to Miner. |
Public |
publicKey | Goes to Public |
System. |
previousHash | Goes to Previous |
System. |
txHash | Goes to Tx |
Block |
lastCommit | Goes to Last |
System. |
evidenceHash | Goes to Evidence |
Remarks
Except for debugging and/or testing purposes, this shouldn't be called directly.
Exceptions
Type | Condition |
---|---|
Invalid |
Thrown when
|
Invalid |
Thrown when |
Invalid |
Thrown when any of the following conditions isn't satisfied:
|
Invalid |
Thrown when
|
See Also
| Improve this Doc View SourceBlockMetadata(Int64, DateTimeOffset, PublicKey, Nullable<BlockHash>, Nullable<HashDigest<SHA256>>, BlockCommit, Nullable<HashDigest<SHA256>>)
Creates a Block
Declaration
public BlockMetadata(long index, DateTimeOffset timestamp, PublicKey publicKey, BlockHash? previousHash, HashDigest<SHA256>? txHash, BlockCommit lastCommit, HashDigest<SHA256>? evidenceHash)
Parameters
Type | Name | Description |
---|---|---|
System. |
index | Goes to Index. |
Date |
timestamp | Goes to Timestamp. |
Public |
publicKey | Goes to Public |
System. |
previousHash | Goes to Previous |
System. |
txHash | Goes to Tx |
Block |
lastCommit | Goes to Last |
System. |
evidenceHash | Goes to Evidence |
See Also
Fields
| Improve this Doc View SourceCurrencyAccountProtocolVersion
The starting protocol version where fungible assets are stored in resepctive
currency accounts instead of the legacy account. Prior to this version,
all fungible assets are stored in the legacy account.
Moreover, starting with this version, every total supply of each currency is trackable
regardless of Total
Declaration
public const int CurrencyAccountProtocolVersion = null
Field Value
Type | Description |
---|---|
System. |
See Also
| Improve this Doc View SourceCurrentProtocolVersion
The latest protocol version.
Declaration
public const int CurrentProtocolVersion = null
Field Value
Type | Description |
---|---|
System. |
See Also
| Improve this Doc View SourceEvidenceProtocolVersion
The starting protocol version where evidence of the consensus process is detected and stored. In the consensus process, evidence of double signing is stored, and in the application layer, you can define and use custom evidence.
Declaration
public const int EvidenceProtocolVersion = null
Field Value
Type | Description |
---|---|
System. |
See Also
| Improve this Doc View SourcePBFTProtocolVersion
The starting protocol version where PBFT validation is used instead of PoW validation. Prior to this version, PoW validation is used.
Declaration
public const int PBFTProtocolVersion = null
Field Value
Type | Description |
---|---|
System. |
See Also
| Improve this Doc View SourceSignatureProtocolVersion
The starting protocol version where Signature was added. Prior to this version, Blocks had no signature.
In its serialized form, Miner was removed and
Public
Declaration
public const int SignatureProtocolVersion = null
Field Value
Type | Description |
---|---|
System. |
See Also
| Improve this Doc View SourceSlothProtocolVersion
The starting protocol version where State
Declaration
public const int SlothProtocolVersion = null
Field Value
Type | Description |
---|---|
System. |
See Also
| Improve this Doc View SourceTransactionOrderingFixProtocolVersion
The starting protocol version where a more secure Transaction shuffling scheme is used.
Declaration
public const int TransactionOrderingFixProtocolVersion = null
Field Value
Type | Description |
---|---|
System. |
See Also
| Improve this Doc View SourceTransferFixProtocolVersion
The starting protocol version where a bug in transferring asset was fixed.
Prior to this version, it was possible to duplicate
Fungible
Also, Protocol
Declaration
public const int TransferFixProtocolVersion = null
Field Value
Type | Description |
---|---|
System. |
See Also
| Improve this Doc View SourceValidatorSetAccountProtocolVersion
The starting protocol version where the validator set is stored in a separate account instead of the legacy account. Prior to this version, the validator set is stored in the legacy account.
Declaration
public const int ValidatorSetAccountProtocolVersion = null
Field Value
Type | Description |
---|---|
System. |
See Also
| Improve this Doc View SourceWorldStateProtocolVersion
The starting protocol version where the world state model is used instead of the legacy state model. Prior to this version, the legacy state model is used.
Declaration
public const int WorldStateProtocolVersion = null
Field Value
Type | Description |
---|---|
System. |
See Also
Properties
| Improve this Doc View SourceEvidenceHash
A block metadata without transactions or any proof hash. This represents metadata of a block that is not yet mined nor proven.
To represent a block content including its metadata and transactions, use
Block
Declaration
public HashDigest<SHA256>? EvidenceHash { get; }
Property Value
Type | Description |
---|---|
System. |
See Also
| Improve this Doc View SourceIndex
The height of the block.
Declaration
public long Index { get; }
Property Value
Type | Description |
---|---|
System. |
Remarks
Zero means it is a genesis block. Not allowed to be negative.
See Also
| Improve this Doc View SourceLastCommit
A block metadata without transactions or any proof hash. This represents metadata of a block that is not yet mined nor proven.
To represent a block content including its metadata and transactions, use
Block
Declaration
public BlockCommit LastCommit { get; set; }
Property Value
Type | Description |
---|---|
Block |
See Also
| Improve this Doc View SourceMiner
The address of the miner.
Declaration
public Address Miner { get; }
Property Value
Type | Description |
---|---|
Address |
See Also
| Improve this Doc View SourcePreviousHash
The previous block's hash. If it's a genesis block (i.e., its Index is 0) this must be null.
Declaration
public BlockHash? PreviousHash { get; }
Property Value
Type | Description |
---|---|
System. |
See Also
| Improve this Doc View SourceProtocolVersion
The protocol version number. For the latest protocol version, see
Current
- 0: The initial block protocol version number. This is not actually recorded in storage. That is, the lack of block protocol version in a stored block means it is of version 0.
-
1: Introduced to be stored with the block data. Validation for
Pre
Evaluation was added.Hash -
2: Updated to include Signature to blocks. As a result,
the miner's identity is provided as a Public
Key instead of a Address. Additionally, total difficulty was added. - 3: Updated to fix an issue with the internal execution ordering of Transactions in blocks.
-
4: Updated to introduce a PBFT scheme. Last
Commit was added and total difficulty was removed. - 5: Updated to introduce a world model. No structural changes were made to blocks. This is used as a marker indicating when the data model should be migrated.
Declaration
public int ProtocolVersion { get; }
Property Value
Type | Description |
---|---|
System. |
See Also
| Improve this Doc View SourcePublicKey
The public key of the Miner. This is used for verifying the signature.
Although this is nullable type-wise, it is mandatory where
Protocol
Declaration
public PublicKey PublicKey { get; }
Property Value
Type | Description |
---|---|
Public |
See Also
| Improve this Doc View SourceTimestamp
The time the block is created.
Declaration
public DateTimeOffset Timestamp { get; }
Property Value
Type | Description |
---|---|
Date |
Remarks
This is always UTC.
See Also
| Improve this Doc View SourceTxHash
The hash of all transactions in the block. This is null if the block has no transactions.
Declaration
public HashDigest<SHA256>? TxHash { get; }
Property Value
Type | Description |
---|---|
System. |
See Also
Methods
| Improve this Doc View SourceDerivePreEvaluationHash()
Derives a hash digest from the block metadata.
Declaration
public HashDigest<SHA256> DerivePreEvaluationHash()
Returns
Type | Description |
---|---|
Hash |
A pre-evaluation block hash. |
See Also
| Improve this Doc View SourceMakeCandidateData()
Serializes data of a possible candidate shifted from it into a Bencodex dictionary.
Declaration
public Bencodex.Types.Dictionary MakeCandidateData()
Returns
Type | Description |
---|---|
Bencodex. |
The serialized block content in a Bencodex dictionary. |