Drivechains Allow Sidechain Node Operators To Pay Miners To Mine — And More!

2 years ago

Drivechains, similar softchains, are different sidechain implementation with two-way peg functionality.

This is an sentiment editorial by Shinobi, a self-taught pedagogue successful the Bitcoin abstraction and tech-oriented Bitcoin podcast host.

This clip I'm going to beryllium breaking down and discussing however drivechains work; they were initially projected successful 2015. Out of each the proposals discussed truthful far, drivechains are the oldest and the astir fleshed retired successful presumption of circumstantial implementation details and design, documented successful BIPs 300 and 301. Paul Sztorc, the creator of the concept, had a fewer main plan goals successful mind, and portion this is not astatine each comprehensive, present are a few:

  • Isolate each sidechain truthful immoderate nonaccomplishment oregon occupation would lone impact those utilizing it.
  • Allow sidechains to beryllium spun up without needing a caller fork for each one.
  • Enable the transportation of bitcoin successful and retired of a sidechain with a two-way peg.
  • Allow for escaped experimentation successful plan helium hopes would obsolete the request for altcoins.

There are 2 superior aspects of the full design, which is wherefore determination are 2 abstracted BIPs. The archetypal is the peg mechanics (BIP300), which is what enables the two-way peg to function. Sztorc designed thing called a hash complaint escrow, which, successful the astir basal terms, is allowing miners arsenic an amorphous radical to collectively custody the coins successful each the sidechains. The 2nd is simply a "blind" merged mining scheme, wherever the extremity is to let bitcoin miners to beryllium the artifact producers astatine a statement level without being required to validate the sidechain to bash so. Both of these pieces unneurotic contiguous a two-way peg mechanics and a mode for bitcoin miners to instrumentality portion successful mining the sidechains portion attempting to mitigate the centralization hazard that it presents.

BIP300 specifies logic for the connection of a caller sidechain, the activation of a caller sidechain, the connection of a bundled acceptable of withdrawals, the support of specified a acceptable of withdrawals, the validation logic for existent withdrawal transactions and the validation for deposit transactions.

Activating a caller sidechain nether the drivechain connection is precise akin to the process of a brushed fork activated done miner signaling. The large quality is, of course, it's not really a brushed fork — a azygous fork to activate the drivechain statement rules allows miners to, astatine immoderate time, awesome to activate a caller sidechain within drivechain statement rules. To suggest activating a caller sidechain, a miner indispensable spot an OP_RETURN information successful their coinbase output that includes a unsocial identifier for that sidechain, a nationalist cardinal to usage successful deposit operations, mentation data, human-readable descriptions, and hashes of the bundle lawsuit and GitHub past of it (there is nary statement enforcement here, conscionable information for humans to reference).

When a miner proposes activating a caller sidechain and including each the indispensable information successful their coinbase, it becomes a benignant of "miner signaling" play regarding whether oregon not to make this caller sidechain from the constituent of presumption of mainchain consensus. A miner tin usage a peculiar format to see a connection successful their coinbase outputs, and different miners tin make different output pursuing a 2nd format to awesome for activation. A caller sidechain connection requires 90% of blocks successful a trouble play to awesome for activation successful bid for a caller sidechain instauration to beryllium confirmed. This creates the peg mechanics to alteration the sidechain, but the enactment betwixt sidechain and mainchain is much nuanced than that.

At this point, anyone tin peg coins into the sidechain. To peg into the sidechain, a idiosyncratic simply creates a 2 input transaction with their ain input and the UTXO corresponding to the sidechain equilibrium with a azygous output assigning everything to the sidechain. This guarantees the sidechain lone ever has a azygous UTXO containing each the funds locked successful it. Withdrawals are handled by miner voting. The mainchain has nary knowing of who owns what connected the sidechain, and the mainchain volition see immoderate withdrawal approved by miners wrong the voting mechanics valid. Because of this, determination is simply a agelong hold successful the withdrawal process. There are 2 phases to the process of withdrawing from a sidechain: a withdrawal connection (bundle), and past the withdrawal voting phase. Miners indispensable make an OP_RETURN output successful their coinbase transaction with a hash of the projected withdrawal transaction to suggest a withdrawal. This hash, however, akin to sighash, flags lone committing to portion of a transaction alternatively of the full thing. It does not perpetrate to the input UTXO that represents funds locked successful a drivechain oregon the output that returns everything not being withdrawn to a peculiar sidechain UTXO. This is due to the fact that immoderate deposits into the drivechain would make a caller UTXO, and frankincense invalidate the committedness to the withdrawal transaction erstwhile radical went to validate it.

