Skip to main content

Create2 Compilation

In order to verify using the create2 api, the creation bytecode is needed. With this API the server compiles the contract and puts the creation bytecode in the session.

note

Session-based API is only meant for the sourcify.dev UI. Because it makes use of session cookies and it is not possible have Access-Control-Allow-Origin: * with credentials: true, meaning these endpoints can only be used on explicitly set domains on the browser. (e.g. sourcify.dev). Please use the verification API if you want Sourcify on your frontend.

URL : /session/verify/create2/compile

Method : POST

The body should provide:

  • verificationId

Responses

{
"contracts": [
{
"verificationId": "0x8e2d0b6fef24d782a7c47e67ddfd2f5ca9cace335ce42bd10701ebba609e1244",
"constructorArgumentsArray": [
{
"internalType": "address",
"name": "_owner",
"type": "address"
},
{
"internalType": "uint256",
"name": "_value",
"type": "uint256"
}
],
"creationBytecode": "0x608060405234801561001057600080fd5b5060405161020638038061020683398181016040528101906100329190610054565b80600081905550506100a7565b60008151905061004e81610090565b92915050565b60006020828403121561006a5761006961008b565b5b60006100788482850161003f565b91505092915050565b6000819050919050565b600080fd5b61009981610081565b81146100a457600080fd5b50565b610150806100b66000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80632e64cec11461003b5780636057361d14610059575b600080fd5b610043610075565b60405161005091906100d9565b60405180910390f35b610073600480360381019061006e919061009d565b61007e565b005b60008054905090565b8060008190555050565b60008135905061009781610103565b92915050565b6000602082840312156100b3576100b26100fe565b5b60006100c184828501610088565b91505092915050565b6100d3816100f4565b82525050565b60006020820190506100ee60008301846100ca565b92915050565b6000819050919050565b600080fd5b61010c816100f4565b811461011757600080fd5b5056fea26469706673582212201d279c878911e1b98344e0d39ca1fe4c6aa7b9c649951e3abc365183e0e1695964736f6c63430008070033",
"compiledPath": "contracts/SingleFile.sol",
"name": "Storage",
"files": {
"found": ["contracts/SingleFile.sol"],
"missing": {},
"invalid": {}
},
"status": "error"
}
],
"unused": [],
"files": ["metadata.json", "SingleFile.sol"]
}