Drivechain ObservatoryConnecting…Waiting for data.
  1. 1What is a drivechain?
  2. 2Blocks: the heartbeat
  3. 3Slots and sidechains
  4. 4Creating a sidechain
  5. 5Deposits and the treasury
  6. 6Withdrawals by miner vote
  7. 7Blind merged mining
  8. 8How we know
Concept 5 of 8

Deposits and the treasury

Moving coins in: every sidechain keeps them in one output on L1.

4 min read

One 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.

A deposit replaces the treasury outputA deposit transaction spends the old treasury output plus the user's coins and creates one new treasury output holding the sum.Old treasury100 coinsYour coins+ 5 coinsDeposit(M5)New treasury105 coins
Illustrative amounts. There is always exactly one treasury output per sidechain.
Live on Betanet

One real deposit, step by step

Loading live data…

Live on Betanet

What each treasury holds

Loading live data…

Each value is the latest separate reading of that sidechain's treasury output. Bars are to scale with the largest treasury.
Live on Betanet

Latest deposits

Loading activity…

Live on Betanet

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.

Check yourself

When you deposit, what does L1 itself check?

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.