Web3 ecosystem is growing fast, along with it opportunities for the products built on blockchain. Datrics is the data analytics and data science partner for Web3, empowering blockchain teams with meaningful insights from on-chain and off-chain data. We have been building our expertise in blockchain and Web3 to help developers make better decisions and bring transparency to DeFi solutions.In this release we have focused on the features that would make it easier to build analytics for blockchain. So let’s see what is new in Datrics.
Content
- Connectors to NEAR blockchain
- REST API connector
- Convert the data frame to JSON
Build Web3 analytics with connectors to NEAR blockchain
Blockchains are packed with data and this information is open for everybody. It may seem that the case is solved, however, the next problem is insight. Datrics partners with developers to overcome challenges of Web3 analytics to derive useful information from blockchain.
We have added new bricks to Datrics.ai platform for analysts to fetch data and create transactions on NEAR blockchain. NEAR Fetch brick allows one to access the information of the specific smart contract and method. You may explore the methods on NEAR blocks. NEAR transaction allows analyst to call smart contract and record data on the blockchain.

Let’s look at the example of how it works. For instance, we need to get a NEAR balance for the nearcrowd.near account. With our no code platform you may do it in 3 steps without writing code.
1. NEAR Fetch
Call account name on the NEAR blockchain to retrieve the information. To configure the brick you need to define:
- RPC - mainnet or testnet
- Contract / Account name - nearcrowd.near
- Request Type - View account

The result is represented as JSON:

The information we requested is “amount". We may extract this using Flatten JSON and Math Formula bricks.
2. Flatten JSON to get the amount value from the smart contract response.
3. Math Formula to convert the value to NEAR coins. More on using Math formula.

Finally, we can see that the NEAR balance for nearcrowd.near account is 46’462 NEAR.
More examples on how to fetch NEAR smart contract information.
REST API connector
Every analytics pipeline starts with the data, therefore we take the data connectors seriously. There is a new API connector coming in the Datrics release 2.4.
Rest API Request brick currently supports GET requests. User may set up the logic for the request without writing any code. You can setup the brick to connect to multiple APIs, as a result, all the requests will be made in parallel to reduce the time to get the data. Out put of the brick is a data frame with the responses to all call.
How to set up the REST API Request brick?
1/ For each API provide the URL. Request parameters may be included in the url or added in the advanced settings.
2/ Additional settings:
- Alias - short name for the request. In the brick output request alias will be added as a separate column. Providing the short name help to identify the request results in a data frame
- Brick may retry the request in case of the failure. Retry after, sec - time before the retry will be made
- Number of retries - 0 by default
- Query parameters - key and value of the request parameters. You should add parameters either to the URL, or configure in the additional settings

Here’s the example. Our goal is to retrieve the prices of the BNB and BTC tokens from Binance exchange. Binance provides the open apis to retrieve the latests data.
The output of the brick contains: alias, URL, request result and retrieval time.

We have also used Flatten JSON brick to parse the results.

Now we are ready to move forward with the data analysis!
Convert the data frame to JSON
Usually, the result of the pipeline is the data frame and/or a model. To work with smart contract and push the data on-chain, one would need to transform the data frame to json.
Here where new Prepare JSON becomes useful. Brick converts input data into a dictionary followed by JSON serialization format.
The transformation options we support:

Let’s go through an example.
The input dataset to the brick has the following structure:

We can form a JSON by connecting the dataset directly to the brick.
First, we select the ‘dict’ option with no key defined and run the pipeline.

As a result, we get the following output:
