# Accessing block info(JS, NodeJS), Beginner level

**by Delbypoc**

\ <br>

This tutorial is for educational purposes only, I’m not responsible for any losses, damages, or other liabilities which may occur by using any info/code provided here(or anywhere else it is posted).

!\[Graphical user interface, text

Description automatically generated]\(<https://www.matrix.io/gitbook/Guides/Guides_18.fld/image001.png>)

I’m under no circumstances a Javascript professional (or a JS Ninja/Expert)!

The code is not production ready! (only for learning purposes)

In this guide, I’m going to show you how to access specific details from a block (for example transactions)

We will make use of the following package : ‘aiman’.

You can install it by using :

npm install aiman

We can initialize it with an HTTP provider like this:

![](https://www.matrix.io/gitbook/Guides/Guides_18.fld/image002.png)

If we would like to access info for the 5 mil block, for example, we can declare a variable then create a promise:

!\[Text

Description automatically generated]\(<https://www.matrix.io/gitbook/Guides/Guides_18.fld/image003.png>)

After solving the promise we will be able to access the following details:

!\[Graphical user interface, text

Description automatically generated]\(<https://www.matrix.io/gitbook/Guides/Guides_18.fld/image004.png>)

We can also access the transactions info which has the following details:

!\[Text

Description automatically generated]\(<https://www.matrix.io/gitbook/Guides/Guides_18.fld/image005.png>)

In the next part I’m going to print the block hash + difficulty and all of the transactions hashes:

!\[Text

Description automatically generated]\(<https://www.matrix.io/gitbook/Guides/Guides_18.fld/image006.png>)

The output for block 5.000.000 should look like this:

!\[Text

Description automatically generated]\(<https://www.matrix.io/gitbook/Guides/Guides_18.fld/image007.png>)

Whole program ([**https://github.com/CognitiveProcessing/Matrix-AI-Network-Code-Snippets/blob/main/js/sendManTransaction.js**](https://github.com/CognitiveProcessing/Matrix-AI-Network-Code-Snippets/blob/main/js/sendManTransaction.js))

!\[Text

Description automatically generated]\(<https://www.matrix.io/gitbook/Guides/Guides_18.fld/image008.png>)

For more documentation you can check [**dev.matrix.io**](https://www.matrix.io/blog/dev.matrix.io)

&#x20;


---

# 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.matrix.io/guides/accessing-block-info-js-nodejs-beginner-level.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.
