Create New Block
Here you will find the description on how new blocks structure should be configured
Last updated
Here you will find the description on how new blocks structure should be configured
Last updated
IMPORTANT: To write new blocks on the blockchain, an administrator must first register a public key and thus obtain the necessary permissions, please see the Authentication section.
Read the height and hash of the last block of the scope. See example here.
Authorized key-pair. See Authentication.
The following data is required to build a new block:
prevHash
: Hash of the last block of the scope
height
: Height of the last block of the scope + 1
version
: API version, at the time of writing this documentation is 2
data
: Block content: Any type. will be stringified as default.
timestamp
: Tiemstamp in Unix format
scope
:Name of the scope in which to write. This could be signer, child, or Smart Contract hash (soon to be SC alias).
by
: Name of the authorized signer. Owner of the key-pair used to sign
signature
: Block signature
hash
: Hash of the new block
To obtain the last two fields, it is necessary to go through a process to sign and generate the hash of the new block, which is explained below.
The procedures explained below can be safely executed through the implementation of our official libraries.
The signature of a new block is generated using a cryptographic tool that generates a hash based on the RSA-PSS algorithm.
The data used to generate the signature is an object that contains the following information:
{ prevHash, height, version, data, timestamp, by, scope }
Example:
Once you have the signature of the block, you must generate the new hash using the SHA-256 cryptographic algorithm.
The data used to generate the hash is an object that contains the following information:
{prevHash, height, version, data, timestamp, by, scope, signature }
Example: