How to listen transactions over an rpc connection or socket without using indexer tool?


I’m a developer who works in a crypto exchange company and want to list algo in our exchange.

We successfully installed node and it’s dependencies and thank you for your detailed instructions and samples.

Is there any way to listen transactions which comes to one of my addresses in my node?

I found Indexer tool but if you have an rpc or socket server on node, I’ll be really pleased.

Because as I understand I need to install postgre and make node an archival one which will be really needs attention for me. Also, I can’t work it in fast catchup mode.

If you have any suggestion or proper way that you can show me, I’ll be really pleased.

P.S. I have an hurry for that.
P.S. I want to contact with a developer from Algorand team who know rpc and web socket endpoints in other crypto nodes.

Best regards.

I am not sure on the rpc or socket on a node, but will look into that. Two other options on indexer for MainNet / TestNet in addition to building your own, are API services from PureStake and Rand Labs. Also, indexer is available on Sandbox now on a Private Network using sandbox for testing purposes.

Hi @hotv, I am not completely sure what you mean by “socket”. All connections normally uses a socket. Our API (algod v2 and indexer v2) are REST-based and not RPC-based.
In particular, the protocol is not the same as Bitcoin that is RPC-based.

If you just want to get all transactions, you may just request blocks one by one on algod v2: Algorand Developer Docs

If you need more advanced queries, you most likely want to use an indexer.

1 Like

Perhaps just have a basic poller that grabs a block at a time and pushes all transactions to an event bus/queue? You could then have multiple parallel listeners looking for their individual accounts.

Hi @fabrice, I think you couldn’t understand what I asked. So, you can’t help me.

Hi @aojjazz, when we will grab a block? In which period, in every x miliseconds or seconds? What if we can’t grab one of them?

Hi @fabrice, these are for you.

What is rpc?

What is socket?

I’m not sure what exactly you’re trying to achieve, so my answer might not be what you’re looking for.
If you could describe the “interface” you’re looking for, it might be easier to come up with some concrete solutions.

The general “recipe” for monitoring the activity on the Algorand blockchain is to place an indexer daemon in front of it. The indexer would pick up any new block and attempt to insert it into a Postgres database. On that database, you could create additional triggers that would insert the data you’re after into separate custom tables ( i.e. depending on the precise needs of your application ).

If all you need is to send/receive/confirm transactions, then any of the SDKs would do what you need.

If you are going through the route of fetching all the blocks, you can use the endpoint Algorand Developer Docs to wait for the next block to be ready.

But the best way is most likely to use the indexer anyway.

Hi @tsachi, @fabrice,

We found an awkward way to get needes tx from blocks and got the sender and reciever addresses amount and etc… but we couldn’t get txid from that object. How can we get txid from this object?

Object is like below

@hotv ,

The above looks like the msgp of the SignedTxnInBlock; am I correct ?

If so, while you can definitely use it, I would discourage you from doing so. The internal block storage format might change over time, and there won’t be any developer notification for that as long as it won’t break the REST API backward compatibility.

The main “consumer” for that is currently the indexer, which performs the decoding and calculating the transaction id.

Calculating the txid from the above is definitely doable though; you can look into the source code how it’s being done. Essentially, you need to reconstruct the original transaction body, and then to hash the msgp encoded version of it.

@tsachi you’re correct but when I want to run indexer I had to install postgre and can’t use fast catchup and also check postgredb size, is it alive and etc…
Because of lot’s of reasons I don’t want to use indexer.

For now, I trying to decode msgp with javascript and get txid…

I think that using javascript for a prototyping a solution is a great first move.

The node is using the DecodeSignedTxn [ go-algorand/block.go at master · algorand/go-algorand · GitHub] method to reconstruct the transaction.
After that, you should be able to encode the transaction using msgp and hash it.

The result would be the transaction id. You might want to look into the javascript sdk as a code reference for figuring out how to use msgp and hashing.

I have this gripe as well. I should be able to run a non-archival node, use any SDK (like the Go SDK), fetch any of the last 1000 blocks and get all data I need from each block, cleanly and easily. ‘Almost’ everything is there but eve simple things like the Transaction ID isn’t available via the API.

Requiring the indexer for even basic fetching of block data is a huge burden on integrations. Running a non-archival node should be all that’s necessary. Requiring a full archival node (which will become significant in size - it’s already 324GB) + an indexer (~ half - so another 160+GB) just to be able to ‘watch’ transactions shouldn’t be necessary.

1 Like

Hi @tsachi ,

So far, I tried below code and different versions of it but I couldn’t get txid

var orgBlock = algosdk.decodeObj(tx.sig.buffer).block;

var rawTxId = Buffer.from(nacl.genericHash(;

var txid = base32.encode(rawTxId).slice(0,52);

this how they done in their transaction.js

Anyway, we canceled the job getting txid from block object which contains our address.

We will check transactions of our address from any kind of algoexplorer.
We will take transactions from there and check with it incoming block and if they are the same we will write that transaction id our customer’ history and etc…

İf js-algosdk had a web socket connection which streams blocks with their transaction ids with or without encryption, would be more easy to manage for us / everyone.

We don’t want to use third party tool of crypto currency copmanies.

We had the same issue on AVAX too. At the end we get in their internal unix type message socket and decrypt the message and get the needed info and in their node the endpoint is given in algo we couldn’t find that kind of endpoint.

Thank you for your help, @tsachi @aojjazz


There are few advantages in the current design:

  • it leaves the core node implementation simpler ( as it doesn’t require the node to support certain features ).
  • it doesn’t require the node to retain backward compatibility in the way opaque blocks are managed.
  • it reduces the “surface area” of the node interface, resulting in simpler REST API interface.

For more advanced needs, Algorand developed the indexer.

I agree that the indexer could be better implemented. Reviewing this thread, I can spot three distinct feature requests - indexer should not require a full archival node, indexer would be able to work with standalone sqlite database (i.e. no Postgres installation needed) and the indexer having a configurable history length. These all could be good potential improvement projects.

1 Like

@hotv A pattern for following along the actions of your algod node is two APIs: One waits for the status of a particular round number (behind the scenes this is an HTTP GET that stays open a few seconds until the round completes). The second API fetches the whole block. From there you can pick the stream of transactions out of it and filter for the ones you want. The Indexer does this here: indexer/fetcher.go at develop · algorand/indexer · GitHub

I had similar requirement for one of my project.

  1. start with the current block and poll for next block every 3 seconds.
  2. once you get a confirmed block get all transactions with in that block.
  3. use algoexplorer API with indexer to fetch the transactions.
  4. if processing of transaction with in a block is taking more than 4 seconds, then your server might end up lagging behind the current block after few days.
  5. to solve this you can span a thread when ever your current thread is still processing the past block transactions. parent thread passing on blocks to child threads. child threads will have business logic and processing the transactions.