Ethereum-Kusama Bridge is Now Live On Khala Network

Phala Network
Phala Network
11 min readAug 6, 2021

--

Khala Network is progressing to the next stage: Ethereum — Khala Bridge is officially live now! We are thrilled to announce the first official parachain-Ethereum bridge on the Substrate ecosystem!

Try it now 👉 https://app.phala.network/bridge/

Now, you can swap ERC20 PHA to the Khala chain in a decentralized way with no fee beyond an Ethereum transaction fee. Per the Khala’s launch roadmap, the Khala-Ethereum bridge will be enabled through referendum after removing Sudo and enabling the transaction function.

1. Why Do We Need a Bridge?

Khala Network is a parachain of Kusama, based on Substrate, and is the “canary chain” for Phala Network. Khala went live after winning a Kusama slot auction in mid-July. A referendum on the new TEE token economics will be held after Khala has run stably for some time. We expect to introduce the new token economics and the TEE mining mechanism shortly afterwards, putting into practice the new token economics released a few weeks ago. Khala is a prelude for the Phala mainnet, and as a canary network, it serves the role of test-pilot and proving ground for Phala. In the future, it will provide services to innovative and growing blockchains and serve the DeFi space.

PHA is the only functional token for all the Phala network and services, which can be used to:

  • Buy trusted computing resources: computing resources, on-chain and off-chain storage, etc.
  • Security guarantee: To be a Gatekeeper or CPU Miner one must stake a certain amount of PHA. The stake would be subject to slashing for inappropriate behavior.
  • Governance: Stakeholders who hold sufficient PHA will be able to join the Khala/Phala DAO to further participate in community governance.
  • Other payments: Settlements for other services or products such as Web3 Analytics, cross-chain bridges for permissionless chains, and more!

As previously described in the Phala token economics, PHA will circulate in three forms on Ethereum, Khala, and Phala mainnet. (For now, BSC and HECO are available.) These three chains are like islands, and it’s necessary to build bridges between them to ensure PHA’s liquidity. The Khala Ethereum Bridge will be the first basic infrastructure to meet this need.

2. The Advantage of Decentralized Bridges

In some services, cross-chain asset transfers are achieved in a centralized way. For example, clients running different blockchains may have servers run a background program to synchronize their ledgers. But centralized bridges come with inherent problems such as security concerns, ease of manipulation, lack of stability, and difficulty accommodating long-term support and maintenance.

The Phala team will bridge between EVM (Ethereum) and Substrate-based chains (Polkadot, Kusama) by adopting the ChainBridge cross-chain communication protocol.

In this protocol, a bridge contract (or “pallet” in Substrate) is established on either side of a bridge. Handler contracts perform the expected behavior upon receiving transactions to and from the bridge — for example, locking up or destroying an asset on one side and minting a new one to send out on the other. It’s highly customizable — you can deploy a handler contract to perform any action you like.

In its current state, the Khala Ethereum Bridge operates under a trusted federation model. Deposit events on one chain are detected by a trusted set of off-chain relayers who await finality, submit events to the other chain, and vote on submissions until they reach acceptance and trigger the appropriate handler.

