Skip to content

Commit 2cccaf6

Browse files
committed
bip-0300: Add OP_DRIVECHAIN
1 parent 55566a7 commit 2cccaf6

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

bip-0300.mediawiki

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ A sidechain fails to activate if:
226226

227227
Otherwise, the sidechain activates (Active is set to TRUE).
228228

229-
In the block in which the sidechain activates, the coinbase MUST include at least one 0-valued OP_TRUE. This output becomes the initial CTIP for the sidechain.
229+
In the block in which the sidechain activates, the coinbase MUST include at least one 0-valued OP_DRIVECHAIN output. This output becomes the initial CTIP for the sidechain.
230230

231231

232232

@@ -394,7 +394,7 @@ Every time a deposit/withdrawal is made, the old CTIP is spent and a new one is
394394

395395
Every M5 is valid, as long as:
396396

397-
* It has at least one OP_TRUE output -- this becomes the new CTIP.
397+
* It has at least one OP_DRIVECHAIN output -- this becomes the new CTIP.
398398
* The new CTIP has '''more''' coins in it, than before.
399399
400400

@@ -405,16 +405,24 @@ We come, finally, to the critical matter: where users can take their money *out*
405405
M6 is invalid if:
406406

407407
* The blinded hash of M6 does NOT match one of the approved Bundle-hashes. (In other words: M6 must first be approved by 13,150 upvotes.)
408-
* The first output of M6 is NOT an OP_TRUE. (This OP_TRUE becomes the new CTIP. In other words: all non-withdrawn coins are paid back to the sidechain.)
408+
* The first output of M6 is NOT an OP_DRIVECHAIN. (This OP_DRIVECHAIN becomes the new CTIP. In other words: all non-withdrawn coins are paid back to the sidechain.)
409409
* The second output is NOT an OP_RETURN script of exactly 10 bytes, of which 8 bytes are a serialized Bitcoin amount.
410410
* The txn fee of M6 is NOT exactly equal to the amount of the previous bullet point.
411411
412412
Else, M6 is valid.
413413

414414
(The point of the latter two bullet points, is to allow the bundle hash to cover the L1 transaction fee.)
415415

416+
===OP_DRIVECHAIN===
416417

418+
This proposal adds a single new opcode, OP_DRIVECHAIN, which has strict semantics for usage.
419+
OP_NOP5 (0xb4) is redefined as OP_DRIVECHAIN if and only if the entire script is OP_DRIVECHAIN followed by a single-byte push and OP_TRUE (exactly 4 bytes).
420+
The single-byte push contains the sidechain number.
421+
Note that this is not a "script number", and cannot be OP_1..OP_16 or any other kind of push; it is also unsigned, and must not be padded even if over sidechain number 127.
422+
The final OP_TRUE is to ensure this change remains a softfork:
423+
without it, sidechain numbers 0 and 128 would cause the legacy script interpreter to fail.
417424

425+
If an OP_DRIVECHAIN input is spent, the additional rules for M5 or M6 (see above) must be enforced.
418426

419427
==Backward compatibility==
420428

0 commit comments

Comments
 (0)