0

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 Answers1

0

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!

  • Thanks, I was looking for a push based solution rather than pull based like getting block periodically. Either with web socket or with gRPC if possible – farukterzioglu Feb 22 '21 at 06:59
  • I think you need to use github.com/cosmos/cosmos-sdk/x/bank/types Then you can use grpc via grpcurl or programmatically via Go. Here's an example from the documentation: https://docs.cosmos.network/master/run-node/interact-node.html#using-grpc Here's the protobuf documentation: https://docs.cosmos.network/master/core/proto-docs.html – Daniel Harapko Feb 22 '21 at 12:20
  • If you want to get historical data, then I don't know how to get it through the websocket. I don't think this can be done. – Daniel Harapko Feb 22 '21 at 12:23