Ethereum wouldn’t be where it is today without its older cousin, Bitcoin. Ever since it launched, there’s been critique about the requirement of launching a completely separate blockchain, with its own cryptographic token securing its network. For various reasons, it was decided it must be separate and after a year of development, Ethereum went live on 30 July 2015. It doesn’t mean these cousins won’t ever to get to hang out again! There’s been thoughts of getting bitcoin (the token) over to Ethereum or adding Ethereum (virtual machine) support to Bitcoin. A thought-provoking whitepaper, published last week by Rootstock, spurred discussion about this interplay and extending smart contracts to Bitcoin.

Overview of a Typical 2-way Peg

The typical example of interoperability with Bitcoin and Ethereum is via a 2-way peg.

Ethereum smart contracts are powerful enough so that a 2-way peg with Bitcoin can be done in Ethereum. A 2-way peg with Bitcoin is exciting to most involved in Bitcoin, as it allows bitcoins to be “deposited” to another blockchain, and then “withdrawn” back to the Bitcoin blockchain. As bitcoins can be deposited in another blockchain, a 2-way peg can enable users to make use of functionality that exists on another blockchain that is not available on the Bitcoin platform. Or this mechanism can serve as an upgrade and migration path for Bitcoin: when people believe in the upgrade, they simply keep their bitcoins in the other blockchain instead of withdrawing it back.

Here is a general description of a 2-way peg with Bitcoin. Bitcoins are BTC, and let’s call the bitcoins on the other blockchain E-BTC. To keep things simple, we’ll use Ethereum as the other blockchain.

When a user “deposits” the BTC, the BTC is locked on the Bitcoin blockchain. A proof of this Bitcoin transaction is sent to an Ethereum contract, call it PegContract. PegContract verifies the transaction and issues E-BTC to an Ethereum address controlled by the user, such that 1 BTC on the Bitcoin system becomes 1 E-BTC on the Ethereum platform.

Later, the user decides they are finished with E-BTC and wants the BTC back. The user burns the E-BTC (or returns it to the smart contract automatically overseeing the whole process) and provides a proof of this to the Bitcoin blockchain. The Bitcoin blockchain verifies that the E-BTC are destroyed, and unlocks the original BTC.

The locking and unlocking of BTC is a simple way to explain a 2-way peg. The PegContract contract can be written today and can do everything it needs to trustlessly: it can verify that Bitcoins were sent to an address that locks them up; it can issue E-BTC; and it can destroy E-BTC and provide a proof of the destruction. But the mechanisms for verifying the proof and unlocking (and possibly locking) on the Bitcoin blockchain, need new opcodes to be added to Bitcoin.