How to query Nexa Rostrum API using Postman

jQrgen
3 min readSep 3, 2024

--

The Nexa blockchain provides a robust platform for handling decentralized transactions and supports custom tokens, making it versatile for various applications. Interacting with Nexa programmatically can be achieved through the Nexa Rostrum API. This tutorial will guide you through the steps to query the Nexa Rostrum API using Postman, a popular API development tool. Whether you’re new to blockchain or an experienced developer, this guide will help you set up Postman, create a WebSocket request, and successfully retrieve data, including token information, from the Nexa network.

Install Postman

Download Postman from postman.com/downloads and follow the installation instructions.

Open PostMan and choose: “…continue with the lightweight API client.

Screenshot from the first screen when opening Postman

Create a WebSocket Request:

You are now on the main Postman screen. Click the
“New”-button at the top left of the PostMan window.

Click “New”

Select WebSocketfrom the menu.

Selecting Websocket in the menu

Set the WebSocket URL:

Enter the WebSocket URL: wss://electrum.nexa.org:20004.

Enter URL

Click the blue “Connect”-button to connect the Rostrum instance and view a successful response in the Postman logs response logs:

Successfully connected

Enter the JSON Payload

Enter the following JSON payload one-liner in the message field:

{"id":0, "method":"token.genesis.info", "params":["nexa:tzjntmuvat5px5fp44auwpcjuqk4dkxz5wtysal4e3wmmut08yqqqy2ltpmwz"]}

This calls the token.genesis.info Rostrum endpoint, which returns the Info from token creation transaction.

JSON payload

Click the blue “Send”-button to query Rostrum. You should get the following response:

Logs

You should now receive this complete JSON response from Rostrum:

{
"id": 0,
"jsonrpc": "2.0",
"result": {
"decimal_places": 2,
"document_hash": "e0e5d6fd940715de97177e5ae9fc4de09e9be85a6c33e040d45b169b8d30a0ce",
"document_url": "https://agnar.pages.dev/public/agnar.json",
"group": "nexa:tzjntmuvat5px5fp44auwpcjuqk4dkxz5wtysal4e3wmmut08yqqqy2ltpmwz",
"height": 569514,
"name": "AGNAR",
"op_return": "6a0438564c050541474e41520541474e41522968747470733a2f2f61676e61722e70616765732e6465762f7075626c69632f61676e61722e6a736f6e20cea0308d9b165bd440e0336c5ae89b9ee04dfce95a7e1797de150794fdd6e5e052",
"ticker": "AGNAR",
"token_id_hex": "a535ef8ceae8135121ad7bc70712e02d56d8c2a3964877f5cc5dbdf16f390000",
"txid": "c133e7e5cdaaed288c6222aba454ffc290825954902226e0638f25f2af7532d5",
"txidem": "271e295534c3795b2629e0613661140bb2ba10df5fe7a2346980b9ae7a68a2c9"
}
}

Querying the Nexa Rostrum API using Postman offers a powerful way to interact with the Nexa blockchain and retrieve on-chain data. Following the steps outlined in this tutorial, you should be able to establish a WebSocket connection, send JSON-RPC requests, and view the responses from the Nexa blockchain. This enhances your ability to develop blockchain applications for Nexa and provides a strong foundation for exploring the extensive functionalities of the Nexa blockchain.

Further, explore calling other Rostrum methods at https://bitcoinunlimited.gitlab.io/rostrum/protocol/methods/

Read more about building on the Nexa blockchain at https://nexa.org/build

--

--