-
Notifications
You must be signed in to change notification settings - Fork 6
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
perhaps fn verified_by() need more comments #7
Comments
Ah yeah, good question! We should write a better version for this for the book, but here's some notes on how verification works with A PR for a better description based on ^ would be very welcome! -- also happy to answer any questions you might have around this, as I think I have a good grasp on it nowadays :D |
emmm.. I don't know what verification and signature is. |
Ummm, I don't know if my explanation makes much sense here! -- I always struggle explaining this stuff back -- and that's not a good sign. I need to do better here; sorry if things are not clear! |
Thanks for telling me what things I should know first! I've learned digital signatures and blockchain a little. Within the notes, you said verifying a sig is expensive, but verifying the signature (proof-of-work) of new block in blockchain is easy, produce is difficult. So I guess the In a word, why we need signature and verification here, Is there some examples? And what's the difference between the return value |
Produced with print-flat-tree. Before we go in, it's important to know that we have 2 trees with the exact same layout. In In the viz above, you can see numbers in yellow, white, blue and green.
Hope this somewhat makes sense? So when you call All of this hasn't been reviewed btw, it's just a quick draft of my best-effort understanding of how things work. I want to write some more about it for the guide, and let some people review it to make sure it's 100% accurate. Hope this is somewhat helpful though! |
Thanks! Very helpful. |
But look at hypercore/feed's fn append(), It only writes the merkle-tree data to the tree storage, signatures storage and data storage are not tree: self.storage.write_data(self.byte_length + offset, &data)?;
// ...
self.storage.put_signature(index, signature)?;
for node in self.merkle.nodes() {
self.storage.put_node(node)?;
}
Yeah! I see it: let hash = Hash::from_roots(self.merkle.roots());
let index = self.length;
let signature = sign(&self.public_key, key, hash.as_bytes());
self.storage.put_signature(index, signature)?; And |
tree-index/src/lib.rs
Line 236 in 82e189e
It's hard to understand the function of
fn verified_by()
by reading the test code and the current comment.The text was updated successfully, but these errors were encountered: