# 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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.nxtfi.org/blockchain-libraries/javascript-createblock.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
