New Ethereum talks, every Monday. The week's conference uploads by event, in your inbox.

Loading player…

Binary Merkle Tree and BMT-JS, and its versatility.

SwarmSun, Oct 9, 2022, 12:00 AM

https://fairdatasociety.org/ https://www.ethswarm.org/ Github: https://github.com/fairDataSociety/bmt-js About the video: Core Dev Nugaon presents the Binary Merkle Tree and BMT-JS, and its versatility.

Transcript

so the bmt gs is a gs library and [Music] it's uh it's an acronym for binary marker 3. and with that you can splice up the data into 32 byte bytes of segments and you can hash it until it's swarm hash basically so everything that you would upload to b to your b client uh it returns you a swarm reference um with which you can retrieve the file later from this form network and with this library you can without the big client you can you can calculate this form reference of any file if any data and it can be used also to sort out the segments the required segments for for cheap inclusion proofs so the biomarker 3 itself you can imagine like a pyramid and the bottomless level is the data level which is spliced up into 32 bytes segments and the algorithm itself takes the it takes the segments in pairs so this 64 bytes so 2x32 is the input to the to a hashing algorithm that results in 32 bytes and that's gonna be the level above and it does until you have only one 32 bytes segment it's kind of a reference uh us form the the smallest amount of data that you can retrieve is four kilobytes it's called chunks and the chunks can uh can have these four four four kilobytes of data and if it's lesser then it's just padded until the end with zeros and and if your data is larger than four kilobytes you have more chunks physically so the chunks also have their own levels there are the data chance in the bottomless level and above the intermediate chunks and the top of the pyramid you will have the root chunk that's addressed the chunk address will be basically the file address and above above the the chunk level you have intermediate chunks that basically just include chunk references to the to the bottom level to the closest bottom level of that tree and yeah that's it and you can leverage the the this attribute of the pmt hashing because you can you can provide cheap inclusion proofs just providing these sister segments of of any arbitrary 32 by segments of the data so for example you have eight gigabytes of data you have to just provide lesser than one kilobyte of sister segments that you can upload for example to a smart contract to prove something under this file address there is this data so you can use for various things this library for example in sponsor is a required feature for uploading just the change changes of a file directory for example you are developing a front-end application and you want to just upload and pay for the differences i mean compared to what you uploaded before and for that you don't have to interact with the big client as i mentioned because you just calculate these form hashes of the files of every files of that directory and compare it to the manifest listed files because the manifest basically a directory list of of the files uh libon's form and if you have some different different form hash in that manifest you just change it and update it and you basically uploaded just just the difference from the previous version and then you also have opportunity of course the create some some logic in small contracts around any file and then you can also create a logic in the smart contract and use the inclusion proof feature of this library to prove whether any arbitrary data is observed under one's form reference but this data has to have random access and then the storage incentive feature also will use this capability and and last but not least it also can be used in a full javascript implementation in browser of the this form client later because the bmt algorithm itself is a crucial component of that client so the fedra protocol which is basically the fed data protocol aim set these small contracts usage of the inclusion proofs with binary marker trees and the preparing now currently a library called psan which will be completely json compatible sterilization for exactly this use case so every attribute you can you can improve in 32 bytes of resolution you can just serialize in one way adjacent object and it's gonna have a separate api representation of the object that also can be approved in in smart contract but not necessarily and and the data implementation section so these two parts can be totally separate from each other and it's gonna be really cool

Automatic transcript — names and jargon may be misspelled.