A Bitcoin "transaction" is actually a short Forth-like program running on a stack-based, non-Turing complete virtual machine. When Bitcoin has been sent to an address, the output script of a transaction is something like this:
let HASH = "xxxxxxxxxxxxxxxxxxxxxx";
if (check(HASH, pubkey, signature) == True)
return 1;
return 0;
And recall a Bitcoin address is a RIPEMD-160 hash, which means any 20 bytes binary data is a legitimate Bitcoin address. So earliest and simplest method of storing data is simply submitting a payment that sends pennies to a bunch of garbage Bitcoin addresses corresponding to your binary data.
This method was controversial in the early days, as it created a lot of not-actual-transaction garbage in the blockchain. Bitcoin developers later introduced opcode "OP_RETURN", which is seen as a standard and less-evil way to post data. In this case, the script is something like:
let DATA = "xxxxxxxxxxxxxxxxxxxxxx";
return 0;
Also, from the perspective of the system, it's just a transaction. Although for a OP_RETURN transaction, it won't be added to the UTXO (unspent transactions) list, because the script always returns false, it's not spendable.
The limitation of using Bitcoin blockchain as a data storage medium is the astronomical transaction fee. The larger the transaction (i.e. the script), the higher the fee. Typically, nobody can afford to store more than a few hundred bytes.
> Bitcoin developers later introduced opcode "OP_RETURN", which is seen as a standard and less-evil way to post data.
This is not true and an error in the Mastering Bitcoin book. OP_RETURN was introduced by Satoshi in the very first version of bitcoin.
> Typically, nobody can afford to store more than a few hundred bytes.
This depends on the artificial constraints put on the network. Bottle operates on top of BSV which comes without a cap on supply and offers cheaper fees when compared to BTC.
Yes.
A Bitcoin "transaction" is actually a short Forth-like program running on a stack-based, non-Turing complete virtual machine. When Bitcoin has been sent to an address, the output script of a transaction is something like this:
And recall a Bitcoin address is a RIPEMD-160 hash, which means any 20 bytes binary data is a legitimate Bitcoin address. So earliest and simplest method of storing data is simply submitting a payment that sends pennies to a bunch of garbage Bitcoin addresses corresponding to your binary data.This method was controversial in the early days, as it created a lot of not-actual-transaction garbage in the blockchain. Bitcoin developers later introduced opcode "OP_RETURN", which is seen as a standard and less-evil way to post data. In this case, the script is something like:
Also, from the perspective of the system, it's just a transaction. Although for a OP_RETURN transaction, it won't be added to the UTXO (unspent transactions) list, because the script always returns false, it's not spendable.The limitation of using Bitcoin blockchain as a data storage medium is the astronomical transaction fee. The larger the transaction (i.e. the script), the higher the fee. Typically, nobody can afford to store more than a few hundred bytes.