Why Fat Contracts Are the Perfect Complement to Smart Contracts


Smart contracts limit the metaverse – fat contracts enable it

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 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 limitations 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.

Why fat contract is the perfect complement

Fat contract features – low latency, high-performance, privacy and freedom to re-use existing services.

Compute-intensive tasks – by 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.

Low-latency real-time computation – the 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 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 content is sponsored and should be regarded as promotional material. Opinions and statements expressed herein are those of the author and do not reflect the opinions of The Daily Hodl. The Daily Hodl is not a subsidiary of or owned by any ICOs, blockchain startups or companies that advertise on our platform. Investors should do their due diligence before making any high-risk investments in any ICOs, blockchain startups or cryptocurrencies. Please be advised that your investments are at your own risk, and any losses you may incur are your responsibility.

Follow Us on Twitter Facebook Telegram

Check out the Latest Industry Announcements
 

 

Source: https://dailyhodl.com/2022/02/15/why-fat-contracts-are-the-perfect-complement-to-smart-contracts/