From here, the miner voting play connected the withdrawal connection begins. After a bundle has been proposed, miners are capable to ballot connected whether to o.k. them oregon not. Each artifact that is mined allows that miner to increment an support counter, up oregon down by one, oregon 2 to abstain from doing anything. There are immoderate circumstantial limitations successful summation to this, due to the fact that it is imaginable to person much than 1 bundle for a azygous sidechain — if a miner chooses to ballot "yes" (raise the antagonistic by one) for a withdrawal bundle for a sidechain they must ballot "no" (lower the antagonistic by one) for each different bundle associated with that circumstantial sidechain.

This is to warrant that determination are nary "double withdrawals," wherever idiosyncratic has an output successful aggregate bundles that would wage them retired much bitcoin connected the mainchain than they are owed.

On the different side, miners are besides allowed to ballot nary for each azygous projected bundle. This is expected to relation arsenic a benignant of alarm for everyone that a miner validating these withdrawals (making definite they are legitimately owned coins connected the sidechain being withdrawn) has noticed thing invalid happening. Remember, a cardinal constituent of this plan is that miners bash not person to validate thing connected the sidechain, truthful unless they take to anyway, galore miners whitethorn beryllium upvoting bundles they are not verifying. This alarm relation is designed for them to beryllium alerted that they should verify the bundles to guarantee a fraudulent withdrawal isn't happening.

Once a bundle has reached the required threshold (13,150 blocks, oregon astir 90 days), the transaction really processing the withdrawal becomes valid and tin beryllium confirmed. But what bash radical bash if miners o.k. a fraudulent withdrawal that steals wealth from the sidechain? Sztorc's connection is to prosecute successful a user-ctivated brushed fork (UASF) to invalidate the invalid peg-out transaction. This presents a immense hazard successful presumption of statement to the mainchain. The UASF successful 2017 was a high-risk determination that lone hardly succeeded and Bitcoin was overmuch smaller than it is today. The larger Bitcoin grows, the much hard specified actions volition beryllium to coordinate.

If you callback from the article connected spacechains, that plan was based astir unsighted merged mining (BMM). Ruben Somsen’s BMM plan is really the 2nd variant of that, the archetypal being Sztorc's plan arsenic laid retired successful BIP301. The BMM spec successful drivechains is composed of 2 messages: a petition connection and an judge message. Both are coordinated respectively done a peculiar transaction benignant connected the mainchain and peculiar output successful a miner's coinbase transaction.

The petition transaction is constructed by whoever is creating sidechain blocks. The full constituent of BMM is that this idiosyncratic tin beryllium idiosyncratic who is not mining, truthful the petition transaction is determination to let them to wage miners to corroborate their projected sidechain block. The sidechain artifact connection constructs a transaction that includes the hash of the sidechain block, the ID assigned to the sidechain erstwhile it was created and the past 4 bytes of the erstwhile mainchain artifact header. There are 3 further statement rules applied to these types of transactions. First, a petition transaction is invalid unless determination is besides a matching judge output successful the coinbase transaction of that block. This is to warrant miners cannot cod a interest from the petition without besides accepting and mining the sidechain block. Second, for each sidechain lone 1 petition transaction is allowed to beryllium included successful a mainchain block. This is to guarantee lone 1 artifact from immoderate sidechain tin really beryllium mined per mainchain block. Lastly, the past 4 bytes of the erstwhile mainchain artifact indispensable match. This ensures that a petition is lone valid to beryllium mined successful the adjacent block, and specified transactions cannot beryllium mined aboriginal and bargain wealth from a sidechain artifact proposer aft idiosyncratic else's artifact has been mined.

The judge output is precise simple: connection header information and the hash of the sidechain block. If a miner is moving a drivechain node themselves, they tin simply disregard petition transactions and ever see their ain judge output successful their coinbase to excavation their ain sidechain blocks. Together, these 2 aspects let miners to either run a sidechain node themselves, oregon different non-miner to bash it and wage the miner to excavation their blocks. The thought is that, if miners themselves bash not tally the sidechains and devour the other validation costs, past idiosyncratic other tin bash it for them. If determination is contention successful non-miners trying to gain fees connected the sidechain, they are apt to support bidding up the interest they are consenting to wage miners successful their petition transaction until it represents the bulk of the fees they earn, with the non-miner lone keeping a tiny percent of nett and paying the remainder to miners.

That's the mechanics down however drivechains function. Next up, federated sidechains, and then, aft that, a breakdown of each the negatives and downsides each plan tin have.

This is simply a impermanent station by Shinobi. Opinions expressed are wholly their ain and bash not needfully bespeak those of BTC Inc oregon Bitcoin Magazine.

View source