Docs

Discover how Phala's AI Agent Contract offers the essential tools to develop and profit from intelligent applications.

Explore Now

Phat Contract — What Phala’s New Product Will Bring to Web3

2022-10-18

If you have followed Phala’s roadmap, it’s no surprise that the official version of Phat Contract will launch soon. In this article, we would like to provide a high-level overview of why we have developed Phat Contract and what value it can bring to the overall Web3 space.

The Next Major Step in Replacing Web2

With the accelerated rise of more and more DApp development in the blockchain space, it is no question that the backend hosting for DApps is getting more complex. Most of the current tech in Web3 is based on available solutions, such as smart contracts. However, there are still many limitations that exsit with the current infrastructure in Web3. It is obvious that the need for decentralized computing and hosting of complex applications is drastically increasing. Though, the full potential of decentralized solutions is not in use yet.

It may surprise you that most DApps and game developments built in Web3 are still using a large amount of centralized services, such as computing services provided by AWS, Microsoft, or Google.

Currently, the problem is that not enough decentralized solutions are available which can handle the requirements for such DApps.

Servers vs. Serverless

Some cloud companies provide dedicated servers for developers to host their applications on it. However, this service is often very expensive and time-intensive to set-up, leading to high operation and maintenance costs. Another option is to provision serverless functions. Serverless is a cloud computing execution model where the cloud provider offers computing resources on demand. It will also manage all architectures, including cloud infrastructure. Looking into existing centralized serverless functions, you might be familiar with AWS Lambda.

However, if you want to combine serverless functions with a high degree of decentralization, not many solutions are available for this. It is technologically easier to either focus on a centralized serverless function or on solely decentralized computation. Most solutions available provide this kind of general approach, nonetheless it lowers the automated functions in a serverless approach. The magic of combining both services has not been tackled yet and this is where Phala Network comes in. The new product that will solve these issues is the “Phat Contract”.

The Web3 Version of AWS Lambda

Phat Contract can be seen like the Web3 version of AWS Lambda backed by the decentralized Phala computing cloud. It is meant to support complex computation with low latency and cost.

The difference to other serverless solutions is that it runs on Phala’s decentralized computation cloud which has by now over 130,000 vCPU running. That said, Phat Contract does not minimize on decentralization nor on serverless functionality.

Due to the fact that Phat Contract runs in one or several decentralized computation nodes simultaneously and all computation nodes are on-call for 24 hours, scaling-up is guaranteed.

As you might know, Phala Network runs like a cloud rather than a chain. The reason for this is that we separate the consensus from the computation and all the computation nodes are executed in Secure Enclaves. Since Phat Contract is also executed off-chain, there is low latency and zero gas fee. Yes, you heard it right, zero gas fee for execution in Phat Contract. This is achieved by the off-chain execution.

The off-chain execution brings many more advantages. Simply put, you can understand Phat Contract as Lego blocks to be able to create your own DApps without the need to maintain a server. Moreover, you also do not need to resign from decentralization.

Phat Contract can access any Web2 and Web3 services through built-in internet access. Therefore, it can interact with any blockchain smart contract (EVM, WASM…)

Now you are asking, where is all the data stored when I execute in Phat Contract? No worries, we got you! Phat Contract supports the standard S3 API so you can connect to many storage solutions such as Amazon S3, Arweave, and Filecoin.

Impossible DApps made possible with Phat Contract

Let’s talk about use cases. Given all the advantages of Phat Contract, it is not too difficult to identify suitable use cases for this technology. I mean this is what we have been waiting for, to make impossible DApps possible. Yes! You guessed it, Phat Contract was born to build impossible decentralized apps. As we know, many use cases are limited to be built for Web3, however, Phat Contract can make many use cases a reality for Web3.

Here you can find an overview of several use cases we are expecting (and also working on):

Web3 Middleware

  • Building decentralized Oracles with one contract, e.g on-chain price feed, Twitter monitor, cross-chain data feed
  • Data attestation service for smart contracts
  • Security-enhanced RPC API
  • Indexer aggregator for e.g. The Graph, SubQuery
  • Workflow/automation / keeper / ifttt
  • Personal storage / secret store, e.g. personal tx/address tagging on a blockchain explorer

Web2 to Web3 middleware

  • Development of a Push notification service to social media, mobile apps, etc.
  • Account abstraction, e.g. decentralized OAuth
  • Decentralized PKI e.g. HTTPs certificate authority for ENS
  • Trusted IoT data processor

Retail tools from Web2 to Web3

  • Leveraging 2FA on a decentralized infrastructure
  • Enabling a decentralized password manager
  • Hosting for website front-ends

What use cases can you think about when learning about Phat Contract? We are excited to hear about them and see what you are building with our new product release.

About Phala

Phala Network is a decentralized cloud that offers secure and scalable computing for Web3.

With Phat Contracts, an innovative programming model enabling trustless off-chain computation, developers can create new Web3 use cases.

Get the latest Phala Content Straight To Your Inbox.