Is it possible to include a file's checksum in a transaction?

Not necessarily in Bitcoin's current blockchain due to the now limited OP_RETURN feature, but just in the blockchain/transaction concept in general.


Yes you can. You can use OP_RETURN of course but there are also other ways, some "hacks" like adding an transaction output that refers to an Bitcoin address that instead of being the hash of your public key is the hash of your file.

Here is what Garvin Aderson said about OP_RETURN

Why 80 bytes? Because we imagine that most uses will be to hash some larger data (perhaps a contract of some sort) and then embed the hash plus maybe a little bit of metadata into the output. But it is not large enough to do something silly like embed images or tweets. Why allow any bytes at all? Because we can’t stop people from adding one or more ordinary-looking-but-unspendable outputs to their transactions to embed arbitrary data in the blockchain. What do I mean by “immediately prune-able?” The form of the up-to-80-byte transaction output (“OP_RETURN ”) is such that it can never be used as an input for another transaction– so it can theoretically be forgotten by everybody except for machines that want to keep a full record of every single transaction (“archive nodes”). That is a big improvement over the various hacks people are using today to associate data with their transactions, and will be more important in the future when we implement code that saves disk space by keeping only unspent transaction outputs and not every old block.

Source Gavin Andresen talks about the 0.9 release

| improve this answer | |
  • how many bytes are md5 checksums or CRC data ? – CQM Jul 31 '14 at 13:47
  • MD5 under binary form is 128 bits or 16bytes long. A bitcoin address is 160 bits or 20 bytes long. – Jan Moritz Jul 31 '14 at 13:49
  • You can even add it under his hexadecimal form it will be 32 bytes long. – Jan Moritz Jul 31 '14 at 13:53
  • is there a way to index all of this data, easily? I am trying to imagine a scenario where md5 data is associated WITH an address (only perhaps by an initial transaction signed or cosigned by a trusted source), I guess it is possible that those transaction's outputs can be aggregated on their own, and one could make a separate index of the transaction metadata – CQM Jul 31 '14 at 14:47
  • Do you mean recovering the checksums from the transaction when you speak about "indexing"? – Jan Moritz Jul 31 '14 at 14:48

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.