Verify with SocialScan API
API Host
https://api.socialscan.io/<chain_name>/
Endpoint:
POST /v1/explorer/command_api/contract
The request parameters:
name
type
value
required
module
string
contract
true
action
string
verifysourcecode
true
The form parameters:
name
type
value
required
contractaddress
string
true
sourceCode
string
true
codeformat
string
"solidity-standard-json-input" or "solidity-single-file"
true
contractname
string
true
compilerversion
string
true
constructorArguments
string
false
optimizationUsed
string
"0" or "1"
false
runs
int
false
Example
The request:
curl -X POST "https://api.socialscan.io/monad-testnet/v1/explorer/command_api/contract" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "module=contract" \
--data-urlencode "action=verifysourcecode" \
--data-urlencode "contractaddress=0x3522B4679EB691dbAA7C02fb997B2f74D01e2d19" \
--data-urlencode 'sourceCode={
"language": "Solidity",
"sources": {
"HelloWorld.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ncontract HelloWorld {\n string public message;\n\n constructor() {\n message = \"Hello, world!\";\n }\n\n function setMessage(string calldata newMessage) public {\n message = newMessage;\n }\n}"
}
},
"settings": {
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers"
],
"": [
"ast"
]
}
}
}
}' \
--data-urlencode "codeformat=solidity-standard-json-input" \
--data-urlencode "contractname=HelloWorld" \
--data-urlencode "compilerversion=v0.8.30+commit.73712a01"
The response:
// Failed
{
"message": "Contract source code not verified",
"status": "0"
}
// Succeed
{
"message": "Contract successfully verified",
"result": guid,
"status": "1"
}
Last updated
Was this helpful?