11 votes

Explanation of what an OP_RETURN transaction looks like

If you want to write OP_RETURNs to the blockchain without getting into the internals of how transactions are built, an easy way is to use our libraries for PHP and Python: https://github.com/...
Gideon Greenspan's user avatar
11 votes
Accepted

Why would a miner put an OP_RETURN in a coinbase transaction?

Every segwit block has one such OP_RETURN in the coinbase transaction: It's the Merkle root of the witness tree. When the segwit softfork was activated, this included a fix to the third-party ...
Murch's user avatar
  • 72.6k
10 votes
Accepted

How does OP_RETURN burn coins?

What does exactly cause the output containing OP_RETURN to be unspendable? Simply the fact that no input can possibly unlock coins which are encumbered with such an OP_RETURN-containing script. ...
Pieter Wuille's user avatar
9 votes

Why does this coinbase transaction have two op_return outputs?

Coinbase transactions have some special rules not shared by other transactions: only one per block must be the first transaction in the block must have OP_RETURN output with witness commitment if ...
Murch's user avatar
  • 72.6k
8 votes
Accepted

Raw data vs information encoded in OP_RETURNs

The current Bitcoin P2P protocol has no concept of compression, though there have been some proposals to incorporate it. The transaction data is sent as-is. Some earlier discussion: https://lists....
Pieter Wuille's user avatar
6 votes
Accepted

Can a transaction have a single 0-value OP_RETURN as its only output?

Yes. Such transactions are valid and standard.
Andrew Chow's user avatar
  • 68.5k
6 votes
Accepted

OP_RETURN max bytes clarification

The limitation is a relay standard, but not a consensus rule. This can be modified on a per-node basis with $ bicoind -datacarriersize flag. The consensus rule that would limit this is the max block ...
JBaczuk's user avatar
  • 7,318
6 votes
Accepted

Can Taproot be used to commit arbitrary data to chain without any additional footprint?

Yes, you can commit to data this way, but there is nothing special about Taproot here. The Pay-to-Contract construction used to tweak the root key in Taproot is generally usable, and has in fact been ...
Pieter Wuille's user avatar
6 votes
Accepted

Understanding how ordinals work with the Bitcoin blockchain. What is exactly stored on the blockchain?

Ordinals Inscriptions don't use OP_RETURN, they are embedded within the script of a taproot input. It's not just a link to a file on some website, the entire file is actually published to the ...
Vojtěch Strnad's user avatar
5 votes
Accepted

What would happen if there are more blockchain imitators like Factom?

Factom stores data in a blockchain that's maintained by their network of federated servers. Tierion lets you create a verifiable record of any data or business process by anchoring your data to the ...
Wayne Vaughan's user avatar
5 votes

What would happen if there are more blockchain imitators like Factom?

The way Factom works, they store the merkle root of the various hashes on the blockchain in an OP_RETURN output. This amounts to 80 bytes in the OP_RETURN and the actual transaction is going to be on ...
Jimmy Song's user avatar
  • 7,749
5 votes
Accepted

What has OP_RETURN been used for over Bitcoin's history?

