Verify Your Contract
Contract Verification is an important piece of decentralized world, as we already talk about that on Unlocking the Importance and Nuances of Verified Smart Contract. This section will give you a glance of how to build verified Phat Contract and upload to Patron, then share it over the Internet.
Patron is a smart contract verification service offered by the Brushfam team. It features a command-line interface (CLI) tool that allows for seamless verification of smart contract builds with a single command. To learn more about how to get started with Patron, visit here.
You need additional installation for the patron cli tool:
cargo install patron --git https://github.com/brushfam/patron-backend
It might take a few minutes to finish. Once it is done, you need to call
patron authfor initialization. This step only requires you to sign an authentication message once at zero cost.
Connect wallet for Patron
After that, you will see a message said “Authentication completed” in the terminal. Congrats, that’s all you need on preparation!
You need create a
Deploy.tomlfile along side with your
cargo.toml. You will get similar results like the screenshot below:
Folder structure for Phat Contract with Patron
There are two lines in the
rustc_version = "1.69.0"
cargo_contract_version = "3.2.0"
The first line is
rust_version, it should match what you define in your
rust-toolchain.tomlfile. For now please set to
After setting up the
Deploy.tomlfile, you just perform the
patron buildin your terminal and wait for it to complete.
When you see a message like this in the terminal, you now have successfully created a verifiable build.
Message when your Phat Contract compiled successfully on Patron
You can get a link on Patron as well. Let’s open this link in browser, you will see the code hash, build log, also details of source code on screen. You can click the “Deploy with Phala”.
Example project on Patron
Clicking on the button, will navigate to the Phat Contract UI:
The landing page when you deploy Phat Contract via Patron
Because we can find the verified build on Patron via code hash, we don’t need update the artifact manually. You can just click “fetch”, “upload”, then the contract bytecode will upload to Phala Blockchain automatically.
The next step is to instantiate. Click “Instantiate”, and a signing request will pop up. Again, you will need to wait for a while until the success message appears.
You can follow the steps annotation on the screenshot.
Step guide of deploying Phat Contract
Click the “go next” button and you can interact with your Phat Contract instance now. You can see the “Verified by Patron” label beside the code hash.
Sceenshot of Phat Contract Deploy successfully
For more discussion about this topic, and you stuck into some issues, you can reach us on Discord.