Comment on page
Phat Contract Introduction
Phat Contracts are the programs running off-chain on Phala Network that developers can use to implement a broad range of features for their dApps.
On-chain computation has severe limitations and is often prohibitively expensive. For example, Smart Contracts cannot easily perform actions across different blockchains, nor can they interface directly with off-chain data sources hence the need for bridges and oracles. Furthermore, use cases like Smart Contract automation require input from programs running off-chain. For these reasons, robust dApp use cases generally demand that a significant portion of the stack be off-chain.
Given the stark technical constraints of building on-chain, it’s generally optimal to keep the on-chain contracts as small and compact as possible, and implement the more robust logic off-chain.
Phat Contracts are run on a tamper-proof distributed network that uses the Phala blockchain to always ensure the fidelity of deployed contracts and their execution. This allows Phat Contracts to circumvent the limitations of Smart Contracts while retaining trustlessness, verifiability, and permissionlessness.
Phat Contracts are not meant to replace Smart Contracts, instead, they are the missing decentralized computation unit for decentralized applications.
Users can build and deploy a Phat Contract in a few different ways depending on their needs and ability.
Phat Contract 2.0 allows developers to write scripts to deploy as a Phat Contract in TypeScript. This allows for your deployed script to respond to data requests initiated from the on-chain smart contract side. The request is transparently sent to your script for processing. You are free to call any APIs to fulfill the request. Finally, you can freely define the response data structure that will be replied to your smart contract.