-
Notifications
You must be signed in to change notification settings - Fork 8
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
Block lineage tracking #142
Comments
Here's a suggestion for how we might implement lineage tracking in This approach relies on the typical "palm-tree" shape of the blockchain history. I.e. even though the full history of a blockchain has the shape of a tree, the tree is mostly linear with very short branches diverging from it throughout its history. In this approach, we'd have a new CREATE TABLE lineage (
id BIGSERIAL PRIMARY KEY,
chain_id INT NOT NULL,
branch_height BIGINT NOT NULL,
parent BIGINT
); We'd also add a new CREATE TABLE block_lineage (
hash TEXT UNIQUE NOT NULL,
lineage BIGINT NOT NULL REFERENCES lineage(id)
); In this approach, whenever we detect a branch in the block history we create a new With these tables in place, one can efficiently perform lineage queries by checking the lineage of a given
Note that when we first encounter a block, we don't know whether it's an orphan or not. That fact may not even have been determined by the network yet in the first place. So that means we'll need to extend
|
Since most orphan branches are very short-lived, we could also consider a simpler approach where we just add an Due to the short length of orphan branches, analyses similar to my previous suggestion should still be efficient. If one is interested in figuring out whether
This should almost certainly be efficient, since we expect |
The goal of this issue is to implement an efficient lineage tracking for
chainweb-data
. Currently, there's no efficient nor straightforward way to deduce lineage information about a block or any data that derives from a block. For example, if one wants to determine whether a block is an orphan or even worse, if one wants to jump from a continuation transaction back to its earlier steps that are in their blockchain history one would need to perform complex and expensive SQL queries.The text was updated successfully, but these errors were encountered: