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,070 points
31 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,330 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 20, 2018 in Blockchain by Perry
• 17,010 points
19 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,070 points
38 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
38 views
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
125 views
0 votes
1 answer
0 votes
1 answer

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

yes all are over TCP/IP connections secured by TLS encryption in hashgraph architecture-hashgraph, ...READ MORE

answered Aug 6, 2018 in Blockchain by ariaholic
• 7,320 points
63 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 29, 2018 in Blockchain by Perry
• 17,010 points
117 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,050 points
375 views