Get Started
Verify a Contract
Verifying your contract publishes the source code on the block explorer, allowing anyone to read, audit, and interact with it through the explorer UI. Verification builds trust and makes your contract accessible to the community.[!NOTE] Verification matches your compiled bytecode against the deployed bytecode.
The compiler version, optimization settings, and source code must match exactly.
Why Verify?
- Transparency — Users and auditors can review the actual code running on-chain.
- Explorer interaction — Enables the "Read Contract" and "Write Contract" tabs on the explorer.
- Credibility — Verified contracts signal professionalism and trustworthiness.
- Composability — Other developers can easily integrate with your contract.
Option A: Verify with Hardhat
Step 1 — Install the Verify Plugin
CodeBASH
Step 2 — Configure the Explorer
UpdateCodeHTML
CodeJAVASCRIPT
Step 3 — Run Verification
CodeBASH
CodeHTML
Option B: Verify with Foundry
CodeBASH
[!TIP] If you deployed viawithCodeHTMLflag, verification happens automatically:CodeHTMLCodeBASH
Option C: Verify via the Explorer UI
For manual verification without CLI tools:- Go to the Lightchain AI Testnet Explorer.
- Search for your contract address.
- Click the "Contract" tab, then "Verify & Publish".
- Select the verification method:
- Solidity (Single file) — For simple contracts with no imports.
- Solidity (Standard JSON Input) — For projects with dependencies and imports.
- Solidity (Flattened) — For flattened source files.
- Fill in the details:
- Compiler version (e.g., )CodeHTML
- Optimization (enabled/disabled and number of runs)
- Source code
- Constructor arguments (ABI-encoded)
- Compiler version (e.g.,
- Submit and wait for confirmation.
Flattening Your Contract
If using the flattened method, generate a single file:CodeBASH
Remove duplicate SPDX license identifiers from the flattened file before submitting.
Multiple // SPDX-License-Identifier lines will cause verification to fail.
Verify with Constructor Arguments
If your contract's constructor accepts arguments, you must provide them ABI-encoded during verification.Encode Constructor Arguments
CodeBASH
Confirming Verification
After successful verification:- Visit your contract on the explorer.
- The "Contract" tab will display a green checkmark.
- Two new interactive tabs will appear:
- Read Contract — Call view/pure functions directly.
- Write Contract — Connect your wallet and send transactions.
Your contract source code is now publicly verified and fully interactive on the explorer.
Troubleshooting
Next Steps
Your contract is now deployed, interactive, and verified. Explore more:- Testnet Overview — Review all available testnet resources.
- Testnet API & RPC Reference — Full RPC endpoint documentation.
Last updated: February 2026