Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request block history over web socket #1210

Closed
takemiyamakoto opened this issue Jul 15, 2021 · 0 comments
Closed

Request block history over web socket #1210

takemiyamakoto opened this issue Jul 15, 2021 · 0 comments
Assignees
Labels
iroha2-dev The re-implementation of a BFT hyperledger in RUST

Comments

@takemiyamakoto
Copy link

In general we have two types of clients who can interact with blockchain node:

users with help of their gadgets and web apps. They usually just request latest state of blockchain so they use queries and they do not need streaming too much.
external program components which can interested in getting stream of blocks

As an examples of second type clients we can consider:

external component which can subscribe to blocks and put them into OLAP database for advanced analytics other blockchain
external component which can process blocks and provide blockchain explorer capabilities for users
external component which can be an oracle so it consumeы blocks and can respond with extrinsic in blockchain
etc

For such clients preferable way of interaction is a streaming of blocks. It allows utilize resources better and get blocks as soon as they were produced. Additional to implementing feature of streaming blocks it is reasonable to allow to specify block number from which stream of blocks must start.
Let's say current height is 1000 and blocks have persisted in the node. Client can specify starting block number as 950. In this case first block in stream will have block number 950 and then will be send all persisted blocks until block with number 1000 and then will be sent all next blocks was produces since subscription begins(1000+).
Motivation for this feature it is that external component can be down for some time so the block that was produced during downtime will be missed. Handling such case require additional logic before the component starts and it makes processing of blocks more complex. Specifying next required block allows to our node clients make block processing simpler and smoother so it makes work with our blockchain more developer friendly.

@takemiyamakoto takemiyamakoto added the iroha2-dev The re-implementation of a BFT hyperledger in RUST label Jul 15, 2021
@takemiyamakoto takemiyamakoto added this to the i2 Preview Release 1 milestone Jul 16, 2021
@takemiyamakoto takemiyamakoto removed this from the i2 Preview Release 1 milestone Sep 22, 2021
@mversic mversic self-assigned this Nov 23, 2021
appetrosyan pushed a commit that referenced this issue Dec 16, 2021
* move transaction related functionality to data_model/transaction module

Signed-off-by: Marin Veršić <marin.versic101@gmail.com>

* split web socket event producer and consumer

Signed-off-by: Marin Veršić <marin.versic101@gmail.com>

* use publisher/subscriber terminology

Signed-off-by: Marin Veršić <marin.versic101@gmail.com>
appetrosyan pushed a commit that referenced this issue Dec 20, 2021
* move transaction related functionality to data_model/transaction module

Signed-off-by: Marin Veršić <marin.versic101@gmail.com>

* split web socket event producer and consumer

Signed-off-by: Marin Veršić <marin.versic101@gmail.com>

* use publisher/subscriber terminology

Signed-off-by: Marin Veršić <marin.versic101@gmail.com>

* add block streaming over websocket to torii

Signed-off-by: Marin Veršić <marin.versic101@gmail.com>

* add server side tests

Signed-off-by: Marin Veršić <marin.versic101@gmail.com>

* refactor implemented block streaming code

Signed-off-by: Marin Veršić <marin.versic101@gmail.com>

* update api_spec

Signed-off-by: Marin Veršić <marin.versic101@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
iroha2-dev The re-implementation of a BFT hyperledger in RUST
Projects
None yet
Development

No branches or pull requests

3 participants