Public API's to retrieve block information

I am trying to get transaction information using the NEM REST API, but I can’t find any nodes that have it enabled. I have a list of nodes that should be accessible, but return 404 errors when I request anything but /chain endpoints.

List of nodes:
https://nodeexplorer.com/api_openapi_version

Allowed request:
http://157.7.197.62:7890/chain/score

Not allowed:
http://157.7.197.62:7890/block/2286080/transactions

According to the docs this should work. Is there any way to get this information without setting up your own node?

API docs:
https://nemtech.github.io/endpoints.html#tag/Block-routes

That’s because you’re using a NIS1 node to access Catapult (NEM2) endpoints. Node Explorer only contains NIS1 nodes.

The Foundation setup a small testnet, which you can find here: https://docs.google.com/document/d/1d71R1WRFZF3Vt8xhfn1sW3N2LyarO8yf7Eb1-qagxBA/edit
Make sure you use the REST endpoints

For example, try this node: http://52.194.207.217:3000

Which version are you trying to develop on?

Thanks for the reply.

I don’t really know which version I should use. I want the blocks from the live block chain. Is that possible at the moment?

If you want to access the current mainnet (that has been going since 2015) that utilizes the current XEM currency, use NIS1. This chain has history and has been up for a while.

If you want to start experimenting with new features, the new chain (Catapult) is still under development and to be finished by the end of the year. The testnet linked above may very well change / be wiped as time goes by and new versions are released.

It really depends on what you want to do.

Seems it is impossible what I want to do. I want to retrieve all transactions of a specific block, but there seems to be no endpoint that does that.

Hello. If you want use NEM1 (current mainnet) then here is API documentation -> https://nemproject.github.io

You can fetch block data with /block/at/public. For example:

curl -i -X POST
-H “Content-Type:application/json”
-d
‘{
“height”: 2288020
}’
http://176.95.26.121:7890/block/at/public

This will not give you informations about transaction hashes.
If you want hashes you must use local node and api call /local/chain/blocks-after

That is what I thought. Will this be possible in the future with the new release?

Yes. In Catapult (NIS2) you have also API for that. You already linked it https://nemtech.github.io/endpoints.html#operation/getBlockTransactions

1 Like

But that is still in testing isn’t it? If not, is there a list of public nodes that accept the endpoints?

Try here

specifically this table:

Protocol Host Port
http 52.194.207.217 3000
http 3.1.202.148 3000
http 13.114.200.132 3000
http 47.107.245.217 3000
https jp5.nemesis.land 3001

Thank, request work here, but I want to have the live data. Guess I will have to wait for the official release for the live version then.

for live data, use websockets as shown in this guide: https://nemtech.github.io/guides/blockchain/listening-new-blocks.html#listening-to-new-blocks

3 Likes