java.lang.Object
io.mokamint.node.Blocks
Providers of blocks.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classGson decoder.static classGson encoder.static classJson representation. -
Method Summary
Modifier and TypeMethodDescriptionstatic Blockfrom(io.hotmoka.marshalling.api.UnmarshallingContext context) Unmarshals a block from the given context.static Blockfrom(io.hotmoka.marshalling.api.UnmarshallingContext context, ConsensusConfig<?, ?> config) Unmarshals a block from the given context.static GenesisBlockgenesis(GenesisBlockDescription description, byte[] stateId, PrivateKey privateKey) Yields a genesis block with the given description.static NonGenesisBlockof(NonGenesisBlockDescription description, Stream<Transaction> transactions, byte[] stateId, PrivateKey privateKey) Yields a non-genesis block with the given description.
-
Method Details
-
of
public static NonGenesisBlock of(NonGenesisBlockDescription description, Stream<Transaction> transactions, byte[] stateId, PrivateKey privateKey) throws InvalidKeyException, SignatureException Yields a non-genesis block with the given description. It adds a signature to the resulting block, by using the signature algorithm in the prolog of the deadline and the given private key.- Parameters:
description- the descriptiontransactions- the transactions inside the blockstateId- the identifier of the state of the application at the end of this blockprivateKey- the private key for signing the block- Returns:
- the non-genesis block
- Throws:
SignatureException- if the signature of the block failedInvalidKeyException- if the private key is invalid
-
genesis
public static GenesisBlock genesis(GenesisBlockDescription description, byte[] stateId, PrivateKey privateKey) throws InvalidKeyException, SignatureException Yields a genesis block with the given description. It adds a signature to the resulting block, by using the signature algorithm specified in the description and the given private key.- Parameters:
description- the description of the blockstateId- the identifier of the state of the application at the end of this blockprivateKey- the key used for signing the block- Returns:
- the genesis block
- Throws:
SignatureException- if the signature of the block failedInvalidKeyException- if the private key is invalid
-
from
public static Block from(io.hotmoka.marshalling.api.UnmarshallingContext context, ConsensusConfig<?, ?> config) throws IOExceptionUnmarshals a block from the given context. It assumes that the block was marshalled by usingBlock.intoWithoutConfigurationData(io.hotmoka.marshalling.api.MarshallingContext).- Parameters:
context- the contextconfig- the consensus configuration of the node storing the block description- Returns:
- the block
- Throws:
IOException- if the block cannot be unmarshalled
-
from
public static Block from(io.hotmoka.marshalling.api.UnmarshallingContext context) throws IOException, NoSuchAlgorithmException Unmarshals a block from the given context. It assumes that the block was marshalled by usingMarshallable.into(io.hotmoka.marshalling.api.MarshallingContext).- Parameters:
context- the context- Returns:
- the block
- Throws:
IOException- if the block cannot be unmarshalledNoSuchAlgorithmException- if the block refers to an unknown cryptographic algorithm
-