From @VictorBjelkholm on Fri Mar 10 2017 12:48:36 GMT+0000 (UTC)
> Does that mean that once I add a file to ipfs, i.e. ipfs add helloWorld.tx, the hash generated (in this case, QmfM2r8seH2GiRaC4esTjeraXEachRt8ZsSeGaWTPLyMoG) is permanent? In other words, that hash will always contain the same thing?
Yes, that is correct. If you have two files with the same content, they’ll get the same hash, no matter where/when you add them.
Unsure of what you mean with the second comment. IPNS is simply a mutable pointer to a IPFS hash. So when you add a file, you get a hash that looks like /ipfs/Qm… which you can then tell /ipns/:your-peer-id to point to. So you wouldn’t update /ipfs/Qm…, you would simply add all of your new contents, get a new hash back and point /ipns/your-peer-id to that hash.
Maybe this little demonstration would help a bit:
$ echo "Hello @glowkeeper" | ipfs add -q
$ ipfs name publish QmUwv8HhzNbsPreyUtK6Se4PnfTtSWiBdWdPhRMfRmsUAC
Published to QmbnQNC8fRCYcfrAonNkxfbVE7MKke7Awzi96V8u8ERS7C: /ipfs/QmUwv8HhzNbsPreyUtK6Se4PnfTtSWiBdWdPhRMfRmsUAC
$ ipfs name resolve /ipns/QmbnQNC8fRCYcfrAonNkxfbVE7MKke7Awzi96V8u8ERS7C
$ ipfs cat /ipfs/QmUwv8HhzNbsPreyUtK6Se4PnfTtSWiBdWdPhRMfRmsUAC
$ echo "Hello @glowkeeper but this time updated" | ipfs add -q
$ ipfs name publish QmNVeYuStLYDoTsGNYAHLEzeMDHPG4RkHDpYij3ATgfaiL
Published to QmbnQNC8fRCYcfrAonNkxfbVE7MKke7Awzi96V8u8ERS7C: /ipfs/QmNVeYuStLYDoTsGNYAHLEzeMDHPG4RkHDpYij3ATgfaiL
$ ipfs cat /ipns/QmbnQNC8fRCYcfrAonNkxfbVE7MKke7Awzi96V8u8ERS7C
Hello @glowkeeper but this time updated
What I’m doing here is the following:
- Add a file to IPFS
- Publish the response hash to IPNS under my peer ID
- Resolve IPNS address to a IPFS hash
- Cat the content from that IPFS hash
- Create a new file with new contents
- Publish this new hash to IPNS again
- Do the resolve and cat in one step, by using the /ipns/ prefix
IPFS hashes would change, every time the content change, while the IPNS record is mutable, and points to those hashes.