pourteaux answered this in a Twitter thread. The story starts in 2010, when there was debate on bitcointalk about a proposal to include a DNS service on bitcoin called BitDNS. There was concern (...
Michael Folkson's user avatar
5 votes
Accepted

What is OP_RETURN b9e11b6d?

The mentioned OP_RETURN output appears to be the footprint of merged-mining VCash, a Mimblewimble-based SHA-256d coin, with Bitcoin. I discovered this via the string 0xb9e11b6d appearing in these ...
Murch's user avatar
  • 72.6k
5 votes
Accepted

How can I recognize an OP_RETURN transaction looking only at the hex?

You can use bitcoin-cli to decode the transaction and get a sense of what is going on: bitcoin-cli decoderawtransaction 0100000000010173...275d9a2100000000 That returns: { "txid": "...
sr_gi's user avatar
  • 3,192
5 votes
Accepted

Was the lifting of the Taproot transaction size limit "accidental"? Why would ordinals want to fill a block with OP_RETURNs?

No it was not accidental, see the BIP342 section on Resource Limits Script size limit: The maximum script size of 10000 bytes does not apply. Their size is only implicitly bounded by the block weight ...
pinhead's user avatar
  • 4,992
5 votes
Accepted

Can any Script opcode be used in the witness program, or only specific ones?

I was wondering, can one use an OP_RETURN in the witness script? Yes, you can, though I believe it is pointless. Executing an OP_RETURN opcode causes the script to return false immediately, marking ...
Pieter Wuille's user avatar
4 votes

Explanation of what an OP_RETURN transaction looks like

OP_RETURN is a way to get arbitrary data into the blockchain with less burden to the network As a consequence, the data will also be present in less clients, as OP_RETURN data can be pruned out. The ...
Ciro Santilli OurBigBook.com's user avatar
4 votes
Accepted

Does any current SegWit or blocksize increase proposal also seek an increase in the OP_RETURN byte limit?

Currently, there are no BIPS (Bitcoin Improvement Proposals) that seek to increase the 80 byte limit as you can see here. Doing a cursory search on that repository, you can see that only a few ...
Jimmy Song's user avatar
  • 7,749
4 votes
Accepted

OP_RETURN marks transaction or output as invalid

Both. Transaction output scripts are only executed at the time they are attempted to be spent. If you try to spend an OP_RETURN output, the spending transaction is invalid, as this instruction ...
Pieter Wuille's user avatar
4 votes
Accepted

What was the very initial value of OP_RETURN?

My understanding is that OP_RETURN was first introduced in v0.9.0 No, it was just changed to be standard in 0.9.0. If a transaction is nonstandard, miners running Bitcoin Core with default settings ...
Nick ODell's user avatar
  • 29.3k
4 votes
Accepted

Segwit: Arbitrary data storage in witness?

Your transaction, although not invalid, is non-standard. Since it is non-standard, it will not be propagated and will be rejected for being non-standard. However this does not mean that it cannot be ...
Andrew Chow's user avatar
  • 68.5k
4 votes
Accepted

creating OP_RETURN script on bitcoin core console. i.e. with the help of commands

createrawtransaction has an option for data. That will create an OP_RETURN output with whatever hex-encoded data you want in it. So you would have a createrawtransaction command that looks something ...
Andrew Chow's user avatar
  • 68.5k
4 votes
Accepted

Why is there an output with op-return in regtest mode?

You did, presumably. The transaction you're showing is the coinbase; it's a special transaction added by the miner. The OP_RETURN output is the SegWit block commitment. It is the Merkle root of all ...
Pieter Wuille's user avatar
4 votes
Accepted

In the bitcoin scripting language, how can I access other outputs of the transaction? Or how else can I limit how the coins may be spent?

There is no way to enforce a rule regarding the nature of an output when an input is spent. You will have to enforce this off chain in some manner, perhaps through multisig schemes where one key is ...
Raghav Sood's user avatar
  • 16.9k
4 votes

Is OP_RETURN dangerous for Bitcoin?

The method described in the post has nothing to to with OP_RETURN, but is concerned with the SIGOP limits in a block. Each block has a limit on the number of SIGOPs that can be present in ...
Raghav Sood's user avatar
  • 16.9k
4 votes

Why are OP_RETURN transactions discouraged? Does using version or locktime make any difference?

Whether OP_RETURN transactions are discouraged or not is a matter of opinion. Personally, I think transactions should not store any data that isn't needed for the world to verify them, which is by ...
Pieter Wuille's user avatar
4 votes

Why isn't it possible to add an OP_RETURN (or some arbitrary script) inside a taproot script path with a descriptor?

It's not clear to me why one would want to commit to an OP_RETURN inside of a P2TR output construction, let alone inside of a descriptor. I feel like there might be a misunderstanding here. Using the ...
Murch's user avatar
  • 72.6k
4 votes

Tx with OP_RETURN with 77 bytes of data refused by node

UPDATE: The first version of this answer suggested using two data pushes, updated to use OP_PUSHDATA1. Further research has clarified the issue: OP_RETURN max data length is 80 bytes, however Maximum ...
Adam B's user avatar
  • 344
3 votes
Accepted

What is the 6a[...] hash in OP_RETURN transactions?

6A is the hex representation of OP_RETURN: https://en.bitcoin.it/wiki/Script That is not a hash at all, but rather the raw encumbrance script. You are looking at the code that actually contains the ...
Jestin's user avatar
  • 8,822
3 votes
Accepted

Why OP_RETURN should be used instead of raw data?

There are two reasons why you should prefer a scriptPubKey of OP_RETURN <data> over <data>. The first reason is that the non-OP_RETURN output is not prunable, and is actually anyone-can-...
Nick ODell's user avatar
  • 29.3k

Only top scored, non community-wiki answers of a minimum length are eligible