Giter VIP home page Giter VIP logo

Comments (4)

daviddias avatar daviddias commented on June 15, 2024

By Merkle Proof, you mean the hash of the path? I'm happy to add that, we just need to consider the two scenarios: a) when the path leads to an object; b) path leads to a value of the object.

The answer for a) is just returning the hash of that object, however, what should we do for b)? Return the hash of the whole object? Hash that value? Open to suggestions.

from js-ipld.

wanderer avatar wanderer commented on June 15, 2024

Return the hash of the whole object?

yes, i think.
I'm going to walk through an example so i can get i straight in my brain :P
Lets say we have something like

{
  '/': {
    one : {
      {
        '/' : {
          'two' : {
            '/': {
               three: {
                 val: 'value i want',
                 somethingelse : {
                    '/' : <cid>
                  }
             }
          }
          'dontwant': {
             '/': <cid>
          }
        }
      }
    }
  }
}

and we want the proof for a given root for the path 'one/two/three/val'. The most compact form of the proof would be the json above. ipld-graph-builder generates these proofs by looking up the objects individual and replacing the '/' link with the object they resolve to. But it might make sense to do it at a low low level at of the stack so a node can send a single query and retrieve the entire proof.

But I don't see anywhere in the current stack that would allow you to retrieve such a proof. So a stepping stone would be for resolver.resolve to return an array of merkle nodes it traversed through to follow a given path. So in the above example it might return something like

[
  {'one' : {'/': <cid>}},
  {'two' : {'/': <cid>}, {'dontwant': {'cid': '/'}}}.
  {'three':  {val: 'value i want'}, {somethingelse : { '/' : <cid>}},
  {val: 'value i want'},
  'value i want'
]

from js-ipld.

daviddias avatar daviddias commented on June 15, 2024

//cc @alanshaw & @olizilla who are exploring this with ipfs-inactive/interface-js-ipfs-core#125

from js-ipld.

vmx avatar vmx commented on June 15, 2024

The resolver now returns all nodes from the root to the destination node when resolve() is called.

from js-ipld.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.