Deposits and the treasury
Moving coins in: every sidechain keeps them in one output on L1.
4 min readOne treasury per sidechain
All coins locked for a sidechain sit in a single L1 output, its treasury outputCTIP (treasury output)The single unspent output holding all of a sidechain's locked coins. Every deposit or withdrawal replaces it with a new one. (BIP300 calls it the CTIP). It is marked with a special opcode, OP_DRIVECHAINOP_DRIVECHAINThe opcode that marks a treasury output. BIP300 uses OP_NOP5; Betanet uses OP_NOP8., and the sidechain's slot number.
The treasury is one big jar per sidechain. Each deposit pours the old jar and your coins into a new, larger jar.
Depositing (M5)
A depositM5 · DepositAn L1 transaction that spends the treasury output and creates a new one holding more coins. is an ordinary L1 transaction. It spends the current treasury output together with your coins and creates a new treasury output holding more than before. Right after it, an output records the sidechain address that should receive the coins.
No vote is needed: once the transaction is in a block, the deposit is done on L1. The amount deposited is exactly how much the treasury grew.
One real deposit, step by step
Loading live data…
What each treasury holds
Loading live data…
Latest deposits
Loading activity…
A treasury, output by output
Loading live data…
Go deeper: what L1 does not know
L1 checks that the treasury grew and that the address output is present. Crediting the coins on the sidechain is the sidechain's job: its nodes read the deposit from L1. The Observatory does not watch sidechains, so a deposit here shows the L1 side only.
The treasury script is OP_DRIVECHAIN <slot> OP_TRUE. Anyone may spend it, but only in a transaction that follows the deposit or withdrawal rules.
Read the source
The rules in this lesson come from these documents and code:
Ask an AI assistant about this concept
Opens your assistant with a question about this concept and its sources already written. AI answers can be wrong: check them against the sources above. Your question goes to the assistant you choose, not to us.