Smart contracts come with limitations, especially with the metaverse. Does Phala Network’s design of off-chain contract execution make fat contracts the perfect complement of smart contracts? We look at both smart and fat contract applications.
Phala Network Industry Announcement
Smart blockchain contract limitations
Smart contracts are applications deployed on the blockchain and executed by miners. Compared with today’s internet applications, the most distinguishing characteristic of the smart contract is the irreversibility of its execution. Since all historical input is stored and witnessed on the blockchain
execution results are therefore immutable. This makes smart contracts the perfect choice for implementing financial crypto tokens or NFTs (non-fungible tokens).Smart contracts do have limitations, however
and with the metaverse, such limitations are becoming increasingly clear. The metaverse introduces complicated computation tasks like game server logic and rendering beyond only account balance and NFT ownership management. For now, although your in-game token or characters can be stored on the blockchain, the decentralized world itself is still backed by centralized servers.Fat contracts off-chain execution capabilities
Fat contracts conversely behave like traditional internet applications. Along with the decentralized and trustless nature of blockchain technology and support for real-time compute-intensive tasks, fat contracts add access to all services, even if they are not operating on a blockchain. Such capabilities come from Phala Network’s design of off-chain contract execution and make fat contracts the perfect complement of smart contracts.
Smart contract issues not solved by chain updating
Before we dig into the reason why existing smart contracts cannot support complicated computation, I would first introduce a counter-intuitive fact about smart contract execution, and how they ensure the correctness of the execution results.
The fact is that there is no promise that the execution results will be provided by a single miner. A miner is able to maliciously provide false results
like making one plus one equal to one. The current solution to this problem (adapted by almost all existing blockchains) is simple they make all the input data and execution results public so that any miner can verify the execution. Only if there are more benign miners than malicious ones can they ‘vote’ and get the correct result.Such a trivial solution leads to the blockchain’s shortcomings
low performance and no privacy, brought about by the simple publish-and-verify design. Moreover, leaving all the computation to the on-chain miners can further limit the functionalities of the contracts.Any time-consuming tasks cannot be delivered since they can block the executors (i.e., miners) and further throttle the whole chain
and any urgent tasks cannot be delivered before they are confirmed by multiple blocks after seconds. It is worth noting that such problems cannot be solved with optimizations since they are rooted in the core design of the existing chains.Are fat contracts the perfect complement?
Fat contract features
low latency, high-performance, privacy and freedom to re-use existing services.Compute-intensive tasks
y moving the execution of fat contracts to the off-chain secure workers backed by TEE (trusted execution environment), a fat contract can fully utilize the computing power of a single worker (such as a four-core CPU) or even multiple workers. This makes it capable of carrying out compute-intensive tasks.For example, we have successfully run an unmodified version of the open-source renderer Blender in a Phala worker node to produce a GIF for an NFT. This process can be sped up by assigning the task to multiple workers.
Fat contracts can also run with Python machine learning libraries (numpy, scipy, PyTorch, etc.) to train DNNs (deep neural networks) and enable privacy for training data and models.
The first machine learning model trained using a fat contract.
Fat contracts achieve low-latency computation
Low-latency real-time computation
he response time for metaverse and game interaction should not exceed one second. However, traditional blockchain smart contracts cannot meet the requirement of low-latency services because they are executed at block intervals. By enabling direct access to our workers, fat contracts can achieve millisecond-level read responses, making it a perfect choice to deploy metaverse and game services.Phala Network blockchain solution
Phala World is a metaverse based on the Phala Network blockchain and is one of the best application cases. Only fat contracts have the ability to solve storage and high-speed processing of massive data, connect AR and distributed storage solutions, provide low-latency responses for user requests and truly realize the vision of the web 3.0 metaverse.
Bridging smart contracts and web 2.0 services. Phala believes web 3.0 should be an open and free world, and there is no reason to close its door to all the existing web 2.0 infrastructures. Fat contracts allow access to off-chain internet services by safely delegating complicated asynchronous requests for fat contracts.
In our hackathon, we presented a demo bot of BTC price action. An HTTP request query for BTC prices was sent from an existing web service and then reported to a Telegram account through the corresponding HTTP API. All these operations are achieved within 100 LoC in the fat contract. Leveraging the Phala bridge, such abilities can be used by all the existing smart contracts.
Follow our tutorial to deploy your own testnet and try the first fat contract. The incoming Phala testnet will enable contract support and easier deployment.
About Phala
Phala Network tackles the issue of trust in the computation clouds. By organizing a decentralized network of computation nodes around the world, it offers high-performance services without relying on any cloud vendor. Phala’s workers run their programs in ‘secure enclaves,’ a privacy technology already embedded into modern processors, which enables versatile and confidential execution. Together, Phala creates the infrastructure for a powerful, secure and scalable trustless computing cloud.
This is a press release. Readers should do their own due diligence before taking any actions related to the promoted company or any of its affiliates or services. Enjinwire.com is not responsible, directly or indirectly, for any damage or loss caused or alleged to be caused by or in connection with the use of or reliance on any content, goods or services mentioned in the press release.