Verify through Foundry
SocialScan supports verifying smart contracts through Foundry, please refer to https://book.getfoundry.sh/reference/forge/forge-verify-contract for more information.
You must include the following args
contract_address
Your contract address to verify
contract_name
Your contract name to verify
compiler_version
Compiler version, e.g. v0.8.25+commit.b61c2a91
chain
Put your chain id (Not required)
verifier-url
<api_host>/v1/explorer/command_api/contract
API Host: https://api.socialscan.io/<chain_name>/
verifier
Use "blockscout" or "etherscan"
etherscan-api-key
If you use "etherscan" as a verifier, you need to put a random string here
Example
# Compile your smart contract first
forge build
# Verify a flattened contract
forge verify-contract <contract_address> <contract_name> \
--compiler-version <compiler_version> \
--flatten \
--verifier-url <api_host>/v1/explorer/command_api/contract \
--verifier blockscout
# Verify a contract with JSON standard input
forge verify-contract \
<contract_address> <contract_name> \
--watch \
--compiler-version <compiler_version> \
--constructor-args $(cast abi-encode "constructor(string,string)" "TEST" "ST2") \
--verifier-url <api_host>/v1/explorer/command_api/contract \
--verifier blockscout
# Verify a contract use "etherscan" verifier
forge verify-contract \
<contract_address> <contract_name> \
--chain <chain_id> \
--watch --etherscan-api-key test \
--verifier-url <api_host>/v1/explorer/command_api/contract \
--verifier etherscan
# Expected output
Start verifying contract `<contract_address>` deployed on <chain_name>
Submitting verification for [<contract_name>] <contract_address>.
Submitted contract for verification:
Response: `Contract successfully verified`
GUID: `a40a619266ea0d581e6373c52754e4a4ef6333bc8581b9d2a02d6174b3316f39`
URL: <explorer_host>/address/<contract_address>
Contract verification status:
Response: `OK`
Details: `Pass - Verified`
Contract successfully verified
Deploying 2048 Game Contract on Monad Testnet with Foundry
This guide walks you through deploying and verifying a 2048 game smart contract on the Monad testnet using Foundry.
Prerequisites
Before starting, ensure you have:
Foundry installed
A wallet with Monad testnet coin
Your private key
Git installed on your system
Step 1: Clone the Repository
git clone https://github.com/monad-developers/2048-contracts.git
cd 2048-contracts
Step 2: Build the Contract
Compile the smart contract using Foundry's forge tool:
forge build --contracts src/Monad2048.sol
Expected output:
Updating dependencies in /Users/lixiang/2048-contracts/lib
Submodule 'lib/forge-std' (https://github.com/foundry-rs/forge-std) registered for path 'lib/forge-std'
Submodule 'lib/solady' (https://github.com/Vectorized/solady) registered for path 'lib/solady'
Cloning into '/Users/lixiang/2048-contracts/lib/forge-std'...
remote: Enumerating objects: 2126, done.
remote: Counting objects: 100% (1008/1008), done.
remote: Compressing objects: 100% (131/131), done.
remote: Total 2126 (delta 932), reused 879 (delta 877), pack-reused 1118 (from 2)
Receiving objects: 100% (2126/2126), 720.75 KiB | 1.00 MiB/s, done.
Resolving deltas: 100% (1431/1431), done.
Cloning into '/Users/lixiang/2048-contracts/lib/solady'...
remote: Enumerating objects: 10811, done.
remote: Counting objects: 100% (3463/3463), done.
remote: Compressing objects: 100% (685/685), done.
remote: Total 10811 (delta 3107), reused 2793 (delta 2778), pack-reused 7348 (from 4)
Receiving objects: 100% (10811/10811), 7.11 MiB | 1.41 MiB/s, done.
Resolving deltas: 100% (7680/7680), done.
[⠊] Compiling...
[⠔] Compiling 24 files with Solc 0.8.28
[⠒] Solc 0.8.28 finished in 3.62s
Step 3: Deploy the Contract
Deploy the compiled contract to Monad testnet:
forge script script/Deploy.s.sol:Deploy \
--rpc-url https://testnet-rpc.monad.xyz \
--broadcast \
--private-key ${PRIVATE_KEY}
Expected output:
[⠊] Compiling...
No files changed, compilation skipped
Script ran successfully.
== Return ==
gameContract: address {address}
## Setting up 1 EVM.
==========================
Chain 10143
Estimated gas price: 100.000000001 gwei
Estimated total gas used for script: 857808
Estimated amount required: 0.085780800000857808 MON
==========================
##### monad-testnet
✅ [Success] Hash: {transaction_hash}
Contract Address: {contract_address}
Block: 22000095
Paid: 0.042890400000857808 MON (857808 gas * 50.000000001 gwei)
✅ Sequence #1 on monad-testnet | Total Paid: 0.042890400000857808 MON (857808 gas * avg 50.000000001 gwei
Step 4: Verify the Contract
Verify your deployed contract on the Monad block explorer:
forge verify-contract \
{contract_address} \
src/Monad2048.sol:Monad2048 \
--chain 10143 \
--verifier blockscout \
--verifier-url https://api.socialscan.io/monad-testnet/v1/explorer/command_api/contract
Command breakdown:
forge verify-contract
: Foundry's contract verification commandcontract_address
: Your deployed contract addresssrc/Monad2048.sol:Monad2048
: Path to source file and contract name--chain 10143
: Monad testnet chain ID--verifier blockscout
: Use Blockscout as the verification service--verifier-url
: API endpoint for Monad testnet verification
Expected output:
Start verifying contract `0x15cd4b493fC9d58C7f3Be47693c99d51C93467B7` deployed on monad-testnet
Submitting verification for [src/Monad2048.sol:Monad2048] 0x15cd4b493fC9d58C7f3Be47693c99d51C93467B7.
Submitted contract for verification:
Response: `Contract successfully verified`
GUID: `xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
URL: https://api.socialscan.io/monad-testnet/v1/explorer/command_api/address/0x15cd4b493fc9d58c7f3be47693c99d51c93467b7
Verification Result
https://monad-testnet.socialscan.io/address/0x15cd4b493fc9d58c7f3be47693c99d51c93467b7#contract

Last updated
Was this helpful?