1

I want to store some documents in my smart contract that some users upload. Can I use table for storage? But second thing is table resides in RAM and this doesn't seems good to store data in Ram.

Is there any other option like IPFS?

2

Yes, you can upload the document on IPFS; and then store the IPFS multihash as a key of your table:

Something like this should be useful:

// @abi table
struct ipfsid
{
    uint64_t key; //the multihash
    account_name uploader; // the account of the document uploading on ipfs

    uint64_t primary_key() const { return key; } //multihash is the key
};
  • Yes this is the table part. How can I connect to the IPFS inside my contract? – Nirdesh Kumar Choudhary Sep 25 '18 at 9:26
  • 1
    What about if the user upload the document on IPFS off-chain; retreive the multihash from a front-end using eosjs, and then save it onchain calling a method of your contract (that basically add this new element to the table)? – Riccardo Persiani Sep 25 '18 at 9:49
  • That sound good to me,this also save the cost of RAM and cpu . – Nirdesh Kumar Choudhary Sep 25 '18 at 9:54
  • Agree, this could be one of the solution that saves more RAM. – Riccardo Persiani Sep 25 '18 at 9:56

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.