Where an inscription goes when you spend its UTXO

Satoshis are assigned to outputs first in, first out. An inscription follows the satoshi it sits on, which means its destination is decided by arithmetic, not by which output you meant it to land in.

Ordinals has no field that says which output an inscription should go to. There is a pointer tag for batches, but for an ordinary spend the answer comes out of a rule with no opinions in it:

Concatenate the inputs in order. Concatenate the outputs in order. Assign satoshis from the first list to the second, in order. An inscription sits on one specific satoshi and goes wherever that satoshi goes.

A worked example, on chain

Transaction 3cbbdd020f5026a3e71c95868a7a4e87813da32d98af6b1430ffbb79d8ae0b38 is the reveal that created 550 cats and their parent in one go: 129,860 bytes, 551 outputs, and a single witness item of 105,900 bytes.

Its envelope carried 551 inscriptions. Under first-in-first-out the parent took the first satoshi of the input and landed at output 0, offset 0; the first cat landed at output 1; the 550th at output 550. Nothing in the transaction declared any of that. It followed from the input value being counted out across the outputs in order.

The consequence people get caught by

Suppose your inscription sits at offset 0 of a 10,000-satoshi output, and you spend it in a transaction whose first output is 330 satoshis. Your inscription is on the first satoshi, so it lands in that first output — fine.

Now suppose your wallet adds one of its own inputs before yours to pay the fee. Your inscription is no longer on the first satoshi of the concatenated inputs. It lands wherever the arithmetic puts it, which is often several outputs along, and sometimes in the fee.

This is why an inscription-aware tool never lets a wallet choose inputs freely, and why the safest reveal layout is the boring one: input 0 is the inscription's output, and output 0 returns the entire value of input 0. Not a fixed 330 satoshis of postage — the whole thing. That is the only layout where the satoshi provably lands back at offset 0 whatever its starting position.

What this means for fees

Because output 0 has to give back the whole input, the fee cannot come out of it. It has to come from a second input, which in a commit/reveal pair is the commit output. If that output is not funded generously enough, the reveal cannot pay a competitive fee — and a reveal that sits in the mempool holds the inscription inside it, unmovable, until it confirms or is forgotten.

Questions

Why did my inscription end up in the wrong output?
Because outputs are filled from the inputs in order. An inscription lands in whichever output happens to contain its satoshi once the input values have been counted out, regardless of which output you intended.
How do I keep an inscription where it is?
Make it the first satoshi of the first input, and give output 0 the entire value of that input. Then its offset is zero at both ends.
See the collection this came from

More: