Contracts

Get Contract ABI for Verified Contract Source Codes

Returns the Contract Application Binary Interface ( ABI ) of a verified smart contract.

Find verified contracts on our Verified Contracts Source Code page.

https://api-era.zksync.network/api
   ?module=contract
   &action=getabi
   &address=0x00f02443a7beed88c02d6b382e8e6d2aebd154ec
   &apikey=YourApiKeyToken

Try this endpoint in your browser 🔗

Query Parameters

ParameterDescription

address

the contract address that has a verified source code

A simple sample for retrieving the contractABI using Web3.js and Jquery to interact with a contract.

var Web3 = require('web3');
var web3 = new Web3(new Web3.providers.HttpProvider());
var version = web3.version.api;
        
$.getJSON('https://api-era.zksync.network/api?module=contract&action=getabi&address=0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359', function (data) {
    var contractABI = "";
    contractABI = JSON.parse(data.result);
    if (contractABI != ''){
        var MyContract = web3.eth.contract(contractABI);
        var myContractInstance = MyContract.at("0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359");
        var result = myContractInstance.memberId("0xfe8ad7dd2f564a877cc23feea6c0a9cc2e783715");
        console.log("result1 : " + result);            
        var result = myContractInstance.members(1);
        console.log("result2 : " + result);
    } else {
        console.log("Error" );
    }            
});

Get Contract Source Code for Verified Contract Source Codes

Returns the Solidity source code of a verified smart contract.

📩 Tip : You can also download a CSV list of verified contracts addresses of which the code publishers have provided a corresponding Open Source license for redistribution.

https://api-era.zksync.network/api
   ?module=contract
   &action=getsourcecode
   &address=0x00F02443A7beed88c02D6B382e8E6D2Aebd154ec
   &apikey=YourApiKeyToken 

Query Parameters

ParameterDescription

address

the contract address that has a verified source code

Try this endpoint in your browser

Get Contract Creator and Creation Tx Hash

Returns a contract's deployer address and transaction hash it was created, up to 5 at a time.

https://api-era.zksync.network/api
   ?module=contract
   &action=getcontractcreation
   &contractaddresses=0x00F02443A7beed88c02D6B382e8E6D2Aebd154ec,0x00D9E075c4E611f7433a56dB9388A9AbcBc4Ba61,0x00eeb9CBC87D003FC399cd4Ef4c813aebe0C3B28
   &apikey=YourApiKeyToken 

Try this endpoint in your browser 🔗

Query Parameters

ParameterDescription

contractaddresses

the contract address , up to 5 at a time

Verify Source Code

Submits a contract source code to zkSync Era Explorer for verification.

Requests must be sent using HTTP POST

Query Parameters

ParameterDescription

codeformat

single file, use solidity-single-file JSON file ( recommended ), use solidity-standard-json-input

sourceCode

the Solidity source code

constructorArguements

optional, include if your contract uses constructor arguments

contractaddress

the address your contract is deployed at

contractname

the name of your contract, such as contracts/Verified.sol:Verified

compilerversion

compiler version used, such as v0.8.24+commit.e11b9ed9

compilermode

set to solc/zksync

zksolcVersion

zkSolc version used, such as v1.3.14

Check Source Code Verification Status

Returns the success or error status of a contract verification request.

https://api-era.zksync.network/api 
   ?module=contract
   &action=checkverifystatus
   &guid=x3ryqcqr1zdknhfhkimqmizlcqpxncqc6nrvp3pgrcpfsqedqi
   &apikey=YourApiKeyToken 

Query Parameters

ParameterDescription

guid

the unique guid received from the verification request

Verify Proxy Contract

Submits a proxy contract source code to Etherscan for verification.

  1. Requires a valid Etherscan API key, it will be rejected otherwise

  2. Current daily limit of 100 submissions per day per user (subject to change)

  3. Only supports HTTP post

  4. Upon successful submission you will receive a GUID (50 characters) as a receipt

  5. You may use this GUID to track the status of your submission

  6. Verified proxy contracts will display the "Read/Write as Proxy" of the implementation contract under the contract address's contract tab

Verifying Proxy Contract using cURL

// example with only the mandatory contract address parameter
curl -d "address=0xcbdcd3815b5f975e1a2c944a9b2cd1c985a1cb7f" "https://api-era.zksync.network/api ?module=contract&action=verifyproxycontract&apikey=YourApiKeyToken"

// example using the expectedimplementation optional parameter
// the expectedimplementation enforces a check to ensure the returned implementation contract address == address picked up by the verifier
curl -d "address=0xbc46363a7669f6e12353fa95bb067aead3675c29&expectedimplementation=0xe45a5176bc0f2c1198e2451c4e4501d4ed9b65a6" "https://api-era.zksync.network/api ?module=contract&action=verifyproxycontract&apikey=YourApiKeyToken"

Checking Proxy Contract Verification Submission Status using cURL

curl "https://api-era.zksync.network/api ?module=contract&action=checkproxyverification&guid=gwgrrnfy56zf6vc1fljuejwg6pelnc5yns6fg6y2i6zfpgzquz&apikey=YourApiKeyToken"

Last updated