I built a dapp integrating IPFS and Ethereum, in which the blockchain will store (in transaction) the links of every file uploaded to IPFS. But I want to display the IPFS links of all the files I uploaded to IPFS. Is there a way I could do that rather than setting up a DB for storing the links?

I am using embark framework, which will make adding files to IPFS easy,and I also tried to save the links to a file and display it on the web page using 'fs' module in node, but I cannot create an object of the 'fs' module in the dapp;

Is there a way I could display the links in a web page?

3 Answers 3


You may store links in Ethereum blockchain using smart contract similar to this one:

contract LinkRegistrar {
  address private owner;

  event Link (string link);

  constructor () public {
    owner = msg.sender;

  function registerLink (string memory link) public {
    require (msg.sender == owner);
    emit Link (link);

This will put links into transaction receipts in form of logged events, where links could be easily queried from. See documentation for more details about what events are and how to query them.


You can't use the fs module in the browser, it is only available on nodejs. You could use a smart contract or the HTML5 localstorage API to store the links.


If you don't want to store all the links, you can achieve this by using IPFS itself just by storing a single link.

  1. Store all the links of the files you save to IPFS in a single CSV file and save it to IPFS, get its link and save it into your smart-contract or database.
  2. Whenever you add/remove a file, get that CSV file, modify it and save it again to IPFS, then update the CSV reference Link.

Sounds hacky, but this way you will save a lot of storage if you have a large number of files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.