Creating a sidechain
Someone proposes it; miners vote block by block.
5 min readStep 1: someone proposes it
A new sidechain starts as a proposal. A miner writes an M1M1 · Propose sidechainA coinbase message that proposes a new sidechain for a slot. message into the coinbase transactionCoinbase transactionThe first transaction in a block, written by the miner. BIP300 and BIP301 place the miners' messages and votes there. of a block they find. The message carries the sidechain's declaration and the slot it wants. A new proposal starts with zero votes.
Only miners write coinbase transactions, so a sidechain's developers ask miners to include their proposal.
Step 2: miners vote, block by block
In each later block, the miner can vote for the proposal with an M2M2 · ACK proposalA coinbase message in which a miner votes for a pending sidechain proposal. message that quotes the proposal's declaration hash. A block gives a proposal at most one vote. A block that does not vote for it simply doesn't add one.
It is like a show of hands that lasts thousands of blocks (about two weeks at the ten-minute target): every block is one hand, and only blocks that raise it count.
Step 3: activate or expire
The proposal activates when its votes go above the thresholdThresholdThe number of votes that must be exceeded, within a maximum age, for a proposal or withdrawal to pass. Each network reports its own values. before it gets too old. If it runs out of time, it is dropped. Taking an empty slot needs fewer votes than replacing a sidechain that is already active: replacing one should be hard.
The rules eCash is running
Loading live data…
Proposals being voted on
Loading live data…
How today's sidechains were activated
Loading live data…
Go deeper: what the messages look like, in each document
Both are coinbase outputs that start with OP_RETURN. M1 has the header D5E0C4AF followed by the slot number and the declaration (a version, the title, the description and the two hashes) in all three documents. M2 is where they differ:
| BIP300 | LayerTwo Labs spec | Enforcer on eCash | |
|---|---|---|---|
| M2 header | D6E1C5BF | D6E1C5BF | D6E1C5DF |
| M2 fields | declaration hash | slot, declaration hash | slot, declaration hash |
| M1 per block | at most one | several, not the same slot and declaration twice | several, not the same slot and declaration twice |
| M2 per block | at most one | at most one per slot | at most one per slot |
eCash runs the enforcer, so the last column is what its miners must write: an M2 with the BIP's header would be ignored there. The sidechains active on eCash got their votes in that format.
A vote only counts from the block after the proposal. That is why a sidechain that got a vote in every block activates exactly unknown blocks after it was proposed on eCash, as the timeline above shows.
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.