fetch serialised blocks over api
See original GitHub issueIt would be useful if there could be an implementation for the /blocks/
endpoint to fetch full blocks in serialised form over the public API. At the moment it seems the only way to get a full block is by requesting the block header from /blocks/{height|id}
and then another request to /blocks/{height|id}/transactions
to fetch the transactions, which may span multiple pages to retrieve all transactions in a single block. Being able to fetch full serialised blocks would be more efficient in cases where full blocks, including their transactions, are needed in an application and this would use less bandwidth as the response would be in hex rather than a verbose JSON object.
The public API uses gzip if requested in a HTTP header to conserve bandwidth but this is computationally expensive to compress when making multiple HTTP requests, as is the case to fetch full blocks including transactions, whereas serialised data is readily available to theoretically serve with no overhead.
This would be useful for situations and applications where it is not possible to connect via a websocket to issue a call to p2p.peer.getBlocks
. Especially as, by definition, this should only be used by peers and not general purpose applications.
It would be useful if this could be implemented in 2.6 rather than waiting for 3.0. If you do not have the resources to do this yourself, i.e. everyone is working on 3.0, I could submit a PR to do so if you would be willing to add this feature to 2.6.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Thanks, it was kind of what I expected. I’ll look into submitting a PR against
develop
when I’m more familiar with the 3.0 code base if that’s ok.This issue has been closed. If you wish to re-open it please provide additional information.