Let's say I am making a todo list smart contract or do I even need a smart contract for this?

I want to be able to store the todo list items on IPFS storage file. Is there an example of how this can be done? Where eos is communicating with IPFS? Do I need to host my own server to get this to work or can it run on its own without a central server on my end.

2 Answers 2


You can store your data in IPFS off-chain. And set the returning IPFS multihash as the primary key of the multi-index table.

// @abi table
struct todo
    uint64_t multihash; //the multihash of ipfs

    uint64_t primary_key() const { return multihash; } //set multihash as key

First start the ipfs deamon or do it programmatically using apis like ipfs-js. after installing ipfs on your machine run

ipfs daemon

Then via apis like ipfs-api in node.js you can add the data in smart contract via communicating to eosjs.

//The daemon will be running on 5001 port 
const ipfsAPI = require('ipfs-api');
let ipfs = ipfsAPI('localhost', '5001', {
   protocol: 'http'
ipfs.add(new Buffer(data-to-be-added), function (err, result) {
   //perform eosjs operation to hit smart contract action here 
   console.log(result[0].hash) //ipfs hash  

I hope this helps

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.