0

I am trying to create a proof of existence dapp using IPFS and Solidity and wish to implement a feature to add 'tags' (like we attach to question on stack overflow) to each file/document uploaded on IPFS. On my dapp front end I wish to provide a search option. Based on the value of tag entered in the search option, I wish to refresh dapp contents on the front end.

Being a newbie to Solidity coding, please suggest the most efficient (in terms of gas consumption) and fastest way to implement this feature in solidity code.

Thanks in advance

1

The trouble with doing things this way is that you would have to search the container. In Solidity, you can't do that with a map.

If you build it with an array, then you could iterate over it, but it won't scale because as the array grows bigger, the spinning itself might cost more than the block's gas limit (if it gets very big).

In the face of this, I think people store searchable data off-chain and search there. Others may know differently, but that's my understanding.

  • Thanks for your reply, to use an off-chain database along is it considered 'OK' in the spirit of creating a truly decentralized dapp in case I have to explain it to an audience? – tanmay Aug 3 '18 at 19:58
  • I don't think there's really any other alternative. But keep searching for a solution, as I may be wrong. You can store data off-chain and store some sort of content-addressable hash (such as IPFS) on the chain to ensure that the data is committed to. – Thomas Jay Rush Aug 3 '18 at 22:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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