As I had answered in 2014 but it was deleted as link only, this is the perfect use case for a distributed system like a blockchain, since the key issue is that you don’t want to trust one particular entity. You just have to hash your content, and publish the hash on a blockchain. And choosing the most popular blockchain (Bitcoin) seems like the best bet to ensure that the data will be available for a longer time, and to make it harder for someone to attack the blockchain with a 51% attack.
The easiest way to do this would be with a web service that takes a bit of dollars e.g. with Paypal and writes the data for you, but these services seem all to die sooner or later for some reason, I wonder if its legal or just economics:
But you can always do it from a local bitcoin node on the command line. There are various ways to encode arbitrary data on the bitcoin blockchain, but using OP_RETURN
is one of the simplest.
The procedure is slightly technically involved and I couldn’t immediately find a well packaged helper script for it, though it is certain to exist, but what you have to do is described in good detail at: https://github.com/BlockchainCommons/Learning-Bitcoin-from-the-Command-Line/blob/9b97c50471226fc8fdb6063508c75db156bf5122/08_2_Sending_a_Transaction_with_Data.md
Basically you install bitcoin with:
sudo snap install bitcoin-core
then open the GUI, let it sync and buy a tiny amount of Bitcoin just to be able to pay for transaction fees of the following transaction we are about to make.
Then you can write the SHA of a local file contract.jpg
into the blockchain with (untested, there could be bugs below):
op_return_data="$(sha256sum contract.jpg)"
utxo_txid=$(bitcoin-cli listunspent | jq -r '.[0] | .txid')
utxo_vout=$(bitcoin-cli listunspent | jq -r '.[0] | .vout')
changeaddress=$(bitcoin-cli getrawchangeaddress)
rawtxhex=$(bitcoin-cli -named createrawtransaction inputs=""'[ { "txid": "'$utxo_txid'", "vout": '$utxo_vout' } ]''' outputs=""'{ "data": "'$op_return_data'", "'$changeaddress'": 0.0146 }''')
signedtx="$(bitcoin-cli signrawtransactionwithwallet $rawtxhex | jq -r '.hex')"
bitcoin-cli sendrawtransaction $signedtx
Now the only thing left to do is to regret that I didn’t buy some Bitcoin myself in 2014!!!