Best practice: obtaining, filtering and subscribing to historic/new chain data

Hey guys,

there was already a thread started that discusses Event subscription and I think it is generally an important topic to define the best way for developers to obtain, filter and subscribe to historic/new chain-data.

Today I thought about providing an oracle and how I should implement the backend. The backend should subscribe to all OracleQueryTx that are calling my oracle.

Currently I am only aware of two different approaches:

  • use the middleware-application (which is actively developed and provides WebSocket support)
  • poll the chain to obtain new transactions

Is there any other way to get the data? As far as I know the WebSocket implementation on the node is only available to handle off-chain communication between state channel participants.

Which approach does the team recommend?

Best regards,

The elixir-sdk will include such functionality. It takes part in gossip happening in the aeternity network and can listen for any kind of transactions. Maybe @d-velev can explain further.

Hi Marco,

As @piwo mentioned the Elixir SDK does support event subscription. It works by connecting to peers in a network (could be mainnet, testnet or any other custom/private network) and listening to any messages that are being gossiped. Here’s an example on how it can be used:


This fragment subscribes the handler process to spend transactions that have the passed address as the recipient, it can be replaced with


for your case.

I will gladly help if you decide to set it up and are having any trouble.


That sounds really great! At least we already have an option to subscribe to events at this point of time :slight_smile:

My question was more targeting a general approach to implement this. I would like to provide subscriptions in our Java SDK and wondering about the best way to achieve this.

The way Elixir SDK is doing can probably not be adapted for other SDKs, right?

Not sure, maybe you could manage to communicate with nodes with some noise protocol Java library and work from there?