From 8c2a2034db882c5318065014881e147475c3e7cc Mon Sep 17 00:00:00 2001 From: ivegabr Date: Fri, 13 Mar 2026 14:57:09 +0100 Subject: [PATCH 01/11] update foundry verification --- .../rootstock-explorer.md | 169 ++++++++++-------- 1 file changed, 92 insertions(+), 77 deletions(-) diff --git a/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md b/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md index 8cd5ade5..eac14095 100644 --- a/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md +++ b/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md @@ -8,7 +8,7 @@ tags: [Explorer, tutorial, developers, quick starts, rsk, rootstock] Contract verification is essential in the Rootstock ecosystem. It allows Rootstock Explorer users to inspect and validate the source code of deployed smart contracts. -The Rootstock Explorer provides a transparent view of the Rootstock blockchain, showing transactions, blocks, and deployed contracts. This transparency, enabled by verification, builds trust and understanding in decentralized applications. +The Rootstock Explorer provides a transparent view of the Rootstock blockchain, showing transactions, blocks, and deployed contracts. This transparency, enabled by verification, builds trust and understanding in decentralized applications. :::tip[Tip] See [Rootstock Explorer guides](/dev-tools/explorers/rootstock-explorer/) to navigate the explorer and submit dApps. @@ -18,7 +18,7 @@ See [Rootstock Explorer guides](/dev-tools/explorers/rootstock-explorer/) to nav - **Builds trust**: - Verification allows anyone to see the source code of a deployed smart contract, which fosters trust with users and the community. -- **Increases transparency**: +- **Increases transparency**: - Users can audit the code to confirm it performs the actions it claims to, providing confidence in the contract's operations. - **Aids in security**: - By making the code public, it can be reviewed for vulnerabilities, though users should still conduct their own security assessments. @@ -28,10 +28,11 @@ See [Rootstock Explorer guides](/dev-tools/explorers/rootstock-explorer/) to nav - Verification allows users to interact with the contract on the Rootstock Explorer. - **Confirms code integrity**: - The verification process proves that the bytecode on the blockchain was generated from a specific, known source code, ensuring the contract hasn't been tampered with. -- **Helps with compliance**: +- **Helps with compliance**: - Verification is essential for meeting certain compliance and regulatory requirements. ## What does verification do?: + - Adds a Verified badge to the contract page, confirming that the published source code matches the deployed bytecode. - Enables human-readable interaction with the contract — allowing users to view and call its functions directly. - Allows downloading the contract's Application Binary Interface (ABI). @@ -46,7 +47,6 @@ See [Rootstock Explorer guides](/dev-tools/explorers/rootstock-explorer/) to nav - Constructor parameters (if applicable). - Library addresses (if used). - > In summary, this guide will help you verify your smart contract, allowing you to leverage these benefits and contribute to a more transparent and trustworthy decentralized environment on Rootstock. ## Getting Started @@ -64,18 +64,19 @@ See [Rootstock Explorer guides](/dev-tools/explorers/rootstock-explorer/) to nav Rootstock Explorer offers 5 main methods for contract verification: ### 1. **Single File** + The Solidity (**Single File**) method is intended for verifying contracts that exist entirely within a single `.sol` file, or where the developer has already flattened all imports into one file. This method recompiles the provided contract and compares the resulting bytecode to the deployed contract on Rootstock. Follow the steps below to successfully complete the verification process. - Select Solidity **(Single File)** Method: -![single](/img/developers/smart-contracts/rsk-explorer/single.png) + ![single](/img/developers/smart-contracts/rsk-explorer/single.png) - **Solc Version**: Choose the Solc version you used to compile your contract. -![version](/img/developers/smart-contracts/rsk-explorer/solc-version.png) + ![version](/img/developers/smart-contracts/rsk-explorer/solc-version.png) - **EVM Version**: Choose the appropriate EVM version. -![evm](/img/developers/smart-contracts/rsk-explorer/evm.png) + ![evm](/img/developers/smart-contracts/rsk-explorer/evm.png) - **Optimization**: `Runs` tells the Solidity optimizer how many times your contract will be executed. You must use the same runs value in verification that you used when compiling. - If you used optimization run when compiling/deploying, enable it during verification and set the same runs (default 200). @@ -84,38 +85,39 @@ Follow the steps below to successfully complete the verification process. ![runs](/img/developers/smart-contracts/rsk-explorer/runs.png) - **Contract Name**: Enter the exact name of the contract you deployed. This is required so the verifier can match the correct bytecode. -![name](/img/developers/smart-contracts/rsk-explorer/contract-name.png) + ![name](/img/developers/smart-contracts/rsk-explorer/contract-name.png) - **Paste/Upload source code**: Provide the full Solidity source file. You may choose between: - - **Paste code**: Paste the raw contract source code into the field. This must be the exact source used during deployment. -![code](/img/developers/smart-contracts/rsk-explorer/code.png) + ![code](/img/developers/smart-contracts/rsk-explorer/code.png) - **Upload file**: Upload a `.sol` file directly from your computer. -![sol](/img/developers/smart-contracts/rsk-explorer/sol.png) + ![sol](/img/developers/smart-contracts/rsk-explorer/sol.png) - **Constructor Arguments**: You must enter constructor arguments separate by comma if you have more than one. + - Suppose your Solidity constructor looks like this: - - Suppose your Solidity constructor looks like this: ```bash constructor(address owner, uint256 maxSupply) ``` + - To verify the contract, enter the arguments like this: + ```bash 0xACa52b1Ab7dA04532127d22D47Dc3d34CFe0Cd5e,1000 ``` + Example: ![args](/img/developers/smart-contracts/rsk-explorer/args.png) - - If you already have them in ABI-encoded format, enable the “ABI encoded” checkbox and paste the encoded string instead. ![encoded](/img/developers/smart-contracts/rsk-explorer/encoded.png) - How to encode arguments: - - ABI-ENCODING with Ethers.js + ```bash import { AbiCoder } from "ethers"; @@ -126,16 +128,18 @@ Follow the steps below to successfully complete the verification process. ["0xaca52b1ab7da04532127d22d47dc3d34cfe0cd5e","1000"] ); - console.log(encoded); + console.log(encoded); ``` Result: + ```bash 0x000000000000000000000000aca52b1ab7da04532127d22d47dc3d34cfe0cd5e00000000000000000000000000000000000000000000000000000000000003e8 ``` + - ABI-ENCODING from Remix: - - Open remix - Console - - Paste + - Open remix - Console + - Paste ```bash web3.eth.abi.encodeParameters( @@ -143,7 +147,9 @@ Follow the steps below to successfully complete the verification process. ["0xaca52b1ab7da04532127d22d47dc3d34cfe0cd5e", "1000"] ) ``` + Result: + ```bash 0x000000000000000000000000aca52b1ab7da04532127d22d47dc3d34cfe0cd5e00000000000000000000000000000000000000000000000000000000000003e8 ``` @@ -159,6 +165,7 @@ Follow the steps below to successfully complete the verification process. ![lib](/img/developers/smart-contracts/rsk-explorer/lib.png) ### **2. Multiple Files** + The Solidity (**Multiple Files**) method is designed for more complex contracts that use imports, have multiple `.sol` files, or cannot be flattened safely. This method allows you to upload all your Solidity source files exactly as they exist in your project. Only the parts that differ from **Single File** are described below. @@ -166,58 +173,60 @@ Only the parts that differ from **Single File** are described below. - **Sources Files**: Upload all Solidity files required to compile your contract, preserving the original folder structure. You can: - - Drag and drop multiple .sol files. - - Upload an entire folder containing your contracts. - - Combine both approaches if needed. + +- Drag and drop multiple .sol files. +- Upload an entire folder containing your contracts. +- Combine both approaches if needed. Important rules: - - Every imported file must be included. - - Filenames must match exactly (case-sensitive). - - Folder structure should reflect your project layout. - - Do not flatten the files — this method expects multi-file compilation. + +- Every imported file must be included. +- Filenames must match exactly (case-sensitive). +- Folder structure should reflect your project layout. +- Do not flatten the files — this method expects multi-file compilation. During verification, the explorer will reconstruct the compilation environment using the files you provide. ![multiple](/img/developers/smart-contracts/rsk-explorer/multiple.png) - **Other Settings**: -All other fields (compiler version, EVM version, optimization, contract name, constructor arguments, libraries.) work exactly the same as described in the **Single File** Verification section. + All other fields (compiler version, EVM version, optimization, contract name, constructor arguments, libraries.) work exactly the same as described in the **Single File** Verification section. + +### 3. **Standard JSON input** -### 3. **JSON Standard** The **Standard JSON** Input method is the most reliable and exact verification approach. It reproduces the full Solidity compiler configuration used during deployment by providing a complete standard-json object, exactly as consumed by solc --standard-json. This method is strongly recommended for: - - Projects compiled with Hardhat, Foundry, Truffle, or custom build scripts. - - Contracts with complex dependency structures. - - Projects where preserving metadata (AST, settings, compiler options) is essential. - - Ensuring a byte-for-byte deterministic match with the deployed bytecode. -The Solidity (**Multiple Files**) method is designed for more complex contracts that use imports, have multiple `.sol` files, or cannot be flattened safely. This method allows you to upload all your Solidity source files exactly as they exist in your project. +- Projects compiled with Hardhat, Foundry, Truffle, or custom build scripts. +- Contracts with complex dependency structures. +- Projects where preserving metadata (AST, settings, compiler options) is essential. +- Ensuring a byte-for-byte deterministic match with the deployed bytecode. -How to Generate Standard JSON Input: +![json](/img/developers/smart-contracts/rsk-explorer/json.png) + +- **Other Settings**: All other fields (compiler version, optimization, contract name, constructor arguments, libraries.) work exactly the same as described in the **Single File** Verification section. + +**How to Generate Standard JSON Input** **Hardhat**: + ``` npx hardhat compile --show-stack-traces ``` -> Then locate the standard-json file inside Hardhat’s internal `artifacts/build-info/*.json`. -**Foundry**: -``` -forge build --extra-output-files solc-input -``` -> Foundry will export solc-input.json into `out/`. +Then locate the standard-json file inside Hardhat's internal `artifacts/build-info/*.json`. - How to Extract the Standard JSON Input: - After generating the file (from Hardhat or Foundry): - - Open the JSON file that was produced. - - Inside it, locate the field named "input". - - Copy everything inside the input object — this is the actual Standard JSON Input expected by the verifier. - - Paste it into a new file, and save it using the contract's name. - - Your file should look similar to the following structure: + After generating the file from Hardhat: + - Open the JSON file that was produced. + - Inside it, locate the field named "input". + - Copy everything inside the input object. This is the actual Standard JSON Input expected by the verifier. + - Paste it into a new file, and save it using the contract's name. + - Your file should look similar to the following structure: -```bash +```json { "language": "Solidity", "sources": { @@ -238,9 +247,7 @@ forge build --extra-output-files solc-input }, "outputSelection": { "*": { - "": [ - "ast" - ], + "": ["ast"], "*": [ "abi", "metadata", @@ -262,24 +269,26 @@ forge build --extra-output-files solc-input } ``` -**Standard JSON Input File (*.json)** +**Foundry**: -Upload a single .json file containing the full Standard JSON Input object used to compile your contract. +``` +forge verify-contract \ + --chain-id 31 \ + --watch \ + --compiler-version v0.8.28 \ + --show-standard-json-input \ + \ + : \ + .json +``` -This file typically includes: - - language - - sources (all .sol files embedded with their contents) - - settings such as: - - optimizer configuration - - remappings - - metadata settings - - output selection - - evmVersion - - libraries (if linked during compilation) +Replace: -![json](/img/developers/smart-contracts/rsk-explorer/json.png) +- `` → the deployed contract address. +- `` → path to the Solidity file inside your project. +- `` → name of the contract inside that file. -- **Other Settings**: All other fields (compiler version, optimization, contract name, constructor arguments, libraries.) work exactly the same as described in the **Single File** Verification section. +> Foundry will export the Standard JSON input file to the same directory, which can uploaded as it is to the Rootstock Explorer verification tool. ### 4. **Hardhat Verification** @@ -290,10 +299,11 @@ Select Hardhat as your verification method to verify contracts directly from you Copy the configuration snippet into your `hardhat.config.ts` file. This snippet includes: - - The Hardhat Verify plugin - - Rootstock Testnet/Mainnet RPC URLs - - Chain IDs - - Account setup for signing requests + +- The Hardhat Verify plugin +- Rootstock Testnet/Mainnet RPC URLs +- Chain IDs +- Account setup for signing requests Make sure your `PRIVATE_KEY` is defined in your `.env` file. @@ -305,16 +315,18 @@ npx hardhat verify \ \ [constructor-args] ``` + Replace: - - `` with your deployed contract address - - `[constructor-args]` with constructor parameters (if any) + +- `` with your deployed contract address +- `[constructor-args]` with constructor parameters (if any) > Once it completes successfully, your contract will be verified on the Rootstock Explorer. To see a detailed explanation on how to verify contracts using Hardhat, visit [here](https://dev.rootstock.io/developers/smart-contracts/verify-smart-contracts/hardhat-verify-plugin/) - ### 5. **Foundry Verification** + Select **Foundry** as your verification method to verify contracts using the forge verify-contract command. This method integrates Foundry directly with the Rootstock Explorer’s verification API, allowing you to verify a deployed contract from your local environment. @@ -327,20 +339,23 @@ forge verify-contract \ --watch \ --compiler-version v0.8.24 \ --verifier custom \ - --verifier-url https://explorer-testnet-api-v3.plattie-qa.iovlabs.net/api/v3/etherscan \ + --verifier-url https://be.explorer.testnet.rootstock.io/api/v3/etherscan \ \ : ``` + Replace: - - `` → the deployed contract address. - - `` → path to the Solidity file inside your project. - - `` → name of the contract inside that file. - + +- `` → the deployed contract address. +- `` → path to the Solidity file inside your project. +- `` → name of the contract inside that file. + Once the command finishes, your contract will appear as Verified on the Rootstock Explorer. To see a detailed explanation on how to verify contracts using Foundry, visit [here](https://dev.rootstock.io/developers/smart-contracts/foundry/verify-smart-contracts/) ## Submit and Validate + Once you have entered all the details, click "Verify Contract". - **Expected statuses**: The verification status will change from "Pending" to "Success" or "Failure". @@ -357,10 +372,9 @@ Once you have entered all the details, click "Verify Contract". d. Contract read and write panels will be available. - **Read Methods**: - ![contract-interaction](/img/developers/smart-contracts/rsk-explorer/contract-interaction.png) + ![contract-interaction](/img/developers/smart-contracts/rsk-explorer/contract-interaction.png) - **Write Methods**: - ![write](/img/developers/smart-contracts/rsk-explorer/write.png) - + ![write](/img/developers/smart-contracts/rsk-explorer/write.png) ## Troubleshooting @@ -411,4 +425,5 @@ Once you have entered all the details, click "Verify Contract". > 💡 **Tip:** If verification keeps failing, try matching the compiler settings directly from your Hardhat or Foundry build artifacts. ## Resources + - Verify smart contracts using [Blockscout](foundry-blockscout.md) or [Hardhat Plugin](hardhat-verify-plugin.md) From 62eb7f66c76fa0b415a54423ba4f4c20f150d78d Mon Sep 17 00:00:00 2001 From: Isidro Vega Bresciano <126865465+ivegabr@users.noreply.github.com> Date: Fri, 13 Mar 2026 15:04:27 +0100 Subject: [PATCH 02/11] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .../04-verify-smart-contracts/rootstock-explorer.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md b/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md index eac14095..2a36c958 100644 --- a/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md +++ b/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md @@ -279,7 +279,7 @@ forge verify-contract \ --show-standard-json-input \ \ : \ - .json + > .json ``` Replace: @@ -288,7 +288,7 @@ Replace: - `` → path to the Solidity file inside your project. - `` → name of the contract inside that file. -> Foundry will export the Standard JSON input file to the same directory, which can uploaded as it is to the Rootstock Explorer verification tool. +> The `> .json` at the end of the command redirects the Standard JSON input output into a file in the current directory, which can then be uploaded as-is to the Rootstock Explorer verification tool. ### 4. **Hardhat Verification** From 182d03a835668474ccbdd3e6ee73d63c20aa918e Mon Sep 17 00:00:00 2001 From: Isidro Vega Bresciano <126865465+ivegabr@users.noreply.github.com> Date: Fri, 13 Mar 2026 15:05:30 +0100 Subject: [PATCH 03/11] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .../04-verify-smart-contracts/rootstock-explorer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md b/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md index 2a36c958..c502d72d 100644 --- a/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md +++ b/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md @@ -337,7 +337,7 @@ Run the verification command in the terminal: forge verify-contract \ --chain-id 31 \ --watch \ - --compiler-version v0.8.24 \ + --compiler-version v0.8.28 \ --verifier custom \ --verifier-url https://be.explorer.testnet.rootstock.io/api/v3/etherscan \ \ From 2af213c089012d96eaaccc1e6f216ae8baebc221 Mon Sep 17 00:00:00 2001 From: Isidro Vega Bresciano <126865465+ivegabr@users.noreply.github.com> Date: Fri, 13 Mar 2026 15:05:55 +0100 Subject: [PATCH 04/11] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .../04-verify-smart-contracts/rootstock-explorer.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md b/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md index c502d72d..8a35998b 100644 --- a/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md +++ b/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md @@ -118,7 +118,7 @@ Follow the steps below to successfully complete the verification process. - How to encode arguments: - ABI-ENCODING with Ethers.js - ```bash + ```ts import { AbiCoder } from "ethers"; const coder = AbiCoder.defaultAbiCoder(); @@ -141,7 +141,7 @@ Follow the steps below to successfully complete the verification process. - Open remix - Console - Paste - ```bash + ```js web3.eth.abi.encodeParameters( ["address", "uint256"], ["0xaca52b1ab7da04532127d22d47dc3d34cfe0cd5e", "1000"] From bbd09249bf01288136385fa96c24e68879674012 Mon Sep 17 00:00:00 2001 From: Isidro Vega Bresciano <126865465+ivegabr@users.noreply.github.com> Date: Fri, 13 Mar 2026 15:06:12 +0100 Subject: [PATCH 05/11] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .../04-verify-smart-contracts/rootstock-explorer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md b/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md index 8a35998b..3dca9fca 100644 --- a/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md +++ b/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md @@ -96,7 +96,7 @@ Follow the steps below to successfully complete the verification process. - **Upload file**: Upload a `.sol` file directly from your computer. ![sol](/img/developers/smart-contracts/rsk-explorer/sol.png) -- **Constructor Arguments**: You must enter constructor arguments separate by comma if you have more than one. +- **Constructor Arguments**: You must enter constructor arguments separated by commas if you have more than one. - Suppose your Solidity constructor looks like this: ```bash From 0c0cff1a6f6946d45ebbb63d70ba14b7ab96377d Mon Sep 17 00:00:00 2001 From: Isidro Vega Bresciano <126865465+ivegabr@users.noreply.github.com> Date: Fri, 13 Mar 2026 15:08:21 +0100 Subject: [PATCH 06/11] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .../04-verify-smart-contracts/rootstock-explorer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md b/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md index 3dca9fca..cf7e203b 100644 --- a/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md +++ b/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md @@ -194,7 +194,7 @@ During verification, the explorer will reconstruct the compilation environment u ### 3. **Standard JSON input** -The **Standard JSON** Input method is the most reliable and exact verification approach. It reproduces the full Solidity compiler configuration used during deployment by providing a complete standard-json object, exactly as consumed by solc --standard-json. +The **Standard JSON** Input method is the most reliable and exact verification approach. It reproduces the full Solidity compiler configuration used during deployment by providing a complete standard-json object, exactly as consumed by `solc --standard-json`. This method is strongly recommended for: From abd49d17048d43841b67bcbbf60032d203dcaa76 Mon Sep 17 00:00:00 2001 From: Isidro Vega Bresciano <126865465+ivegabr@users.noreply.github.com> Date: Fri, 13 Mar 2026 15:08:37 +0100 Subject: [PATCH 07/11] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .../04-verify-smart-contracts/rootstock-explorer.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md b/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md index cf7e203b..75bb9822 100644 --- a/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md +++ b/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md @@ -138,8 +138,8 @@ Follow the steps below to successfully complete the verification process. ``` - ABI-ENCODING from Remix: - - Open remix - Console - - Paste + - Open the Remix console + - Paste the following into the console: ```js web3.eth.abi.encodeParameters( From 9cae6132f840a69bc581d27a39695731c7cd4ac3 Mon Sep 17 00:00:00 2001 From: Isidro Vega Bresciano <126865465+ivegabr@users.noreply.github.com> Date: Fri, 13 Mar 2026 15:10:58 +0100 Subject: [PATCH 08/11] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .../04-verify-smart-contracts/rootstock-explorer.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md b/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md index 75bb9822..49d676b2 100644 --- a/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md +++ b/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md @@ -275,7 +275,7 @@ Then locate the standard-json file inside Hardhat's internal `artifacts/build-in forge verify-contract \ --chain-id 31 \ --watch \ - --compiler-version v0.8.28 \ + --compiler-version \ --show-standard-json-input \ \ : \ @@ -287,6 +287,7 @@ Replace: - `` → the deployed contract address. - `` → path to the Solidity file inside your project. - `` → name of the contract inside that file. +- `` → the Solidity compiler version used to compile and deploy the contract (for example, `v0.8.28`). > The `> .json` at the end of the command redirects the Standard JSON input output into a file in the current directory, which can then be uploaded as-is to the Rootstock Explorer verification tool. From fae40f25d5bce18756f151b0137f9258b17ca1dd Mon Sep 17 00:00:00 2001 From: Isidro Vega Bresciano <126865465+ivegabr@users.noreply.github.com> Date: Fri, 13 Mar 2026 15:13:03 +0100 Subject: [PATCH 09/11] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .../04-verify-smart-contracts/rootstock-explorer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md b/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md index 49d676b2..829d3325 100644 --- a/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md +++ b/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md @@ -170,7 +170,7 @@ The Solidity (**Multiple Files**) method is designed for more complex contracts Only the parts that differ from **Single File** are described below. -- **Sources Files**: Upload all Solidity files required to compile your contract, preserving the original folder structure. +- **Source Files**: Upload all Solidity files required to compile your contract, preserving the original folder structure. You can: From f5d5706bb10f8b630be5e5120e668c0b081715da Mon Sep 17 00:00:00 2001 From: Isidro Vega Bresciano <126865465+ivegabr@users.noreply.github.com> Date: Fri, 13 Mar 2026 15:14:38 +0100 Subject: [PATCH 10/11] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .../04-verify-smart-contracts/rootstock-explorer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md b/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md index 829d3325..2edcd83e 100644 --- a/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md +++ b/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md @@ -215,7 +215,7 @@ This method is strongly recommended for: npx hardhat compile --show-stack-traces ``` -Then locate the standard-json file inside Hardhat's internal `artifacts/build-info/*.json`. +Then locate the Hardhat build-info file under `artifacts/build-info/*.json`; this file contains the Standard JSON compiler input in its `input` field. - How to Extract the Standard JSON Input: From a30ee319aa1b03ca9bb1a60e6da40ac89f14fc1c Mon Sep 17 00:00:00 2001 From: ivegabr Date: Fri, 13 Mar 2026 16:25:03 +0100 Subject: [PATCH 11/11] improvements --- .../rootstock-explorer.md | 63 +++++++++++-------- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md b/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md index 2edcd83e..f69429df 100644 --- a/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md +++ b/docs/02-developers/05-smart-contracts/04-verify-smart-contracts/rootstock-explorer.md @@ -31,10 +31,10 @@ See [Rootstock Explorer guides](/dev-tools/explorers/rootstock-explorer/) to nav - **Helps with compliance**: - Verification is essential for meeting certain compliance and regulatory requirements. -## What does verification do?: +## What does verification do? - Adds a Verified badge to the contract page, confirming that the published source code matches the deployed bytecode. -- Enables human-readable interaction with the contract — allowing users to view and call its functions directly. +- Enables human-readable interaction with the contract. It allows users to view and call its functions directly. - Allows downloading the contract's Application Binary Interface (ABI). ## Prerequisites @@ -47,8 +47,6 @@ See [Rootstock Explorer guides](/dev-tools/explorers/rootstock-explorer/) to nav - Constructor parameters (if applicable). - Library addresses (if used). -> In summary, this guide will help you verify your smart contract, allowing you to leverage these benefits and contribute to a more transparent and trustworthy decentralized environment on Rootstock. - ## Getting Started - To start the verification process, visit the [Rootstock Explorer Testnet](https://explorer.testnet.rootstock.io/) or [Rootstock Explorer Mainnet](https://explorer.rootstock.io/), and find your contract using the search field. @@ -63,7 +61,7 @@ See [Rootstock Explorer guides](/dev-tools/explorers/rootstock-explorer/) to nav Rootstock Explorer offers 5 main methods for contract verification: -### 1. **Single File** +### 1. Single File The Solidity (**Single File**) method is intended for verifying contracts that exist entirely within a single `.sol` file, or where the developer has already flattened all imports into one file. This method recompiles the provided contract and compares the resulting bytecode to the deployed contract on Rootstock. @@ -80,7 +78,7 @@ Follow the steps below to successfully complete the verification process. - **Optimization**: `Runs` tells the Solidity optimizer how many times your contract will be executed. You must use the same runs value in verification that you used when compiling. - If you used optimization run when compiling/deploying, enable it during verification and set the same runs (default 200). - - If you didn’t use optimization, leave it disabled and don’t enter any runs. + - If you didn't use optimization, leave it disabled and don't enter any runs. ![runs](/img/developers/smart-contracts/rsk-explorer/runs.png) @@ -99,19 +97,19 @@ Follow the steps below to successfully complete the verification process. - **Constructor Arguments**: You must enter constructor arguments separated by commas if you have more than one. - Suppose your Solidity constructor looks like this: - ```bash + ```solidity constructor(address owner, uint256 maxSupply) ``` - To verify the contract, enter the arguments like this: - ```bash + ```text 0xACa52b1Ab7dA04532127d22D47Dc3d34CFe0Cd5e,1000 ``` Example: ![args](/img/developers/smart-contracts/rsk-explorer/args.png) - - If you already have them in ABI-encoded format, enable the “ABI encoded” checkbox and paste the encoded string instead. + - If you already have them in ABI-encoded format, enable the "ABI encoded" checkbox and paste the encoded string instead. ![encoded](/img/developers/smart-contracts/rsk-explorer/encoded.png) @@ -125,7 +123,7 @@ Follow the steps below to successfully complete the verification process. const encoded = coder.encode( ["address", "uint256"], - ["0xaca52b1ab7da04532127d22d47dc3d34cfe0cd5e","1000"] + ["0xaca52b1ab7da04532127d22d47dc3d34cfe0cd5e", "1000"], ); console.log(encoded); @@ -133,7 +131,7 @@ Follow the steps below to successfully complete the verification process. Result: - ```bash + ```text 0x000000000000000000000000aca52b1ab7da04532127d22d47dc3d34cfe0cd5e00000000000000000000000000000000000000000000000000000000000003e8 ``` @@ -144,13 +142,26 @@ Follow the steps below to successfully complete the verification process. ```js web3.eth.abi.encodeParameters( ["address", "uint256"], - ["0xaca52b1ab7da04532127d22d47dc3d34cfe0cd5e", "1000"] - ) + ["0xaca52b1ab7da04532127d22d47dc3d34cfe0cd5e", "1000"], + ); ``` Result: + ```text + 0x000000000000000000000000aca52b1ab7da04532127d22d47dc3d34cfe0cd5e00000000000000000000000000000000000000000000000000000000000003e8 + ``` + + - ABI-ENCODING with Foundry (cast): + ```bash + cast abi-encode "constructor(address,uint256)" \ + 0xaca52b1ab7da04532127d22d47dc3d34cfe0cd5e 1000 + ``` + + Result: + + ```text 0x000000000000000000000000aca52b1ab7da04532127d22d47dc3d34cfe0cd5e00000000000000000000000000000000000000000000000000000000000003e8 ``` @@ -164,7 +175,7 @@ Follow the steps below to successfully complete the verification process. ![lib](/img/developers/smart-contracts/rsk-explorer/lib.png) -### **2. Multiple Files** +### 2. Multiple Files The Solidity (**Multiple Files**) method is designed for more complex contracts that use imports, have multiple `.sol` files, or cannot be flattened safely. This method allows you to upload all your Solidity source files exactly as they exist in your project. @@ -183,16 +194,16 @@ Important rules: - Every imported file must be included. - Filenames must match exactly (case-sensitive). - Folder structure should reflect your project layout. -- Do not flatten the files — this method expects multi-file compilation. +- Do not flatten the files. This method expects multi-file compilation. During verification, the explorer will reconstruct the compilation environment using the files you provide. ![multiple](/img/developers/smart-contracts/rsk-explorer/multiple.png) - **Other Settings**: - All other fields (compiler version, EVM version, optimization, contract name, constructor arguments, libraries.) work exactly the same as described in the **Single File** Verification section. + All other fields (compiler version, EVM version, optimization, contract name, constructor arguments, libraries) work exactly the same as described in the **Single File** section. -### 3. **Standard JSON input** +### 3. Standard JSON The **Standard JSON** Input method is the most reliable and exact verification approach. It reproduces the full Solidity compiler configuration used during deployment by providing a complete standard-json object, exactly as consumed by `solc --standard-json`. @@ -205,7 +216,7 @@ This method is strongly recommended for: ![json](/img/developers/smart-contracts/rsk-explorer/json.png) -- **Other Settings**: All other fields (compiler version, optimization, contract name, constructor arguments, libraries.) work exactly the same as described in the **Single File** Verification section. +- **Other Settings**: All other fields (compiler version, optimization, contract name, constructor arguments, libraries) work exactly the same as described in the **Single File** section. **How to Generate Standard JSON Input** @@ -291,9 +302,9 @@ Replace: > The `> .json` at the end of the command redirects the Standard JSON input output into a file in the current directory, which can then be uploaded as-is to the Rootstock Explorer verification tool. -### 4. **Hardhat Verification** +### 4. Hardhat Verification -Select Hardhat as your verification method to verify contracts directly from your Hardhat project. This method does not require uploading files through the interface — instead, verification is performed using the Hardhat CLI. +Select Hardhat as your verification method to verify contracts directly from your Hardhat project. This method does not require uploading files through the interface. Instead, verification is performed using the Hardhat CLI. ![hardhat](/img/developers/smart-contracts/rsk-explorer/hardhat.png) @@ -324,13 +335,13 @@ Replace: > Once it completes successfully, your contract will be verified on the Rootstock Explorer. -To see a detailed explanation on how to verify contracts using Hardhat, visit [here](https://dev.rootstock.io/developers/smart-contracts/verify-smart-contracts/hardhat-verify-plugin/) +For a detailed walkthrough, see [Verify Smart Contracts using the Hardhat Verify Plugin](/developers/smart-contracts/verify-smart-contracts/hardhat-verify-plugin/). -### 5. **Foundry Verification** +### 5. Foundry Verification Select **Foundry** as your verification method to verify contracts using the forge verify-contract command. -This method integrates Foundry directly with the Rootstock Explorer’s verification API, allowing you to verify a deployed contract from your local environment. +This method integrates Foundry directly with the Rootstock Explorer's verification API, allowing you to verify a deployed contract from your local environment. Run the verification command in the terminal: @@ -353,7 +364,7 @@ Replace: Once the command finishes, your contract will appear as Verified on the Rootstock Explorer. -To see a detailed explanation on how to verify contracts using Foundry, visit [here](https://dev.rootstock.io/developers/smart-contracts/foundry/verify-smart-contracts/) +For a detailed walkthrough, see [Verify Smart Contracts using Foundry](/developers/smart-contracts/foundry/verify-smart-contracts/). ## Submit and Validate @@ -423,7 +434,9 @@ Once you have entered all the details, click "Verify Contract". -> 💡 **Tip:** If verification keeps failing, try matching the compiler settings directly from your Hardhat or Foundry build artifacts. +:::tip[Tip] +If verification keeps failing, try matching the compiler settings directly from your Hardhat or Foundry build artifacts. +::: ## Resources