Bitcoin has radically changed the way we view transactions of digital assets and value. The decentralized nature of the blockchain is the base for its main strengths: security, transparency, trustworthiness, and immutability.
Just as Satoshi inscribed a message in the very first block of the Bitcoin blockchain, the adopters also realized that these inherent attributes could have advantages that go way beyond the simple transaction of currency.
This is why people practiced different methods to store data, causing dissatisfaction among many, mostly due to the inefficiencies of these methods.
The game changed after the Bitcoin Core version 0.9.0 update in March 2014 when the OP_RETURN field was added.
What is OP_RETURN?
OP RETURN is an instruction of the Bitcoin scripting language which allows users to attach metadata to a transaction and therefore save it on the blockchain. There can only exist one OP_RETURN per transaction. The operation stores them in the blockchain, but they are not UTXOs (unspent output from bitcoin transactions). Therefore, they will not consume RAM, but only disk space, resolving the issues and inefficiencies that the previously used methods had.
The OP RETURN became standard only after the release of the Bitcoin Core version 0.9.0 update although it had been part of the scripting language since the first releases of Bitcoin. The 0.9.0 release had a 40 bytes limit for storing data, which went to 80 bytes in the 0.11.0 release and to the current 83 bytes in the 0.12.0 release in February 2016.
Despite the doubling of the bytes available, 83 bytes still is a quite small amount of data. There are two strategies to overcome this issue.
Firstly, to compress the data as much as possible and possibly fit it in the limit, or split it into several parts. Consequently, this option limits the user to stay within the 83 bytes limit or to pay a transaction fee for each part the metadata is split into, but you have the guarantee that the information will be forever stored completely.
Secondly, to store a hash of the data, but keep the data itself on external storage. The hash is the key to retrieve the data and to verify that it hasn’t been altered or tampered with. Therefore, it cannot guarantee the integrity of the data, as the external storage is damageable, but allows the user to overcome the 83-byte limit.
What are the uses of metadata in transactions?
OP_RETURN use cases
Probably the most obvious application of metadata in transactions is the possibility to store or send messages and memos. Similarly to theGenesis block, but imagine the possibilities going way beyond that.
The metadata could store instructions on how to utilize a specific asset. For instance:
- certify ownership and exchange of assets (who were the owners and who is the owner now)
- the value and amount of the assets that user transfers
The certification of documents – validating its ownership and timestamp. Making the hash of a document public in a transaction proves its existence and integrity. The same goes to certify signatures.
Declaring access rights and copyrights on digital art files, like photos or music.
Stealth addresses allow receiving payments without publicly revealing the receiver’s public key or address.
With Crypto APIs you can add metadata to your transactions!