At present, Khala Ethereum Bridge has passed an audit by CertiK, a top blockchain security company. Per the audit report, there are no critical or major errors or known vulnerabilities; some minor concerns have been solved or addressed. The Khala Ethereum Bridge can enable users to move ERC20 PHA to K-PHA ($PHA on Kusama, K is marked to the readersin Khala chain accounts, allowing people to join the campaigns on Khala, including TEE mining.

Audit report: https://www.certik.org/projects/phalanetwork

Khala Ethereum Bridge smart contract: https://etherscan.io/address/0x6ed3bc069cf4f87de05c04c352e8356492ec6efe

Ethereum side contract source code: https://github.com/Phala-Network/chainbridge-solidity

Phala side contract source code: https://github.com/Phala-Network/khala-parachain/tree/be4eb938059d7b40513ea20f894a3e5bbdf6dc92/pallets

Bridge node code: https://github.com/Phala-Network/ChainBridge

Consistent with the principles addressed above, the decentralized bridge is safe, and fully open-source. System operation is sustainable and is unlikely to run into operating or maintenance issues. Once started, the decentralized bridge process is irreversible, and issuing additional tokens or falsifying ledgers is impossible.

3. Khala Ethereum Bridge Bilateral Asset Management

In the Khala economic model, K-PHA can be swapped with ERC20-PHA at 1:1. The process is decentralized and automated, requiring no human review or intervention.

All K-PHA are part of the overall Phala economic model, and cannot be created “out of thin air.” That means each K-PHA must consume ERC20-PHA; the same will be true in reverse when later transferring from Khala to Ethereum. To create the security and decentralization described earlier before, the Ethereum-side bridge contract and the Khala-side Relayer need multi-signature management to guarantee asset security.

Suppose user Gavin wants to transfer 10 PHA from Ethereum to Khala. The image above charts the steps. Here’s what Gavin does, and what the system does:

  • Gavin selects 10 ERC20-PHA on https://app.phala.network/bridge/ and fills in his Khala deposit address
  • Then confirms and sends the transaction by signing in the Ethereum wallet
  • And, finally, receives 10 PHA in his Khala wallet

This is achieved through multiple events that happen on-chain:

  • The Khala bridge contract on the Ethereum receives and freezes 10 ERC20-PHA when Gavin submits the transaction on the Ethereum side
  • The Relayer model on the bridge monitors this transaction, and relayer nodes confirm the event with each other via voting to ensure it is valid
  • After confirmation, the Relayer model triggers withdrawal on the Khala bridge Pallet
  • Khala bridge Pallet sends 10 PHA to the indicated address

How do we ensure security and decentralization for both the Ethereum bridge contract and the bridge Relayer?

On the Ethereum side, we manage the Ethereum bridge contract by:

  • Using a third-party multi-signature tool (https://gnosis-safe.io/app/#/welcome, whose web version supports Metamask) to implement a multi-signature wallet. (This contract is open-resource and passed an audit.) The multi-signature accounts and thresholds are established when creating this contract.
  • Renouncing administrative control over the multi-signature contact address through the bridge.renounceAdmin call after finishing the bridge implementation on Ethereum.
  • Using this tool to create transactions is similar to parliamentary proposals on Polkadot. Corresponding accounts are used to sign a transaction. After the threshold is reached, the appropriate method of the contract will be automatically executed.

On the Khala side, this is how we enable bridge Pallet management:

  • Code updates for the bridge Pallet come through technical proposal referendums
  • Changes to Relayer node membership requires council signatures

4. Bridge Asset Migration Announcement

Phala’s original economic plan allocated the initial token supply into several categories. This was refined and extended as described in the Khala Slot Auction Strategy announcement.

These allocations are described here; the original as part I and post-auction as part II.

https://docs.google.com/spreadsheets/d/1QL17JucaZ9sdxWBDHTpwXOpugtEBJk5MBtWqmDebY-g/edit#gid=0

A portion of the ERC-20 PHA tokens currently on Ethereum will be moved to Khala as K-PHA as described below:

  • ERC20-PHA issued and in circulation on the Ethereum network belong to private holders and can be transferred as they choose;
  • TEE Mining (70%): A total of 700 million PHA are frozen in the Ethereum address (0x4731bc41b3cca4c2883b8ebb68cb546d5b3b4dd6) to be used as mining rewards. The Phala team will transfer 10 million (1% of the total initial coin supply) from this address to serve as the Khala Mining reward subsidy pool (the remaining 690 million PHA to be future Phala Mining reward subsidy pool);
  • Private Sales (15%): of 150 million total, 120 million have already been unlocked, and the remaining 30 million are frozen in Ethereum address (0x2ddf0d1ef937cd9d1b8cc4ab9dbec1f8b24ce18d) yet to be unlocked. All 30 million will be transferred to Khala and issued in the form of time-locked addresses(will be unlocked on September 11, 2021);
  • Testnet incentives (1%): total 10 million, nearly 4 million have already been issued (3 million ERC20-PHA for daily operations, 1 million Vendetta testnet rewards issued in Khala), and the remaining 6 million are frozen in the Ethereum address (0xb7687a5a3e7b49522705833bf7d5baf18aabdd2d). Of these, 2 million will be transferred for use in Khala (1 million for volunteer incentives + 1 million for Vendetta testnet rewards), and the remainder will continue to be used for expenditures that have a positive incentive effect on the Phala network;
  • Parachain Slot Auction allocation (6.9%): total 69 million, all frozen in the Ethereum address (0x38ac21e6e82b07917f661344342a06898f0882a8). Kusama bidding Rewards total 25 million to be distributed, of which 3.7 were distributed through the Ethereum network and 21.3 million will be transferred to Khala (Crowdloan rewards). The remaining 44 million will be used during the future Polkadot Parachain Auction.
  • Team (5%): Total 50 million, 35 million unlocked, and the remaining 25 million frozen in the Ethereum address (0x5cae84c52647096a8d22e19ef1c6305071daec09). 25 million will be transferred (15 million locked + 10 million unlocked). The time-locked part will be released 2.5 million per month; the release will be completed on January 31, 2022. The unlocked part will be used for ongoing Khala network construction.
Chart — PHA Asset Allocations

⚠️ Note: We expect to execute the transfer of assets from August 6th to 9th, 2021. The community is asked to observe according to the above addresses, and not give credence to rumors or contribute unnecessary panic. If you observe any charges/transfers to the Ethereum-Khala bridge contract from the publicized address at any of the above public addresses, it will correspond to transactions in the Khala token distribution plan.

After the team’s completion of the asset transfers, the total amount of K-PHA will potentially be 266 million, but the actual circulation will be 88.3 million, as detailed below:

Notes:
* On Khala, 30 million K-PHA were newly issued to allow for distribution of 21.3 million slot auction rewards. A corresponding 30 million PHA will be destroyed after the bridge is opened and assets are transferrable.

† An unknown amount of privately held PHA may be transferred by others. The 88.3 million minimum is the amount to be transferred by the Phala team, consisting of:

  • Khala Mining Rewards: 10 million (not yet in circulation)
  • KSM Parachain Slot Auction Rewards: 21.3 million (34% in circulation + 48-week linear release of remainder)
  • Testnet Incentives: 2 million (a half in circulation)
  • Private Sale: 30 million (uncirculated portion)
  • Team: 25 million (10 million in circulation, 15 million linearly released over time)

‡ The total potential supply of K-PHA includes the following, assuming all possible PHA is transferred to Khala by private parties:

  • Khala Mining: 1%
  • KSM Parachain Slot Auction: 2.5%
  • Testnet incentives: 1%
  • Private Sales: 15%
  • Team: 5%
  • Stakedrop: 2.1%

Total: 26.6% of initial PHA supply.

Khala Ethereum Bridge smart contract: https://etherscan.io/address/0x6ed3bc069cf4f87de05c04c352e8356492ec6efe

Details of PHA Asset Allocations:https://docs.google.com/spreadsheets/d/1VVOGnPYihG8NZCJALkG36j5QVZ6yOnlmYlfFbVoAxfM/edit?usp=sharing

Note that any private holder can swap their ERC20-PHA into K-PHA through the Ethereum-Khala bridge. Then the bridge contract will increase and lock this portion of the circulation on Ethereum, and release the corresponding issuance into circulation as K-PHA on the Khala Network. (The opposite will be possible when the Khala-Ethereum bridge is opened.)

5. Ethereum — Khala Bridge Tutorials

I. Desktop Browser

Preparation
To use the Ethereum-Khala bridge, please ensure your explorer is Chrome or Firefox and that Metamask wallet is installed. (Polkadot.js also works, but is not required.)

  1. Visit https://app.phala.network/bridge/
  2. Connect to Metamask
  3. Fill in the cross-chain assets transfer information:
  • choose your source Ethereum account
  • choose your Khala deposit address

4. Fill in the amount of ERC-20 PHA that you want to transfer from Ethereum

5. If it’s first time you are transferring your PHA assets, you may need to click an “Approve” button and sign with Metamask to confirm

6. Then confirm and click the “Next” button. Double-check your accounts and figures and then click ”Submit” in the pop-up window, sign with Metamask, and submit your cross-chain asset transaction!

7. Click “Etherscan” to check the sending details on the Etherscan block explorer when your transaction is sent

II. Mobile Wallet

  1. Log into the DApp wallet (imToken/MathWallet/TokenPocket,etc.) you use and paste https://app.phala.network/bridge/ in the search bar

*Note: please ensure you connect your Ethereum wallet to you use MathWallet or TokenPocket

2. Follow the Desktop Browser steps from 3 to 7

6. About the Khala Ethereum Bridge

Please note that:

  • The Khala network does not currently provide a transfer function, so bridging is currently one-way from Ethereum to Khala.
  • The transferred PHA (called K-PHA to show it is on Khala) can only be used for referendums and staking at this point. When Khala is live and running well, and after TEE mining begins, we will submit the proposals to decide whether and when to enable the Transfer function on Khala through a referendum after removing the dev team’s Sudo permissions. At that point, it will be possible to create a bridge from Khala to Ethereum. (And, later, a bridge between Khala and Phala.)

About Phala

Phala Network tackles the issue of trust in the computation cloud.

This blockchain is a trustless computation platform that enables massive cloud processing without sacrificing data confidentiality. Built around TEE-based privacy technology already embedded into modern processors, Phala Network’s distributed computing cloud is versatile and confidential. By separating the consensus mechanism from computation, Phala ensures processing power is highly scalable but not wasteful. Together, this creates the infrastructure for a powerful, secure, and scalable trustless computing cloud.

As a member parachain of the Polkadot cross-chain ecosystem, Phala will be able to provide computing power to other blockchain applications while protecting the data layer, enabling possibilities like privacy-protected DeFi trading positions and transaction history, co-computing DID confidential data, developing light-node cross-chain bridges, and more.

On-chain services currently being developed on Phala Network include Web3 Analytics: high-performance smart contracts from Phala to enable highly concurrent mass data analytics with privacy, paving the way for an alternative to Google Analytics that inherently respects individual confidentiality.

🍽 — Subscribe | Website | Twitter | Github
🥤 — Discord | Forum | Telegram |Italiano |Français | Persian

--

--