2

Im trying to figure out the best way to approach a problem.

I would like give a user the ability to store documents that each have value. So each time they create a new document, they can add however much ether to that contract. The goal is for them to then be able to trade those contracts.

I thought about generating a new address for each document, but that would make it impossible to send them to another person.

Does anybody have any suggestions of how i can solve this? For dev, I am using node.js and web3.js.

2

If I understood right, you don't have strict requirements (yet) about which parts of the system should be inside blockchain and which outside. As at least some parts have to be outside the blockchain (document storing), I'll take the liberty of suggestion a solution that'll be part in and part out of blockchain.

  • Store the documents somewhere outside blockchain along with their hashed value (sha3 or whatever)
  • Store the hash values in your smart contract along with an Ether value and owner address
  • Allow the documents (their hashes) to be bought inside the contract. Whoever owns the hash, owns the document
  • When creating a new document, add a new reference to it in the smart contract
  • Excellent thank you! I plan on storing the documents and a hash in mongo db and can definitely do point #2. Can you elaborate more on point 3 & 4...im not sure i understand it. – Hysi Mar 18 '18 at 21:35
  • You know which hash is from which real document (it's in your mongodb). So if someone wants to buy a document, they call a function in the contract that's something like function buy(string hash) payable {... - if their supplied Ether amount is enough, they are marked as owning the hash and your backend can check who owns the hash and distribute the document to the owner in some way – Lauri Peltonen Mar 19 '18 at 6:43

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.