Skip to content

Lesson 6 · 5 min · Intermediate

OP_RETURN: writing data into the ledger

On this page

OP_RETURN: writing data into the ledger

Bitcoin transactions exist to move coins — but people have wanted to etch other things into the ledger almost from the start. The genesis block itself carries a newspaper headline in its coinbase data, and early users smuggled messages into outputs disguised as public keys. The protocol’s sanctioned answer for arbitrary data is an output built around the opcode.

Standard Explanation

OP_RETURN (opcode 0x6a) is the one instruction in Bitcoin Script whose job is to make a script fail: the moment it executes, evaluation stops and the output is marked invalid . That sounds broken, but it’s the point — an output that starts with OP_RETURN is provably unspendable, so nothing about it pretends to be money. The bytes after the opcode are a data push, and nodes relay them under standard policy: Bitcoin Core has treated OP_RETURN “null data” outputs as a standard transaction type since 2014 , with the default limit applying to the whole serialized script — 83 bytes, i.e. about 80 bytes of actual data .

Why “provably unspendable” matters: before OP_RETURN was standardized, data smuggled into fake keys or scripts had to sit in the — the database of spendable coins every full node must maintain forever, because no one can prove those outputs are junk. An OP_RETURN output fails immediately, so nodes can drop it from the UTXO set: the data lives on in the chain’s history without taxing every node’s working memory. You still pay fees for the block space — data competes with payments for every byte.

Where an OP_RETURN output goes

transactionoutput 0 · payment · 0.010 BTCoutput 1 · change · 0.004 BTCoutput 2 · OP_RETURN · 0 BTC6a 0b 68656c6c6f20776f726c64“hello world”up to ~80 bytes of dataUTXO setspendable coins every full node keeps✗provably unspendabledropped from the UTXO setchain historykept by archival nodes
The payment and change outputs join the UTXO set, the spendable coins every full node keeps. The OP_RETURN output can never be spent, so nodes drop it from that set and its data survives only in the chain’s history. Amounts are illustrative.

What actually goes in those bytes

  • Proofs of existence: , commit the hash, and anyone can later verify the document existed on that date — without ever revealing it. OpenTimestamps aggregates thousands of timestamps and anchors the result into Bitcoin transactions .
  • Token overlays: protocols that encode token movements in the data field. The — where Tether’s first USDT lived before Ethereum and Tron took over — rides on OP_RETURN, and early rivals like Counterparty hid their payloads in multi-signature scripts instead.
  • Security anchoring: smaller chains stamp periodic attestations into Bitcoin to inherit its hash power (“proof-of-proof”). VeriBlock-style anchoring consumed a notable share of Bitcoin’s block space at its 2019 peak and reignited the “is Bitcoin a data layer?” fight.
  • Plain messages: signatures, tributes, and graffiti — the bytes carry no special meaning unless reader and writer agree on one.
Public, attributable, permanent

OP_RETURN data is readable by everyone, kept indefinitely by archival nodes, and attached to your address. Chain-analysis tools read the protocol markers in it just like anyone else — it’s one more signal for classifying a transaction. Never put keys, secrets, or personal data in one.

OP_RETURN is no longer the only way to write data into Bitcoin. Since 2022–2023, inscriptions tuck content into the witness portion of a Taproot spend — which is how NFT-like images and BRC-20/Runes tokens appeared without any protocol change. On Ethereum, the equivalent is a transaction’s field, which any transaction can carry. Different mechanisms, same idea: block space is the medium, and data competes with payments for every byte.

Educational only, not financial or legal advice.