Skip to content
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

How can use the hash returned by put method #480

Closed
marciok opened this issue Oct 21, 2018 · 2 comments
Closed

How can use the hash returned by put method #480

marciok opened this issue Oct 21, 2018 · 2 comments
Labels

Comments

@marciok
Copy link

marciok commented Oct 21, 2018

At the documentation there's the following:

const hash = await db.put({ _id: 'QmAwesomeIpfsHash', name: 'shamb0t', followers: 500 })

So a hash is returned when I insert a new document, let's say if I want to find the inserted documented by its hash how could I do it? When I try to find it using cat nothing is returned.

I want that to store that hash on ethereum and be able to access it

Thanks is advance.

@DanielVF
Copy link

That hash is the IPFS address of that update (called an entry Entry). It contains pointers from that update to all previous Entries that your instance of this OrbitDB database knows about.

Orbit DB stores each Entry in an IPFS object. This is a lower level than the usual IPFS commands operate at. To read it, you'll want to do an ipfs object get YOURHASH, then get the data field and parse it as json.

@aphelionz
Copy link
Member

We cover this pretty extensively now in the new OrbitDB Field Manual. Check out the Tutorial section, particularly Chapter 2 which covers reading and writing data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants