# Javascript - CreateBlock

## NPM Library URL

### Library for backend developments interactions

{% embed url="<https://www.npmjs.com/package/@guerrerocarlos/blockchainlib>" %}

## 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)<br>

Return => result.data
