Closed Spl3en closed 5 years ago
Hi, @Spl3en. Before checking if it would be feasible or not, I wanna know about your purpose of using the bulk API calls such as get_many_blocks in detail. Why do you need it? What is your purpose of the API in detail? In which service would you use it and how to use it?
Right, good question, let's discuss that.
In the current situation, I would like to use it for the ICON Transaction Tracker I made a month ago. Everyday, I need to retrieve an history of the latest transactions on the ICON blockchain in order to keep up to date the transactions monitor.
At this point, I was able to retrieve transactions / blocks content using an ICON official Tracker endpoint, by calling https://tracker.icon.foundation/v3/transaction/recentTx?page=1&count=700000
for listing all the transactions on the ICON blockchain.
This is a really dirty hack, as I believe the tracker is not supposed to provide such service, or it may limit the number of transactions returned by my previous request at any moment, or it may change the API endpoint name after an update without me noticing it.
I would prefer such service to be provided by the SDK, hence my current request.
I may agree that it is a weird case. I'm not sure if "legit" applications may need get_many_blocks
at all, but I believe all applications that need to inspect the ICON blockchain will need it.
Okay, I understood it.
By the way, I have some reservation about supporting for such service by SDK.
I think there is no difference between calling get_block
many times and calling get_many_blocks
once. Because inside of get_many_blocks calls that API many times too.
Indeed, I entirely agree that it doesn't make sense if you can't bulk the API calls from the SDK. I though it would be feasible. So I should do that request in the icon-service repository if I need it to be implemented for all SDKs.
Thanks a lot for your answer !
Hi 👋
Currently, we're able to use the SDK in order to retrieve a single block or transaction, using
get_block
orget_transaction
with a block height or a transaction hash.I've been wondering how are we supposed to use the SDK if I want to retrieve the latest 1000 blocks ? Currently, I don't think there is another solution than calling 1000 times the API - which is slow and I believe not a good solution.
What do you think about allowing bulk calls, such as retrieving multiple blocks in one API call would be written as
get_many_blocks([0, 1, 2, 3, 4])
, and would return blocks with height 0, 1, 2, 3 and 4 ?I wouldn't mind using the existing
get_block
instead of creating a new API method, ifget_block
takes an array of integer as a parameter, then it returns an array of Block.Am I missing something ? Would it be feasible ?