LibraBridge: Connect Libra with Ethereum

  1. Bringing Bitcoin to Ethereum
  2. peaceBridge: Connecting Ethereum Classic and Ethereum

Problem statement

If we want to realize atomic swap between Libra and Ethereum, we need both blockchains to support Hash Timelock Contracts (HTLC). Though Libra claims it supports smart contract, but it’s still under development and the user currently cannot deploy contract on chain. Hence, in our LibraSwap article, we assume that coin swap happens correctly if there is a trusted third party but this design is far away from decentralization. Nevertheless, we still can build a trustless custodian by protocol design and SPV proof.

So the question becomes if we want to do token exchange, can we achieve it without trusting MAX?


Method

Firstly, we can use Libra SPV proof to verify a Libra transaction actually happened. By implementing Libra SPV proof in smart contract, we can communicate to contract for verifying Libra transaction directly. Next, we require two methods deposit and challenge to make MAX trustworthy. The idea is MAX needs to put the deposit in the contract, and the contract acts as an escrow to complete the trade. Once MAX misbehaves without transferring Ether to the user, the user can use challenge function to prove the Libra transaction happen.

Case 1

Let’s take a look at a normal case. MAX, as an escrow, will put some digital assets into the smart contract as security deposit. The deposit is locked within a period of time to ensure that MAX cannot move the fund itself. If there is a user wants to trade Libra for Ether, the user can query whether the smart contract has enough security deposit. If the response is true, the user can transfer its Libra token to MAX’s Libra address. Once the transaction is done and MAX receives the notification, MAX will transfer Ether to user’s ETH address to complete the trade.

Case 2

Similar to the normal case, MAX has to put security deposit in the contract to earn user’s trust so the user is willing to trade on the platform. However, if the user does not receive Ether after sending the Libra transaction at Step 4, we consider it as breach of contract. Then, the user can launch the challenge process. Since the contract includes Libra SPV verification, the user can submit the transaction proof to the smart contract. Though the Libra transaction is happened on Libra instead of Ethereum, off-chain payment can be verified if required information is provided. More detail is descried in this article. On the other side, the smart contract, which acts as a trusted third party, will verify the proof and transfer Ether or equivalent amount of assets to the user. In addition, the contract will slash a portion of deposit as the penalty to compensate the user to finish the trade.

Related

This is a fun project to connect Libra with Ethereum. If Move, Libra’s smart contract programming language, is getting more mature and open to developers to interact with on chain, we can imagine there will be more applications on it.

Summary

Libra SPV enables us to realize a trustless custodian service on Ethereum without the requirement for Libra to support smart contract. Besides, a trustless custodian service has the advantage on liquidity compared to peer-to-peer trading. In contrast, there are some challenges need to be conquered. Though this work is a fun project, we can see the potential if Libra in the future becomes global currency. Together with DeFi application on Ethereum and Libra’s deep liquidity, the DeFi economy will grow into one of the largest global markets accessible by everyone.

getamis

Using breakthrough blockchain technology, Amis has created…

 

 
 

Thanks to Yu-Te Lin. 

Thanks to AMISChang-Wu Chen. He provides this article.

Original Article