Phala/Khala Network

Adam Steeber
6 min readJan 21, 2022

While transparency is one of the most endearing features of blockchain technology, it cannot compete with the simplicity of privacy offered by web 2 solutions. However, web 2 privacy almost always requires trust and in the world of blockchain, truth is preferred. So how can a technology curate truthful privacy without compromising that very privacy? This is exactly the kind of problem that technologies like Calamari, Crust, Kilt and Phala are all working diligently to solve. Calamari is using zero knowledge proofs to facilitate private token trades. Crust is using trusted execution environment (TEE) technology to allow nodes to prove the storage of a digital asset in a trustless manner without exposing their directory infrastructures. Kilt is using decentralized networks of token-curated attesters to provide users privately attested credentials. However, the Phala parachain is arguably the most useful application of privacy — computation.

Problem: web 2 lacks trustless privacy

Credit: https://www.shutterstock.com/image-photo/dark-web-hooded-hacker-cyber-war-1346380844

Traditional cloud computation, like AWS or Google Cloud, allows users to access the servers hosted by these tech giants to run programs or applications. Using services like these offer affordable high-performance computation, but the hosted servers are ultimately owned and controlled by the service providers.

Let’s say you’re a financial firm that pays a lot of money for proprietary stock signals. These signals give you a competitive edge on the market, but you require high-performance cloud computation to run the machine learning algorithms that turn these signals into price predictions. By using AWS, any Amazon employee with adequate permissions would be able to peek at your proprietary signals and use them in their own price predictions. This is the biggest problem with web 2 cloud computation solutions; just look at this article detailing a former Amazon employee who stole sensitive consumer data from Capital One by exploiting a flaw in Amazon’s credential permissions.

Phala’s solution: isolated enclaves, remote hardware attestation, & encryption endpoints

When a Phala node performs a computational task it does so inside of a trusted execution environment. I covered TEE in my Crust article but to summarize, it is a protocol that uses secure hardware to perform tasks without the risk of being influenced by external processes. For now, Phala relies on the TEE, specifically Intel SGX, as the secure workers; but this design also supports other workers like AMD SEV, or even MPC- or ZKP-based solutions. These technologies ensures that any code executed inside of an enclave is totally deterministic and isolated from OS or hardware processes. Once a process is complete, it is sent to a remote hardware module called a “remote attester” which ensures that the computation was done correctly without needing to examine the tasks themselves. In other words, no one, not even the node operator can see the data nor what the data is doing while it is being processed. Since all Phala nodes are required to adhere to these hardware requirements, all data that enters the network remains hidden while it is being processed.

But how can someone place an order with the network without exposing their data to the network? Node operators host their contracts by running pRuntime which connects them to the Phala blockchain and Phala gatekeepers manage the encrypted endpoints where users interface with node operators. This is where the magic of web 2 and web 3 collide; elected gatekeepers manage key pairs that are used to encrypt any data submitted to node operators for computation. The data is then decrypted inside the node operator’s isolated enclave where no prying eyes can peek, so while a user publishes their contract invocations on-chain, these invocations are encrypted. Therefore, the only information that someone can infer from a user’s on-chain transactions is that the user is interacting with some contract on the Phala network.

Problem: smart contract computation is limited by the miner

Solidity smart contracts are extremely useful, but each operation within a contract requires gas since block writers must write any and all computations that take place in the block they are writing. Block sizes are limited so there are hard caps to computation; contracts compete by offering block writers more gas to write their operations first. This problem is the result of computations being written by one miner per block which limits what is computationally possible on the network to the capabilities of the current block writer. Here is a great article detailing gas costs for a contract deployed on the Ethereum network.

Phala’s Solution: off-chain computation with Fat Contracts

Instead of relying on one miner to handle all of the computational needs of the network, Phala relies on its worker nodes to host their own contracts. This allows the network’s computational ability to scale linearly with the number of workers on the network. Think of it like the difference between a supermarket with only one checkout lane available and a supermarket where all of the checkout lanes are available; with Phala, a contract invocation does not need to wait in a long line nor bribe the cashier to be written on-chain sooner.

This type of infrastructure allows for a different kind of smart contract called a “Fat Contract.” Phala wrote a great article introducing Fat Contracts laying out three fundamental differences compared to Ethereum smart contracts:

  • The ability to run computationally intensive tasks like video rendering, machine learning algorithms, or even cosmic simulations of billions of stars. In fact, Phala has recently partnered with Blender, a 3D modelling technology.
  • Low-latency real-time computation for use in VR environments, games, pinging services, or instant messaging.
  • Internet services such that a contract invocation can include HTTP requests.

Phala Fat Contracts are written in Rust but are also compatible with Parity ink! allowing for seamless integration into Substrate blockchains. These fundamental differences facilitate what was previously impossible with Ethereum smart contracts.

Polkadot Parachain Strategy

  • 100,000,000 PHA (10% of PHA supply)
  • 12 PHA:1 DOT ratio
  • 15% of the reward will be released immediately, 85% vested over 96 weeks

I want to take this opportunity to speak to the speculators who pooh-pooh Phala’s rewards. These speculators only look at the Dot-sama ecosystem through the lens of fiat returns which, in my opinion, is a hopelessly incomplete perspective. PHA is not merely a speculative asset, rather its purpose is to incentivize node operators to deploy their Fat Contracts to the Phala network. Obtaining and holding PHA is a vote of confidence in the technological advancement taking place on the Phala network. It also gives you exclusive access to submit transactions on the network to interact with these revolutionary, privacy-assured contracts. If you believe in privacy and decentralized computation then you will support Phala in their bid for a parachain slot, plain and simple.

The more people supporting and building on Phala the more demand we will see for PHA. Now is not the time for passive interest — now is the time to build! So assemble your game devs, your AI devs, or even your NFT devs to start creating what was previously impossible. The future of decentralized computation is here.

--

--

Adam Steeber

My focus as a writer is non-fiction, though I do dabble in fiction. I want to create content that comes from the passion of my mind. I seek to illuminate truth.