Proposal for improved IPNS
IPFS does not support true human-friendly domain names as we currently use such as www.github.com. IPNS implementation has come close to such domain names but yet I cannot just open my browser and type the link with a hash or a long string of names. I would like to propose a solution that might help in solving this problem and create truly human-friendly names with the help of smart contracts in the blockchain.
Blockchain has been used in this proposal since it is decentralized and has no downtime.
Working of IPNS using blockchain:
Following presents the working of this proposal:
- A user first enters a link like ipfs://my-fav-file.txt
- The browser reads “ipfs://” initial protocol and sends the request to a smart contract with the hash of the file name present in the link as a parameter.
- The smart contract contains a mapping that maps file name hashes to their content hashes which gets returned as a response to the browser.
- The browser receives the response and redirects the user to the required file using the received hash.
If it is required, this functionality can be added to existing browsers by creating an extension. The extension will:
- Interecpt the links
- check its protocol
- make a call to smart contract
- redirect users
Private files on IPNS
A file is private as long as we don’t know the content address and if it is encrypted. To prevent users from accessing the content address of the private file following can be implemented:
working Private files on IPNS:
- Instead of the initial “ipfs://” protocol we can call it “ipfsp://” ( ipfs private ) to tell the browser to request private files.
- The browser will request a smart contract with the hash of the file name.
- The smart contract contains another mapping specifically for holding private hashes.
- For a file-name hash, this mapping will return a digital signature which actually is the content hash encrypted using the public key of the creator.
- The browser will receive the digital signature, the user will then decrypt it with his/her private key, hence providing us the content address of the file which we can now access.
Change in the content of the file changes the link to the file. Using the above-described method, one can update the mapping in the smart contract by providing legitimate proof of ownership and update the new link for the given file name. Since a name will map to a single link, multiple names can be given to a different version of the same file which will be recorded in the smart contract separat HEnceely.
The current system is not yet developed/tested and is a concept. If created, our output would be a human-friendly naming system in which we access files on ipfs via their name. eg: ipfs://my-cat-video.mp4, ipfs://my-cat-video-v2.mp4, ipfs://my-cat-video-v3.mp4 etc.