NxtFi
  • NxtFi Blockchain
  • Testing Network
  • Block Viewer
  • Playground
  • Authentication
  • Create New Block
  • Blockchain Libraries
    • NxtFi Tools
    • Javascript - CreateBlock
  • Smart Contracts
  • The Storage System
  • Upload Media Files
  • Blockchain API Interactions
  • Access Control Layer
    • How it Works
    • Syntax & Smart Contract requirements
    • Example
  • API - Listing Files
  • API Reference
    • Get node health
    • Get the last block
    • Get block information by hash
    • Get block information by timestamp
    • Get block information by height
    • Get files from storage by scope
    • Storage tracking interactions
    • Storage tracking timestamp block info
    • Submit new block
    • Presign media file upload
Powered by GitBook
On this page
  • NPM Library URL
  • Library for backend developments interactions
  • ENV Variable
  • Integrated module functions
  • clientSign
  • submitBlock
  • confirmBlock
  1. Blockchain Libraries

Javascript - CreateBlock

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

PreviousNxtFi ToolsNextSmart Contracts

Last updated 1 year ago

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

npm: @guerrerocarlos/blockchainlibnpm
Logo