Docs

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

Explore Now

Verified Smart Contracts: What They Are & Why They Matter.

2023-11-06

Smart contracts are the building blocks of any decentralized network. The importance of their reliability prompted the emergence of smart contract verification. With two variants - "source code verification" and "formal verification”. So why is verification so important, and how does it fit into our Phat Contract system? Let's dive in and explore.

Why is Smart Contract Verification Essential?

What are smart contracts? In the decentralized landscape, a smart contract serves as a trustworthy, transparent, and open agreement. However, the efficacy and reliability of these digital contracts are fundamentally dependent on robust verification mechanisms.

What is smart contract verification? In this context, verification is the rigorous testing and auditing of a smart contracts code to ensure it behaves as intended. This is how smart contract verification works and is crucial for mitigating risks and enhancing security. You can read more about potential malicious code injections here and about backdoors here.

According to a study by the BNB Chain developer blog, the total number of verified smart contracts continues to rise, even amidst negative market sentiment. This showcases their current and ever-increasing importance in strengthening system security and operational efficiency.

Source Code Verification: More than Meets the Eye

Source code verification is not the same as having open-source code. While open-source code is publicly accessible for review, 'verification' involves a rigorous process to test and ensure the code behaves as expected and is secure.

In regard to an EVM-based smart contract, verification implies that uniform Solidity code always results in the same compiled bytecode. However the difference between Phat Contract Verification and Solidity Smart Contract Verification becomes evident when we look at Phat Contract; here, the verification process is more intricate.

  1. Phat Contract is built on Rust and functions more like conventional software engineering. This allows for flexibility in organizing source code and building dependencies, extending beyond a simple "your-awesome-smart-contract.sol" file.
  1. Phat Contract has a unique capability of accessing the internet, fetching off-chain data, verifying it, and submitting it to any blockchain, including Ethereum, Polygon, or other L2 blockchains. Although extensive features make code verification somewhat demanding, they make Phat Contract a game changer.

Ink! Based Smart Contract Verification: The Journey so Far

Although Ink! is less utilized than Solidity and currently has a limited set of tools and infrastructure services, this is changing. Web3 Labs, endorsed by Ink!, is actively developing a verification service set for a public launch in the near future. Additionally, Patron is emerging as the go-to Ink!-based smart contract verification service, offering a developer-friendly method for verifying your Ink!-based smart contract.

Spotting a Verified Phat Contract: The Telltale Signs

Currently, we do not have a deep integration with any verification services. This isn't due to any shortcomings on our part, but rather because the field itself is rapidly evolving and yet to offer mature, standardized solutions. Specifically, in the context of the emerging Polkadot ecosystem, we find ourselves in largely unexplored territory.

As a proactive and temporary measure to meet your needs in the interim, we provide separate artifacts for each component of the Phala Blockchain and Phat Bricks. These artifacts are easily accessible and can be found here. They are designed to integrate seamlessly with our Phat Contract UI and are clearly labeled as 'Provided by Phala.'"

In collaboration with the Burshfam team, a “Deploy with Phala” button on the Patron site allows you to set up a similar verfied Phat Contract. Deploying these verified contracts is a breeze and can be achieved with just a few clicks. For those Phat Contracts with verified source codes and builds on Patron, we have marked them with a distinct label next to their code hash.

Join Our Journey: Phat Contract's Commitment

While the introduction of verifiable Phat Contracts—backed by Patron—might appear as a modest step, it actually signifies an important leap forward. We're not just adding a new feature, we're intensifying our dedication to creating a resilient and robust decentralized network. Your insights on these verified smart contracts are something we're particularly keen to hear. Please reach out to us on Discord or Twitter; we highly value your thoughts and ideas.

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.