Acton
Tutorial

Contract verification

Learn how to verify your smart contract source code

Source code verification is a critical step in the smart contract development lifecycle. It establishes trust by proving that the bytecode deployed to the blockchain exactly matches your published source code.

Acton simplifies this process with a built-in verify command that integrates directly with the TON Verifier service.

Why verify?

When you deploy a contract, only the compiled bytecode is stored on the blockchain. Users interacting with your contract cannot inherently see the logic behind it. Verification bridges this gap by:

  1. Publishing source code: Making your Tolk code publicly available.
  2. Proving correspondence: Cryptographically proving that this code compiles to the exact bytecode at a specific address.
  3. Enhancing trust: Allowing users to audit the logic before sending funds or interacting.

How it works

The acton verify command automates the entire verification workflow:

  1. Compilation: It compiles your local source code to ensure it matches the current state.
  2. Preparation: It prepares the local compilation artifacts and compiler version for the verification backend.
  3. Submission: It uploads your source files and metadata to the verification backend.
  4. Transaction: It sends a specialized transaction to the verifier registry to finalize the proof.

Prerequisites

Before verifying, ensure that:

  1. Contract is defined: The contract must be defined in your Acton.toml file.
  2. Contract is deployed: The contract must already exist on the blockchain (testnet or mainnet).
  3. Wallet is configured: You need a configured wallet with a small amount of TON (~0.5 TON recommended, 0.1 TON is the fee) to send the verification transaction. See Setting up wallets.

Verifying a contract

To verify a contract, use the acton verify command followed by the contract name and its deployed address.

acton verify MyContract --address EQDt7LL...

By default, this attempts to verify on testnet.

Verifying on Mainnet

To verify a contract on the mainnet, add the --net mainnet flag:

acton verify MyContract --address EQDt7LL... --net mainnet

Specifying a Wallet

If you have multiple wallets configured, you can specify which one to use for the transaction:

acton verify MyContract --address EQDt7LL... --wallet deployer

Viewing results

Once the command completes successfully, it will output a link to the verified contract page.

āœ“ Contract verification completed!
View at: https://verifier.ton.org/EQBUSJ...

You can share this link with your users to prove the authenticity of your contract.

Troubleshooting

  • Hash Mismatch: If the command reports a hash mismatch, it means your local source code compiles to different bytecode than what is on-chain. Ensure you are on the exact commit used for deployment and that you are using the same compiler version.
  • Compiler Version: If you deployed using a specific version of the Tolk compiler, you can specify it with --compiler-version:
    acton verify MyContract --address ... --compiler-version 1.2.0
  • Backend Debugging: To inspect backend selection and uploaded sources, rerun with ACTON_VERIFY_DEBUG=1. You can override the source-upload backend with ACTON_VERIFY_BACKEND=http://... and the signer backend list with ACTON_VERIFY_BACKENDS=http://...,http://....

Learn more

For a complete list of options and advanced configuration, see the Verify Command Reference.

Last updated on

On this page