> For the complete documentation index, see [llms.txt](https://graphix.gitbook.io/graphix-ai-wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://graphix.gitbook.io/graphix-ai-wiki/for-developers/graphix-ai-testnet-network/contract.md).

# Contract

?module=contract

**`https://eth-sepolia.g.alchemy.com/v2/WddzdzI2o9S3COdT73d5w6AIogbKq4X-/api?module=contract`**

#### Get a list of contracts <a href="#get-a-list-of-contracts" id="get-a-list-of-contracts"></a>

`listcontracts`

List sorted in ascending order based on the time a contact was first indexed by the explorer. With filters \`not\_decompiled\`(\`4\`) or \`not\_verified(4)\` the results will not be sorted for performance reasons.

**Example:**

Copy

```
https://eth-sepolia.g.alchemy.com/v2/WddzdzI2o9S3COdT73d5w6AIogbKq4X-/api
   ?module=contract
   &action=listcontracts
```

Request ParamsExample Result

| Parameter                          | Description                                                                                                                                                              |
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **page**                           | optional nonnegative `integer` representing the page number used for pagination. 'offset' must also be provided.                                                         |
| **offset**                         | optional nonnegative `integer` representing the max number of records to return when paginating. 'page' must also be provided.                                           |
| **filter**                         | optional string `verified`\|`decompiled`\|`unverified`\|`not_decompiled`\|`empty`, or `1`\|`2`\|`3`\|`4`\|`5` respectively. Returns contracts with the requested status. |
| **not\_decompiled\_with\_version** | optional `string` ensures none of the returned contracts were decompiled with the provided version. Ignored unless filtering for `decompiled` contracts.                 |
| **verified\_at\_start\_timestamp** | optional `unix timestamp` Represents the starting timestamp for verified contracts. Only used with `verified` filter.                                                    |
| **verified\_at\_end\_timestamp**   | optional `unix timestamp` Represents the ending timestamp for verified contracts. Only used with `verified` filter.                                                      |

#### Get ABI for a verified contract <a href="#get-abi-for-a-verified-contract" id="get-abi-for-a-verified-contract"></a>

`getabi`

Also available through a GraphQL `addresses` query.

**Example:**

Copy

```
https://eth-sepolia.g.alchemy.com/v2/WddzdzI2o9S3COdT73d5w6AIogbKq4X-/api
   ?module=contract
   &action=getabi
   &address={addressHash}
```

Request ParamsExample Result

| Parameter   | Description                           |
| ----------- | ------------------------------------- |
| **address** | `string` containing the address hash. |

#### Get contract source code for a verified contract <a href="#get-contract-source-code-for-a-verified-contract" id="get-contract-source-code-for-a-verified-contract"></a>

`getsourcecode`

Also available through a GraphQL `addresses` query.

**Example:**

Copy

```
https://eth-sepolia.g.alchemy.com/v2/WddzdzI2o9S3COdT73d5w6AIogbKq4X-/api
   ?module=contract
   &action=getsourcecode
   &address={addressHash}
```

Request ParamsExample Result

| Parameter   | Description                           |
| ----------- | ------------------------------------- |
| **address** | `string` containing the address hash. |

#### Get contract creator address hash and creation transaction hash <a href="#get-contract-creator-address-hash-and-creation-transaction-hash" id="get-contract-creator-address-hash-and-creation-transaction-hash"></a>

`getcontractcreation`

Returns contract creator and transaction hash. Up to 10 contracts at the one request

**Example:**

Copy

```
https://eth-sepolia.g.alchemy.com/v2/WddzdzI2o9S3COdT73d5w6AIogbKq4X-/api
   ?module=contract
   &action=getcontractcreation
   &contractaddresses={addressHash},{addressHash}
```

Request ParamsExample Result

| Parameter             | Description                                          |
| --------------------- | ---------------------------------------------------- |
| **contractaddresses** | `string` containing address hashes, separated by `,` |

#### Verify a contract with its source code and contract creation information <a href="#verify-a-contract-with-its-source-code-and-contract-creation-information" id="verify-a-contract-with-its-source-code-and-contract-creation-information"></a>

`verify`

**Example:**

Copy

```
https://eth-sepolia.g.alchemy.com/v2/WddzdzI2o9S3COdT73d5w6AIogbKq4X-/api
   ?module=contract
   &action=verify
   &addressHash={addressHash}
   &name={name}
   &compilerVersion={compilerVersion}
   &optimization={false}
   &contractSourceCode={contractSourceCode}
```

**Curl Post Example**

Copy

```
curl -d '{"addressHash":"0xc63BB6555C90846afACaC08A0F0Aa5caFCB382a1","compilerVersion":"v0.5.4+commit.9549d8ff", "contractSourceCode":"pragma solidity ^0.5.4; contract Test { }","name":"Test","optimization":false}' -H "Content-Type: application/json" -X POST "https://blockscout.com/poa/sokol/api?module=contract&action=verify"
```

On successful submission you will receive a guid as a receipt. Use this with [`checkverifystatus`](https://docs.blockscout.com/for-users/api/rpc-endpoints/contract#return-status-of-a-verification-attempt)`to view verification status.`

ParamsExample Result

| Parameter                          | Description                                                                   |
| ---------------------------------- | ----------------------------------------------------------------------------- |
| **addressHash**                    | `string` containing the address hash of the contract.                         |
| **name**                           | `string` containing the name of the contract.                                 |
| **compilerVersion**                | `string` containing the compiler version for the contract.                    |
| **optimization**                   | `enum` whether or not compiler optimizations were enabled `0`=false, `1`=true |
| **contractSourceCode**             | `string` containing the source code of the contract.                          |
| **constructorArguments**           | optional `string` constructor argument data provided.                         |
| **autodetectConstructorArguments** | optional `boolean` whether or not automatically detect constructor argument.  |
| **evmVersion**                     | optional EVM version for the contract.                                        |
| **optimizationRuns**               | optional number of optimization runs used during compilation                  |
| **library1Name**                   | optional `string` name of the first library used.                             |
| **library1Address**                | optional `string` address of the first library used.                          |
| **library2Name**                   | optional `string` name of the second library used.                            |
| **library2Address**                | optional `string` address of the second library used.                         |
| **library3Name**                   | optional `string` name of the third library used.                             |
| **library3Address**                | optional `string` address of the third library used.                          |
| **library4Name**                   | optional `string` name of the fourth library used.                            |
| **library4Address**                | optional `string` address of the fourth library used.                         |
| **library5Name**                   | optional `string` name of the fifth library used.                             |
| **library5Address**                | optional `string` address of the fifth library used.                          |

#### Verify a contract through [Sourcify](https://sourcify.dev/) <a href="#verify-a-contract-through-sourcify" id="verify-a-contract-through-sourcify"></a>

`verify_via_sourcify`

1. if a smart contract is already verified on Sourcify, it will automatically fetch the data from the [repo](https://repo.sourcify.dev/)
2. otherwise you need to upload source files and JSON metadata file(s).

**Example:**

Copy

```
https://eth-sepolia.g.alchemy.com/v2/WddzdzI2o9S3COdT73d5w6AIogbKq4X-/api
 ?module=contract
 &action=verify_via_sourcify
 &addressHash={addressHash}
```

**POST body example**

Copy

```
--6e1e4c11657c62dc1e4349d024de9e28
Content-Disposition: form-data; name="addressHash"

0xb77b7443e0F32F1FEBf0BE0fBd7124D135d0a525

--6e1e4c11657c62dc1e4349d024de9e28
Content-Disposition: form-data; name="files[0]"; filename="contract.sol"
Content-Type: application/json

...Source code...

--6e1e4c11657c62dc1e4349d024de9e28
Content-Disposition: form-data; name="files[1]"; filename="metadata.json"
Content-Type: application/json

...JSON metadata...

--6e1e4c11657c62dc1e4349d024de9e28--
```

ParamsExample

| Parameter       | Description                             |
| --------------- | --------------------------------------- |
| **addressHash** | `string` containing the address hash.   |
| **files**       | `array` with sources and metadata files |

#### Verify a vyper contract with its source code and contract creation information <a href="#verify-a-vyper-contract-with-its-source-code-and-contract-creation-information" id="verify-a-vyper-contract-with-its-source-code-and-contract-creation-information"></a>

`verify_vyper_contract`

**Example**

Copy

```
https://eth-sepolia.g.alchemy.com/v2/WddzdzI2o9S3COdT73d5w6AIogbKq4X-/api
 ?module=contract
 &action=verify_vyper_contract
 &addressHash={addressHash}
 &name={name}
 &compilerVersion={compilerVersion}
 &contractSourceCode={contractSourceCode}
```

**curl POST example**

Copy

```
curl --location --request POST 'http://localhost:4000/api?module=contract&action=verify_vyper_contract' --form 'contractSourceCode="SOURCE_CODE"' --form 'name="Vyper_contract"' --form 'addressHash="0xE60B1B8bD493569a3E945be50A6c89d29a560Fa1"' --form 'compilerVersion="v0.2.12"'
```

First TabExample

| Parameter                | Description                                                |
| ------------------------ | ---------------------------------------------------------- |
| **addressHash**          | `string` containing the address hash of the contract.      |
| **name**                 | `string` containing the name of the contract.              |
| **compilerVersion**      | `string` containing the compiler version for the contract. |
| **contractSourceCode**   | `string` containing the source code of the contract.       |
| **constructorArguments** | `string` constructor argument data provided.               |

#### Verify a contract with Standard input JSON file <a href="#verify-a-contract-with-standard-input-json-file" id="verify-a-contract-with-standard-input-json-file"></a>

`verifysourcecode`

**Example**

Copy

```
https://eth-sepolia.g.alchemy.com/v2/WddzdzI2o9S3COdT73d5w6AIogbKq4X-/api
 ?module=contract
 &action=verifysourcecode
 &codeformat={solidity-standard-json-input}
 &contractaddress={contractaddress}
 &contractname={contractname}
 &compilerversion={compilerversion}
 &sourceCode={sourceCode}
```

`solidity-single-file`:

Copy

```
curl --location 'localhost:4000/api?module=contract&action=verifysourcecode' \
--form 'contractaddress="0xDc2082945d55596bf39F362d9EC0F7F65eDBB9DD"' \
--form 'sourceCode="// SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.7.0 <0.9.0;

contract Storage {
    uint256 number;

    function store(uint256 num) public {
        number = num;
    }

    function retrieve() public view returns (uint256){
        return number;
    }
}"' \
--form 'contractname="Storage"' \
--form 'codeformat="solidity-single-file"' \
--form 'compilerversion="v0.8.17+commit.8df45f5f"' \
--form 'optimizationUsed="1"' \
--form 'runs="199"' \
--form 'constructorArguements=""' \
--form 'evmversion="london"' \
--form 'libraryname1="qwe"' \
--form 'libraryaddress1="0xDc2082945d55596bf39F362d9EC0F7F65eDBB9DD"'
--form 'licenseType=0'
```

ParamsExample Result

| Parameter                          | Description                                                                                                                                                                    |
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **codeformat**                     | Format of sourceCode (`solidity-standard-json-input` or `solidity-single-file`)                                                                                                |
| **contractaddress**                | `string` containing the address hash of the contract.                                                                                                                          |
| **contractname**                   | `string` name of the contract. It an be an empty string(""), just the contract name("ContractName"), or a filename and contract name("contracts/contract\_1.sol:ContractName") |
| **compilerversion**                | `string` containing the compiler version for the contract.                                                                                                                     |
| **sourceCode**                     | `string` standard input json or flattened solidity code                                                                                                                        |
| **optimizationUsed**               | could be `0`, `false`, `1`, `true`. Should be set when `codeformat=solidity-single-file`                                                                                       |
| **runs**                           | `integer` is equal to optimization runs number set on compilation. Should be set when `optimizationUsed` is `1` or `true`                                                      |
| **evmversion**                     | `string` EVM version. Should be set when `codeformat=solidity-single-file`                                                                                                     |
| **constructorArguments**           | optional `string` constructor argument data provided.                                                                                                                          |
| **autodetectConstructorArguments** | optional `boolean` whether or not automatically detect constructor argument.                                                                                                   |
| **licenseType**                    | `string` or `number` representing the license type.                                                                                                                            |

#### Return status of a verification attempt <a href="#return-status-of-a-verification-attempt" id="return-status-of-a-verification-attempt"></a>

`checkverifystatus`

guid is received as a receipt from the `verifysourcecode` method.

**Example**

Copy

```
https://eth-sepolia.g.alchemy.com/v2/WddzdzI2o9S3COdT73d5w6AIogbKq4X-/api
 ?module=contract
 &action=checkverifystatus
 &guid={identifierString}
```

ParamsExample Result

| Parameter | Description                                       |
| --------- | ------------------------------------------------- |
| **guid**  | `string`used for identifying verification attempt |

#### Verify proxy contract <a href="#verify-proxy-contract" id="verify-proxy-contract"></a>

`verifyproxycontract`

**Example**

Copy

```
https://eth-sepolia.g.alchemy.com/v2/WddzdzI2o9S3COdT73d5w6AIogbKq4X-/api
 ?module=contract
 &action=verifyproxycontract
 &address={addressHash}
```

ParamsExample Result

| Parameter   | Description                                          |
| ----------- | ---------------------------------------------------- |
| **address** | `string` containing the address hash of the contract |

#### Return status of a proxy contract verification attempt <a href="#return-status-of-a-proxy-contract-verification-attempt" id="return-status-of-a-proxy-contract-verification-attempt"></a>

`checkproxyverification`

guid is received as a receipt from the `verifyproxycontract` method.

**Example**

Copy

```
https://eth-sepolia.g.alchemy.com/v2/WddzdzI2o9S3COdT73d5w6AIogbKq4X-/api
 ?module=contract
 &action=checkproxyverification
 &guid={identifierString}
```

ParamsExample Result

| Parameter | Description                                       |
| --------- | ------------------------------------------------- |
| **guid**  | `string`used for identifying verification attempt |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://graphix.gitbook.io/graphix-ai-wiki/for-developers/graphix-ai-testnet-network/contract.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
