oasisprotocol / oasis-core

Performant and Confidentiality-Preserving Smart Contracts + Blockchains
https://oasisprotocol.org
Apache License 2.0
338 stars 112 forks source link

Add a WatchTransactions API call #2943

Open Reisen opened 4 years ago

Reisen commented 4 years ago
SUMMARY

When extracting data from the chain It's possible to call GetTransactions one by one for every block in the chain, but this is actually very slow - especially when trying to sync with the network. Most likely the slowdown is due to the round-trip time of having to fetch an entire Tendermint Block for each call.

It would be awesome to have something like a WatchTransactions endpoint that can quickly forward transactions as they're being processed.

ISSUE TYPE
COMPONENT NAME

I think this would apply to the consensus module, where the GetTransactions API method is currently exposed.

ADDITIONAL INFORMATION

For my current use-case, I want to process all transactions on the chain from initial sync in order to extract information and perform analytics. This is too slow using the GetTransactions endpoint.

kostko commented 4 years ago

Thanks for the suggestion, I think this should be easy to add.

Depending on your use case, you could also use GetEvents of the corresponding service (e.g., staking) if you are only interested in events resulting from transactions and block processing and you don't need full transaction data.

Reisen commented 4 years ago

Sadly I do, I opened another issue on it: https://github.com/oasislabs/oasis-core/issues/2944

Main problem there is that there's no height/transaction hash or anything of that kind coming back from those calls which makes them mostly useless for my use-case. I'm trying to index data on the chain. The Watch* APIs don't cover quite a few transactions as well.