Master Thesis: Bitcoin Header Validation and Simplified Payment Verification using zk - SNARK
Bitcoin Header Validation and Simplified Payment Verification using
zk - SNARK
Bitcoin in 2008, a blockchain-based electronic cash system, claimed to eliminate the necessity of a trusted third party to verify the transactions on the peer-to-peer network setup. It did so by addressing the double-spending problem utilizing Hashcash’s Proof-of-Work (PoW) consensus algorithm and thus, creating, what it claims to be, "a pure peer-to-peer version of electronic cash." This solution to the double-spending problem made blockchain a more exciting technology, which paved the way for many more implementations such as Ethereum, Hyperledger Fabric, Parity Substrate, and others. These different blockchain implementations are not interoperable by default. Many solutions, such as the likes of Proof-of-Work Sidechains and the Polkadot relay-chain have been proposed and developed to enable such interconnectivity. Such solutions require running multiple nodes that together form a bridge between blockchains that they attempt to make interoperable. Moreover, these nodes also require to redundantly execute computations (sometimes very resource intensive) to maintain the state of the blockchain.
Portability is an aspect of interoperability, and Westerkamp’s Verifiable Smart Contract Portability is an attempt to enable portability amidst blockchains that support the Ethereum Virtual Machine (EVM). In his work, he splits the original contract into multiple sub-contracts for cases where the portability is infeasible due to the transaction size exceeding the Ethereum block gas limit of 8,000,000 gas. From this, we take inspiration to investigate the feasibility of using zk-SNARK to migrate blocks from one EVM supporting blockchain to another. However, given the complexity of the Ethash algorithm, it seemed to be unattemptable using ZoKrates, a zk-SNARK toolbox, at its current state. Hence, we proceed to test the possibility of the migration of the state of the mainnet Bitcoin blockchain onto Ethereum as the first step. We choose Bitcoin as the consensus protocol, for it is much simpler in comparison to Ethereum’s Ethash and offers the implementation feasibility using ZoKrates.
In this thesis, we make a successful attempt at developing a simple zk-SNARK based tooling that validates Bitcoin block headers in batches and stores them on a smart contract deployed on Ethereum. With the taken approach, one can process requests on-demand and pay once, a near-constant fee, for every transacting with the smart contract on Ethereum without having to run a continuous ad-hoc infrastructure. The tooling also supports the concept of Simplified Payment Verification, where one can validate a transaction for its containment in one of the previously verified Bitcoin headers by submitting the transaction hash and its corresponding Merkle proof. The thesis evaluates the implementation by presenting the statistics for the zk-SNARK code implementation during the compilation, setup, and execution phases, and the data verification phase on Ethereum. Finally, the thesis concludes with a discussion aimed at issues encountered, the benefits, and the shortcomings of the taken approach.
Supervisor: Martin Westerkamp 
Type: Master Thesis
Duration: 6 months
10587 Berlin, Germany
Phone: +49 30 8353 58811
Fax: +49 30 8353 58409
e-mail query