Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I retrieve the hash of ipfs object?

Tags:

ipfs

After I add a file to ipfs using ipfs add hello - how to do I retrieve the hash for the file if I lose it?

I guess I'm expecting ipfs info <filepath> or something similar?

like image 802
significance Avatar asked Jul 09 '16 17:07

significance


People also ask

How do I view contents of IPFS?

Alternatively, you can access IPFS content from any browser by using a public gateway such as https://ipfs.io or https://cloudflare-ipfs.com. A gateway will automatically route you to IPFS content using the link, and there's a long list of alternative gateways available.

What is the IPFS hash?

IPFS is fundamentally a Distributed Hash Table (DHT) Open external link which maps from CIDs to people who have the content addressed by that CID. The hash table is distributed because no single node in the network holds the entire table.

Where is IPFS data stored?

IPFS is a decentralized, peer-to-peer file sharing protocol. The IPFS network runs on the web and uses content-addressed storage (CAS) to store data and retrieve it based on its content, not its location. IPFS uses this method to uniquely identify and fetch the data in question.


3 Answers

If you want to see what the hash of a file would be, without actually uploading it to IPFS, you can run ipfs add --only-hash, or ipfs add -n for short.

like image 182
lawrence Avatar answered Sep 24 '22 20:09

lawrence


just run ipfs add hello again...

like image 27
significance Avatar answered Sep 22 '22 20:09

significance


Make sure ipfs daemon is running before proceeding.

ipfs get theHashOfTheItem in the command line will print out the raw data/ text of the block corresponding to that particular hash

To get a list of objects with the hash that is hosted on your computer, you may run the daemon using ipfs daemon followed by going to and checking under Files.

http://localhost:5001/webui

I remember reading a way to get the list of hashes via the command line, but I can't seem to remember it. Once I get it, I shall post the details about that here as well.

Not ideal, but checking the information each hash stores, either by using the command shared on top or clicking on the files itself within the browser should let you find the hash you are looking for.

like image 34
Varun Agarwal Avatar answered Sep 22 '22 20:09

Varun Agarwal