How to get historical events with the Tendermint websocket via /subscribe method?

1.4k Views Asked by At

I am subscribing to the events of Tendermint (like new transactions) with the code below;

query := "tm.event='Tx'"
txs, err := client.Subscribe(ctx, "some-consumer", query)

or from terminal as;

wscat --connect ws://0.0.0.0:26657/websocket
> { "jsonrpc": "2.0", "method": "subscribe", "params": ["tm.event='Tx'"], "id": 1 }

I am getting the events as they arise but how can I get the historical event, e.g. starting from a specific block?

1

There are 1 best solutions below

3
On

I think you should use the HTTP from github.com/tendermint/tendermint/rpc/client/http. Then you can make requests like Block(context, height), Tx(context, hash, prove), and many others!