How To Store Unlimited Data On-Chain Using Merkle Trees, Typescript, Solidity, and Hardhat

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 พ.ย. 2024

ความคิดเห็น • 11

  • @StuartJ
    @StuartJ ปีที่แล้ว

    Well explained. Streamr recently announced a project called Log Store. It provides tamper-proof storage for your data streams.

  • @durham7576
    @durham7576 ปีที่แล้ว +1

    Thank you so much for your tutorial! One quick question: Can we add new elements to the Merkle tree and update the root of the tree to make the proof still works?

    • @chainlink
      @chainlink  ปีที่แล้ว

      Hey, great question!
      If you add new elements to the tree, the root MUST change. You could either regenerate the entire tree, which is easy but inefficient. If you had a very large tree, you should consider regenerating the path from the new leaf (element) to the root. Every hash from the leaf to the root, including the leaf and the root, would need to be recreated.
      The basic steps would be:
      Add the leaf: Append the new leaf (data) to the bottom-most level of the tree.
      Recompute the hash: Calculate the hash of this new leaf.
      Update parent nodes: Recalculate the parent nodes' hashes by taking the hash of the concatenation of their child nodes. If the new leaf has no sibling, consider it as its own sibling for this step.
      Recompute up the tree: Repeat step 3 recursively for each level up to the root.
      Replace the root: The old root will be replaced with the new one.
      Thanks
      -Richard G, Chainlink Labs Developer Advocate

  • @anujtanwar2215
    @anujtanwar2215 ปีที่แล้ว +1

    Small, to the point, easy 🤝🏼

  • @johncramer9912
    @johncramer9912 ปีที่แล้ว

    Thank you!

  • @puckfigs9963
    @puckfigs9963 ปีที่แล้ว

    🎉🎉🎉

  • @CarlosRamirez-yk6wv
    @CarlosRamirez-yk6wv ปีที่แล้ว

    How you store on chain if you don’t have the machines to do that? Where it’s stored?

  • @CarlosRamirez-yk6wv
    @CarlosRamirez-yk6wv ปีที่แล้ว

    Wrong title, misinformation

  • @3obby
    @3obby ปีที่แล้ว +2

    I took this entire video and compressed it down to just one emoji: 🦥