How can I use blockhain for storing a proof of a document such as an image

+1 vote
How can I have a benefit of blockchain to authenticate documents to obtain a proof of documents.
May 3, 2018 in Blockchain by Johnathon
• 9,090 points
868 views

2 answers to this question.

+1 vote
Best answer

Yes, you're right. Saving entire image in eth is very costly. I'll suggest you to check off chain data storages like IPFS or Swarm (the ethereum community usually recommends it).

There are alternative APIs are available. Mentioned are two popular services and most of dev's are using. Both are distributed off chain storages.

I'll suggest you to check below link once.

Coming to your question. This is an example of how to store a reference to an image, stored in IPFS, in an ethereum smart contract.

contract ImageInfo{
   mapping(address=>Image[]) private images;
   struct Image{
      string imageHash;
      string ipfsInfo;
   }
   function uploadImage(string hash, string ipfs) public{
       images[msg.sender].push(Image(hash,ipfs)); //
   }
}

Above code is for just illustration. Modify the data structure as per your requirements. I have not added any security checks.

The idea is to first upload the image to ipfs/swarm/any other off chain data store, get the value calculate hash of image to contract. Download data(image) from offchain and calculate hash and check hash saved in contract.

I feel like the above solution is one of the best way to handle images, because all data is distributed using serverless architecture.

answered Aug 28, 2018 by hakusaro

selected Aug 28, 2018 by Omkar
0 votes

If you are looking for a blockchain to store data in it, then bitcoin would not be a good choice. Ethereum or Hyperledger is ideal for developing such POC(prof of concept) Or you can use Elements blockchain platform which is a feature experiment and an extension to bitcoin protocol. Here's the github link you can refer https://github.com/ElementsProject/elements

answered May 3, 2018 by Shashank
• 10,400 points

Related Questions In Blockchain

+1 vote
1 answer

How can I achieve a functionality where an action is performed after a payment is received?

See this can be achieved in more ...READ MORE

answered Apr 21, 2018 in Blockchain by Perry
• 17,100 points
663 views
+1 vote
2 answers

How can a public proof of work be secured?

Bitcoin was the first implementation of blockchain, ...READ MORE

answered May 9, 2018 in Blockchain by Johnathon
• 9,090 points
826 views
0 votes
1 answer

How can I create a blockchain for keeping records?

​You can use an already existing Blockchain. ...READ MORE

answered Jun 27, 2018 in Blockchain by Christine
• 15,790 points
976 views
0 votes
1 answer
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,922 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,451 views
+1 vote
1 answer

Protocols used in a distributed/dlt system for the nodes to establish communication

yes all are over TCP/IP connections secured ...READ MORE

answered Aug 6, 2018 in Blockchain by aryya
• 7,460 points
1,426 views
0 votes
1 answer

How can I create an online wallet without any 3rd party API on my PHP server?

With any approach, you need a bitcoin ...READ MORE

answered Aug 30, 2018 in Blockchain by Perry
• 17,100 points
2,566 views
0 votes
1 answer

How can I get the same return value as solidity `abi.encodePacked` in Golang?

This is what I used:  package main import ( ...READ MORE

answered Sep 26, 2018 in Blockchain by slayer
• 29,370 points
4,235 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP