Create New Block

Here you will find the description on how new blocks structure should be configured

circle-info

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.

Requirements

Build a new block

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.

circle-info

The procedures explained below can be safely executed through the implementation of our official libraries.

Sign a block

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:

Generate a new hash

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:

Last updated