Bitcoin MOI 0.1.1: the drivechain is live (since block 20,160)
Block 20,160 opened the drivechain gate. Since that block every Bitcoin MOI block must carry a sidechain commitment in its coinbase, and version 0.1.1 adds one more block rule on top. Nodes still on 0.1.0 should upgrade now, and every pool needs a small change to how it builds the coinbase.
- Block now 20,175
- Estimated arrival (UTC) 2026-11-19 05:38
- On your clock –
- Block now 20,175
- Blocks since the gate 15
Block 20,160 has been mined. The drivechain rules are in force.
Estimated from the recent pace of the chain. The block height decides, not the clock.
What happens at block 20,160
Block 20,160 switches on the drivechain: the BIP300 and BIP301 rules. They let a sidechain, a separate chain with its own rules, hold BTCMOI in an escrow on the main chain and hand it back later, with the miners of Bitcoin MOI voting on every withdrawal.
No sidechain exists at the gate. The gate only makes the first proposal possible.
The road from here
- Now
block 20,175
Before the gate. No drivechain rule is checked yet.
Past the gate. The drivechain rules are in force.
- The gate
block 20,160
The drivechain rules start. From here on every block carries the sidechain commitment.
- Earliest sidechain
about block 40,320
A proposal must collect miner votes over 20,160 blocks, about 14 days, before a sidechain becomes active.
- Earliest withdrawal
129,600 blocks after it is proposed
Coins come back from a sidechain only after about 90 days of miner votes.
These are the earliest heights the rules allow, not a schedule. No sidechain has a date.
How coins reach a sidechain and come back
Your coins live here. They move only when you send them.
Coins sent to a sidechain wait here, on the main chain. One escrow per sidechain, 64 at most.
A separate chain with its own rules. Its blocks are anchored in Bitcoin MOI blocks, so miners secure it without running it.
The way back is slow on purpose: a withdrawal is paid from the escrow only after 129,600 blocks of miner votes, about 90 days, so a wrong withdrawal can be seen and voted down.
Step by step: a deposit and a withdrawal
No sidechain exists yet. This shows how the rules work once one does. The block counts are the earliest the rules allow.
- Coins in a main-chain wallet The coins are ordinary BTCMOI in a wallet on the main chain. Nothing moves until their owner sends them.
- The deposit The owner sends a deposit: one main-chain transaction that moves the coins into the escrow of that sidechain. The escrow is a single output that holds all the coins of the sidechain.
- Buried in the main chain Miners put the deposit in a block and build more blocks on top of it.
- Credited on the sidechain The sidechain reads the main chain through blind merged mining. Once the deposit is buried deep enough for its rules, it credits the coins to the owner on the sidechain. On the main chain they stay in the escrow.
- A withdrawal bundle is proposed To come back, the owner asks for a withdrawal on the sidechain. The sidechain groups withdrawals into a bundle, and the bundle is proposed on the main chain.
- Miners vote In every block the miners can vote for the bundle, against it, or abstain. The bundle needs a score of 129,600 (about 90 days at 60 seconds per block), so a wrong bundle can be seen and voted down.
- Paid out on the main chain Only after the bundle has passed does the escrow pay the coins out to main-chain addresses. A bundle that does not get there expires after 259,200 blocks (about 180 days) and pays nothing.
What it means for you
Nothing visible changes at the gate. Coins, addresses and payments work as before. No coin moves to a sidechain unless its owner sends it there.
Install 0.1.1 now if you have not yet. Since block 20,160 the node checks the sidechain commitment of every block. No reindex.
From block 20,160 every block must carry the outputs the node lists in getblocktemplate. A block without them is refused and the work on it is lost. Miners and hardware need no change.
coinbase_required_outputs bad-scdb-commitment-missing
At the gate block itself
- Block 20,160 is mined like any other block, with one more coinbase output: the 37-byte sidechain commitment.
- Pools that made the change keep finding valid blocks. A pool that did not finds only blocks the network refuses.
- Holders see nothing: no new coins, no new addresses, nothing to click.
- From then on miners can propose a sidechain and vote on proposals. The commands are in section 3 below.
The numbers
Times are at 60 seconds per block.
A short history of computing
From counting beads to racks of servers, in nineteen pictures. They are artwork, not photographs of the machines. Select a picture to see it larger.
The abacusCounting with beads on rods, long before electricity.
The Analytical Engine1837Charles Babbage's design for a general-purpose mechanical computer. It was never completed.
Colossus1943–44British electronic code-breaking machines of the Second World War.
Harvard Mark I1944An electromechanical calculator built from switches and relays.
SEAC1950An early stored-program computer of the U.S. National Bureau of Standards.
Ferranti Mark 11951One of the first computers sold commercially.
UNIVAC I1951An early commercial computer in the United States.
ORDVAC1952Built at the University of Illinois for the Ballistic Research Laboratory at Aberdeen Proving Ground.
ILLIAC I1952The sister machine of ORDVAC, kept at the University of Illinois.
UNIVAC 11031953A UNIVAC for the scientific computing market.
BESK1953Sweden's first electronic computer.
PDP-11959–60The first computer of Digital Equipment Corporation.
The mainframeA large central computer shared by many users.
The supercomputerMachines built to be the fastest of their time.
Silicon ValleyThe region in California where much of the chip industry grew.
The computerComputers became small enough for a desk.
The motherboardThe board that connects the parts of a computer.
Neural networksPrograms made of many connected nodes that learn from examples.
The data centreRacks of servers, where much of today's computing runs.
1 · Node and wallet operators
- Download 0.1.1 for your system from download.bitcoin.moi and verify it (signature and checksum; the steps are on that page and on verify).
- Stop the node:
moi-cli stop, or quit moi-qt. Wait until it has exited. - Replace the programs with the 0.1.1 ones and start again.
Your data directory and wallets are used as they are. No reindex is needed. Going back to 0.1.0 after your 0.1.1 node has passed block 20,160 is not supported.
Why upgrade
- One new block rule from block 20,160. A block must not create a second escrow coin with the
Dreturn destination outside a sidechain withdrawal. A node on 0.1.0 does not check this. - Gate stall fixed. After the gate a 0.1.0 node downloads blocks only from peers that advertise the drivechain service bit. If none of its peers do, it stops at the gate. 0.1.1 downloads from any peer.
- Disk space. 0.1.0 keeps a sidechain record for every block forever. 0.1.1 keeps the full records of the last 2,880 blocks and a small part of the older ones.
- Safer claiming and signing. The wallet refuses to sign a transaction that spends a coin which is not on MOI (such a signature could be valid on Bitcoin or Dogecoin), and messages are signed with MOI's own magic text.
The full list is in the 0.1.1 release notes.
2 · Pools and solo miners
Miners and mining hardware need no change. Nothing in the Stratum protocol changes; the coinbase your pool sends is 46 bytes longer. The work is on the pool side.
Two things, both needed since block 20,160:
- Run 0.1.1 as the node behind your pool. A pool on 0.1.0 could build a block that 0.1.1 nodes refuse.
- Add the required coinbase outputs. This is the part that needs work in your pool software.
What the node asks for
getblocktemplate has a field coinbase_required_outputs. Before block 20,160 it is an
empty list. From block 20,160 it always holds at least one entry, the 37-byte sidechain commitment:
"coinbase_required_outputs": [
{
"script": "6ad85cdbc0c4971ba8f9442e7ec3f8c1c9c3d902f664392ccff23cd814e5530ef4710d61db",
"value": 0,
"kind": "scdb_commitment"
}
]The rule
- Add one coinbase output per entry: value 0, scriptPubKey = the entry's
script(hex), in the order given. - Put them after your payout outputs and the witness commitment. That is the layout the node itself uses and the one we tested.
- Build them fresh from every template. The commitment changes with the chain: never cache it.
- Copy whatever is listed. Later the list can also hold sidechain proposal and acknowledgement outputs.
- Today every entry is a zero-value
OP_RETURNoutput (the script starts with6a). Do not assume a fixed count or size: with sidechain proposals the list can grow to several kilobytes. - You do not need to request a
drivechainrule ingetblocktemplate; the node ignores it. - Solo mining software that builds its own coinbase from
getblocktemplateneeds the same change. Mining with the node itself (generatetoaddress) needs nothing.
A block without the outputs is refused by every node with bad-scdb-commitment-missing
(bad-scdb-commitment if the output is there but does not match). The work on it is lost.
What a correct coinbase looks like
n=0 value=305.17 76a914a190011c28909193617ff459fb0c516413b4ad3688ac payout
n=1 value=0 6a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf9 witness commitment
n=2 value=0 6ad85cdbc0c4971ba8f9442e7ec3f8c1c9c3d902f664392ccff23cd814e5530ef4710d61db required outputPool software we tested across the gate
| Software | Result |
|---|---|
| ckpool, unmodified | invalid blocks from the gate. Needs the change below. |
| public-pool, unmodified | invalid blocks from the gate (bad-scdb-commitment-missing). Needs the change below. |
| ckpool with the change | valid, normal and high-difficulty ports |
| public-pool with the change | valid; refuses to build a job past the gate if the field is missing |
| pool.bitcoin.moi | valid |
Code: any language (Python reference)
The outputs part of the coinbase transaction, built from a template. On a node past the gate this produces exactly the bytes the node puts in its own coinbase.
def compact_size(n):
if n < 0xfd:
return bytes([n])
if n <= 0xffff:
return b"\xfd" + n.to_bytes(2, "little")
if n <= 0xffffffff:
return b"\xfe" + n.to_bytes(4, "little")
return b"\xff" + n.to_bytes(8, "little")
def tx_out(value, script):
"""One transaction output: 8-byte value, script length, script."""
return value.to_bytes(8, "little") + compact_size(len(script)) + script
def coinbase_outputs(template, payout_script):
"""Output count + outputs of the coinbase for this getblocktemplate result."""
outs = [tx_out(template["coinbasevalue"], payout_script)]
commitment = template.get("default_witness_commitment")
if commitment:
outs.append(tx_out(0, bytes.fromhex(commitment)))
# Bitcoin MOI: every entry the node lists, value 0, script as given, in order.
required = template.get("coinbase_required_outputs")
if required is None:
raise RuntimeError("the node did not send coinbase_required_outputs: "
"do not mine on this template")
for entry in required:
if entry.get("value", 0) != 0:
raise RuntimeError("unexpected value in coinbase_required_outputs")
outs.append(tx_out(0, bytes.fromhex(entry["script"])))
return compact_size(len(outs)) + b"".join(outs)If your pool pays several addresses, add those outputs where the single payout is; the required outputs still go last, after the witness commitment.
Code: public-pool (JavaScript)
Two files. First carry the field from the template into the job data:
// 1. in the list that makes up the work signature, after blockTemplate.coinbasevalue:
JSON.stringify(blockTemplate.coinbase_required_outputs ?? null),
// 2. in the object returned for the new template, next to `height`:
height: blockTemplate.height,
coinbaseRequiredOutputs: Array.isArray(blockTemplate.coinbase_required_outputs)
? blockTemplate.coinbase_required_outputs
: null
// 3. pass `coinbaseRequiredOutputs` on wherever `height` and `clearJobs` are passed on
// (the destructuring in the next map() and the blockData object it builds).Then add the outputs when the coinbase is built, right after the witness commitment output:
this.coinbaseTransaction.addOutput(
bitcoinjs.script.compile([bitcoinjs.opcodes.OP_RETURN,
Buffer.concat([segwitMagicBits, jobTemplate.block.witnessCommit])]), 0);
// Bitcoin MOI: from block 20,160 every coinbase must carry exactly the outputs the node
// lists in getblocktemplate coinbase_required_outputs: value 0, script as given, in order.
const requiredOutputs = jobTemplate.blockData.coinbaseRequiredOutputs;
if (Array.isArray(requiredOutputs)) {
for (const out of requiredOutputs) {
this.coinbaseTransaction.addOutput(Buffer.from(out.script, 'hex'), 0);
}
}
else if (configService.get('NETWORK') === 'mainnet' && jobTemplate.blockData.height >= 20160) {
throw new Error('getblocktemplate has no coinbase_required_outputs past the gate: '
+ 'refusing to build an invalid job');
}The complete public-pool change as a patch (2 files)
--- a/dist/models/MiningJob.js
+++ b/dist/models/MiningJob.js
@@ -28,6 +28,17 @@
}
this.coinbaseTransaction.ins[0].script = script;
this.coinbaseTransaction.addOutput(bitcoinjs.script.compile([bitcoinjs.opcodes.OP_RETURN, Buffer.concat([segwitMagicBits, jobTemplate.block.witnessCommit])]), 0);
+ // Bitcoin MOI drivechain gate: from block 20,160 every coinbase must carry exactly the outputs the
+ // node lists in getblocktemplate coinbase_required_outputs (the SCDB commitment), value 0, script as given, in order.
+ const requiredOutputs = jobTemplate.blockData.coinbaseRequiredOutputs;
+ if (Array.isArray(requiredOutputs)) {
+ for (const out of requiredOutputs) {
+ this.coinbaseTransaction.addOutput(Buffer.from(out.script, 'hex'), 0);
+ }
+ }
+ else if (configService.get('NETWORK') === 'mainnet' && jobTemplate.blockData.height >= 20160) {
+ throw new Error('getblocktemplate has no coinbase_required_outputs past the MOI drivechain gate: refusing to build an invalid job');
+ }
if ((this.coinbaseTransaction.weight() + jobTemplate.block.weight()) > MAX_BLOCK_WEIGHT) {
console.warn('Block weight exceeds the maximum allowed weight, removing the pool identifier');
let script = Buffer.concat([blockHeightLengthByte, blockHeightEncoded, padding]);
--- a/dist/services/stratum-v1-jobs.service.js
+++ b/dist/services/stratum-v1-jobs.service.js
@@ -52,6 +52,7 @@
timestamp,
blockTemplate.height,
blockTemplate.coinbasevalue,
+ JSON.stringify(blockTemplate.coinbase_required_outputs ?? null),
...blockTemplate.transactions.map(tx => tx.hash ?? tx.txid ?? tx.data)
].join('|');
if (!clearJobs && workSignature === this.lastWorkSignature) {
@@ -67,9 +68,11 @@
timestamp,
networkDifficulty: this.calculateNetworkDifficulty(parseInt(blockTemplate.bits, 16)),
clearJobs,
- height: blockTemplate.height
+ height: blockTemplate.height,
+ // Bitcoin MOI drivechain gate: outputs every coinbase must carry (SCDB commitment)
+ coinbaseRequiredOutputs: Array.isArray(blockTemplate.coinbase_required_outputs) ? blockTemplate.coinbase_required_outputs : null
};
- }), (0, rxjs_1.filter)(next => next != null), (0, rxjs_1.map)(({ version, bits, prevHash, transactions, timestamp, coinbasevalue, networkDifficulty, clearJobs, height }) => {
+ }), (0, rxjs_1.filter)(next => next != null), (0, rxjs_1.map)(({ version, bits, prevHash, transactions, timestamp, coinbasevalue, networkDifficulty, clearJobs, height, coinbaseRequiredOutputs }) => {
const block = new bitcoinjs.Block();
const tempCoinbaseTx = new bitcoinjs.Transaction();
tempCoinbaseTx.version = 2;
@@ -98,7 +101,8 @@
coinbasevalue,
networkDifficulty,
height,
- clearJobs
+ clearJobs,
+ coinbaseRequiredOutputs
}
};
}), (0, rxjs_1.tap)((data) => {Code: ckpool (C)
In the function that builds the coinbase, read the list from the template, make room for it, and write the
outputs after the witness commitment. This is from a ckpool tree that parses JSON with yyjson; with a
jansson build use json_object_get, json_array_size, json_array_get and
json_string_value instead.
yyjson_val *required = yyjson_obj_get(wb->gbtroot, "coinbase_required_outputs");
int required_count = yyjson_arr_size(required), required_len = 0, i;
/* Room for the outputs: 8 bytes value + up to 3 bytes length + the script, each. */
for (i = 0; i < required_count; i++) {
const char *script = yyjson_get_str(yyjson_obj_get(yyjson_arr_get(required, i), "script"));
required_len += 8 + 3 + strlen(script) / 2;
}
/* Make the two coinbase buffers that much larger ... */
wb->coinb2bin = ckzalloc(512 + required_len);
wb->coinb3bin = ckzalloc(256 + wb->insert_witness * (8 + witnessdata_size + 2) + required_len);
/* ... and count the outputs: payout + witness commitment + required outputs
* (2 + ... instead of 1 + ... where a second payout output is written). */
wb->coinb2len += ser_compact_size(wb->coinb2bin + wb->coinb2len,
1 + wb->insert_witness + required_count);
/* ... payout output(s) and the witness commitment are written here, as before ... */
/* Bitcoin MOI: every coinbase_required_outputs entry of THIS template, once,
* unchanged, value 0. The block is refused as bad-scdb-commitment otherwise. */
for (i = 0; i < required_count; i++) {
const char *script = yyjson_get_str(yyjson_obj_get(yyjson_arr_get(required, i), "script"));
int slen = strlen(script) / 2;
wb->coinb3len += 8; /* value 0: the buffer is zeroed */
wb->coinb3len += ser_compact_size((uchar *)wb->coinb3bin + wb->coinb3len, slen);
hex2bin(&wb->coinb3bin[wb->coinb3len], script, slen);
wb->coinb3len += slen;
}
/* ... then nLockTime, as before. */Also refuse a template for block 20,160 or later that has no coinbase_required_outputs
field at all (a node that is too old): better no job than a block that will be thrown away.
ckpool: the complete template check (refuse what cannot be copied unchanged)
Call it on the getblocktemplate result before the template is used, and drop the template if it returns false.
/* The first height whose block must carry the required coinbase outputs.
* 20160 is mainnet; make it a config value for regtest (2000). */
#define MOI_DRIVECHAIN_GATE_HEIGHT 20160
#define MAX_GBT_REQUIRED_OUTPUTS_LEN 100000 /* the MOI block size: no template can exceed it */
int drivechain_gate_height = MOI_DRIVECHAIN_GATE_HEIGHT;
/* LOGREFUSAL: use your warning-level log macro (LOGWARNING in stock ckpool). */
/* Bitcoin MOI: check the coinbase_required_outputs a block must carry from the
* drivechain gate on, so generate_coinbase() can copy them without further
* checks. Refuse the template on anything we could not copy unchanged. */
static bool check_required_outputs(yyjson_val *res_val, const int height)
{
yyjson_val *outs = yyjson_obj_get(res_val, "coinbase_required_outputs");
size_t i, total = 0;
if (!outs) {
/* A MOI node exports the field, possibly empty, at every height
* from the gate on. Without it the block would lack the SCDB
* commitment and be invalid, or, against a node without the
* drivechain rules, start a fork of its own. */
if (unlikely(height >= drivechain_gate_height)) {
LOGREFUSAL("REFUSING TEMPLATE for height %d: no coinbase_required_outputs at or above "
"the drivechain gate %d, the node does not export them",
height, drivechain_gate_height);
return false;
}
return true; /* Absent below the gate */
}
if (unlikely(!yyjson_is_arr(outs))) {
LOGREFUSAL("REFUSING TEMPLATE: coinbase_required_outputs is not an array");
return false;
}
for (i = 0; i < yyjson_arr_size(outs); i++) {
yyjson_val *entry = yyjson_arr_get(outs, i);
yyjson_val *value = yyjson_obj_get(entry, "value");
const char *script = yyjson_get_str(yyjson_obj_get(entry, "script"));
size_t len = script ? strlen(script) : 0;
/* Every entry today is a zero value OP_RETURN */
if (unlikely(len < 4 || len % 2 || !validhex(script) || strncmp(script, "6a", 2) ||
!yyjson_is_uint(value) || yyjson_get_uint(value))) {
LOGREFUSAL("REFUSING TEMPLATE: coinbase_required_outputs entry %d is not a zero value OP_RETURN",
(int)i);
return false;
}
/* generate_coinbase() writes the script length as a 1 or 3
* byte compact size, as counted below. A longer script would
* need the 5 byte form; such an output is far beyond anything
* MOI consensus produces, so refuse it. */
if (unlikely(len / 2 > 0xffff)) {
LOGREFUSAL("REFUSING TEMPLATE: coinbase_required_outputs entry %d script is %d bytes, over 65535",
(int)i, (int)(len / 2));
return false;
}
total += 8 + 3 + len / 2;
}
if (unlikely(total > MAX_GBT_REQUIRED_OUTPUTS_LEN)) {
LOGREFUSAL("REFUSING TEMPLATE: coinbase_required_outputs total %d bytes is over the limit %d",
(int)total, MAX_GBT_REQUIRED_OUTPUTS_LEN);
return false;
}
return true;
}Test it on regtest
On regtest the gate is at block 2,000, so you can test today:
moid -regtest -daemon
moi-cli -regtest createwallet test
moi-cli -regtest generatetoaddress 1999 "$(moi-cli -regtest getnewaddress)"
# what the next template asks for (block 2,000):
moi-cli -regtest getblocktemplate '{"rules":["segwit"]}' | grep -A 6 '"coinbase_required_outputs": \['
# now point your pool at this node and mine a few blocks through it, then:
moi-cli -regtest getblockcount # must be above 2000: the node accepted your blocks
moi-cli -regtest getblock "$(moi-cli -regtest getblockhash 2000)" 2 | grep -c 6ad85cdb # 0 = the output is missingIf your pool's blocks at 2,000 and above are refused, it is not ready for mainnet.
3 · Sidechain commands
0.1.1 refuses createsidechainproposal, acksidechain, setwithdrawalvote and
receivewithdrawalbundle until block 20,160 has connected. 0.1.0 accepted them and dropped them at the
gate. Send them after the gate, and again after any reorg across block 20,160.
Questions
Ask in the Bitcoin MOI Telegram chat: t.me/bitcoinMOI