Javascript - CreateBlock

It is a JavaScript library created to generate and send blocks to the NxtFi blockchain according to the network specifications.

NPM Library URL

Library for backend developments interactions

ENV Variable

Define the blockchain endpoint to use as an ENV variable:

export BLOCKCHAIN_ENDPOINT=https://test-001-node.cloud.nxtfi.org/v2

Integrated module functions

clientSign

This function is used to obtain the signed block that will be sent to the blockchain in the submitBlock function.

Parameters:

  • SIGNER (Entity, name of authorized pubKey)

  • SCOPE (Signer, Child scope, or SC hash)

  • BLOCK CONTENT

  • PATH TO PRIVATE KEY

Return => signedBlock.

submitBlock

This function is used to send the signed block and register it on the blockchain.

Parameters

  • SIGNED BLOCK

Return => result.data

confirmBlock

This function is used to confirm submitted blocks and check whether they have been propagated successfully or not. It continuously checks for a maximum of 10 seconds or until finalization time is achieved.

Parameters

  • HASH (submitted block hash)

  • i (Optional. Seconds to reduce tolerance from default 10sec)

Return => result.data

Last updated