List all items stored on ipfs and corresponding hash value

From @aronayne on Fri Aug 05 2016 18:39:23 GMT+0000 (UTC)

When add an item to ipfs a hash value of the item is returned.
This hash value is used to access the item via a browser using ipfs.

The item cannot be accessed from ipfs unless have it’s hash value?

Is there a command to list all items stores on ipfs including each hash value ?


Copied from original issue: https://github.com/ipfs/faq/issues/155

From @Ghoughpteighbteau on Fri Aug 05 2016 20:46:47 GMT+0000 (UTC)

Yes, the only way to access it is with that hash. You need to know the hash of the content you want to access that content.

There is no list of available hashes either. No one has that information because that information is distributed throughout the IPFS network. It’s not in any one place.

From @jbenet on Fri Aug 05 2016 20:55:06 GMT+0000 (UTC)

try ipfs refs local to list all refs local to a node. of course, we need better porcelain commands

From @aronayne on Sat Aug 06 2016 09:44:11 GMT+0000 (UTC)

Same logic extends for command ‘ipfs init’ , in this case a hash of the ipfs content added at root level is returned and I need to also know this hash in order to access this content ?

From @Ghoughpteighbteau on Mon Aug 08 2016 18:21:41 GMT+0000 (UTC)

@adrian-git-hub-user That hash returned is the hash of your public key. The hash of your public key is special because it’s your IPNS address, it’s kinda your name on the IPFS network.

vagrant@vagrant-ubuntu-wily-64:~/go-ipfs$ ipfs init
initializing ipfs node at /home/vagrant/.ipfs
generating 2048-bit RSA keypair...done
peer identity: QmejGNNbBk62b51KVXCYNJKjPnhx7t6BckAzicSqKKqRtE
to get started, enter:

    ipfs cat /ipfs/QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/readme

vagrant@vagrant-ubuntu-wily-64:~/go-ipfs$ ipfs daemon&
[1] 2486
vagrant@vagrant-ubuntu-wily-64:~/go-ipfs$ Initializing daemon...
ipfs get Swarm listening on /ip4/10.0.2.15/tcp/4001
Swarm listening on /ip4/10.0.3.1/tcp/4001
Swarm listening on /ip4/10.10.100.6/tcp/4001
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /ip6/::1/tcp/4001
API server listening on /ip4/127.0.0.1/tcp/5001
Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080
Daemon is ready
vagrant@vagrant-ubuntu-wily-64:~/go-ipfs$ ipfs name publish /ipfs/QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/readme
Published to QmejGNNbBk62b51KVXCYNJKjPnhx7t6BckAzicSqKKqRtE: /ipfs/QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/readme
vagrant@vagrant-ubuntu-wily-64:~/go-ipfs$ ipfs name resolve QmejGNNbBk62b51KVXCYNJKjPnhx7t6BckAzicSqKKqRtE
/ipfs/QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/readme
vagrant@vagrant-ubuntu-wily-64:~/go-ipfs$ 

in fact, you can go there yourself and see the content I published here: https://ipfs.io/ipns/QmejGNNbBk62b51KVXCYNJKjPnhx7t6BckAzicSqKKqRtE

or run the same command: ipfs name resolve QmejGNNbBk62b51KVXCYNJKjPnhx7t6BckAzicSqKKqRtE

If someone knows your name, they can resolve it to find out the content you have pointed to. IPNS is a whole nother can of worms of IPFS, I’m not sure what it’s future holds or how much of this will remain true.

From @RichardLitt on Tue Aug 09 2016 18:25:26 GMT+0000 (UTC)

Thanks, @adrian-git-hub-user!

From @RichardLitt on Tue Aug 09 2016 18:25:40 GMT+0000 (UTC)

I am going to keep this open for others to see, if that’s OK.

From @mateon1 on Fri Aug 12 2016 05:36:46 GMT+0000 (UTC)

@Ghoughpteighbteau

If someone knows your name, they can resolve it to find out the content you have pointer to.

Well, that’s not quite true. If you’re connected to the network at all, and have something pinned to your peer identity (public key hash), anybody can find it. It’s fairly easy to enumerate a large part of the IPFS network for IPNS records using addresses accumulated in ipfs swarm addrs.
The last time I did this, I found about 10 hashes that weren’t the empty directory, I only checked the first two, both being blogs.

From @Ghoughpteighbteau on Fri Aug 12 2016 16:33:31 GMT+0000 (UTC)

@mateon1

? I wasn’t… actually I’m not sure what you think I was wrong about. Maybe you figured I was insinuating that your IPNS name was essentially secret unless you told someone.

It’s fairly easy to enumerate a large part of the IPFS network for IPNS records using addresses accumulated in ipfs swarm addrs.

haha, what a fun exercise. Here’s what I’ve found doing that:

http://ipfs.io/ipfs/ipfs/QmU2ywYUuLd97uCfo1dknZosB6Qem7e32JQuMtBDUkoxu3/3298548.jpg
http://ipfs.io/ipfs/ipfs/QmU2ywYUuLd97uCfo1dknZosB6Qem7e32JQuMtBDUkoxu3/3351800.jpg
http://ipfs.io/ipfs/ipfs/QmTeVUJb41cHyLi6AT7t5Hrh8swyR1uRiU6JTLJZUhujuH/BreakingOfTheDay.mp3

aaand some blogs.

edit:

I made a some commands to make this easy!

run this to resolve the list of your peers:
ipfs swarm peers | sed "s:.*/ipfs/\(.*\)\$:\1:g" | xargs -n1 -P5 ipfs name resolve > peers

then this to open them!
cat peers | grep -v "/ipfs/QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn" | sed "s|^|http://127.0.0.1:8080|" | xargs firefox