> For the complete documentation index, see [llms.txt](https://docs.tajirchain.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tajirchain.com/etherscan-compatible-explorer-api/contract.md).

# Contract

The Contract module retrieves verified contract information and submits smart-contract verification requests.

### Endpoint

```
https://explorer.tajirchain.com/api?module=contract
```

> Contract verification publishes source code, ABI and compiler metadata publicly. Do not submit secrets, credentials, private comments or confidential business logic.

### Available Actions

| Action                   | Purpose                                             |
| ------------------------ | --------------------------------------------------- |
| `listcontracts`          | List indexed contracts                              |
| `getabi`                 | Get the ABI of a verified contract                  |
| `getsourcecode`          | Get verified source code and metadata               |
| `getcontractcreation`    | Get creator and creation transaction                |
| `verify`                 | Verify flattened Solidity source                    |
| `verify_via_sourcify`    | Verify using source and metadata files              |
| `verify_vyper_contract`  | Verify Vyper source                                 |
| `verifysourcecode`       | Verify Solidity standard JSON or single-file source |
| `checkverifystatus`      | Check verification status                           |
| `verifyproxycontract`    | Verify a proxy relationship                         |
| `checkproxyverification` | Check proxy-verification status                     |

### List Contracts

#### Action

```
listcontracts
```

| Parameter                     | Required | Description                                        |
| ----------------------------- | -------- | -------------------------------------------------- |
| `page`                        | No       | Page number                                        |
| `offset`                      | No       | Results per page                                   |
| `filter`                      | No       | `verified`, `unverified`, `empty`, `1`, `2` or `3` |
| `verified_at_start_timestamp` | No       | Starting Unix timestamp                            |
| `verified_at_end_timestamp`   | No       | Ending Unix timestamp                              |

```bash
curl "https://explorer.tajirchain.com/api?module=contract&action=listcontracts&page=1&offset=10&filter=verified"
```

### Get Contract ABI

#### Action

```
getabi
```

| Parameter | Required | Description      |
| --------- | -------- | ---------------- |
| `address` | Yes      | Contract address |

```bash
curl "https://explorer.tajirchain.com/api?module=contract&action=getabi&address=0xCONTRACT_ADDRESS"
```

If the contract is not verified:

```json
{
  "message": "Contract source code not verified",
  "result": null,
  "status": "0"
}
```

### Get Contract Source Code

#### Action

```
getsourcecode
```

| Parameter | Required | Description      |
| --------- | -------- | ---------------- |
| `address` | Yes      | Contract address |

```bash
curl "https://explorer.tajirchain.com/api?module=contract&action=getsourcecode&address=0xCONTRACT_ADDRESS"
```

The result can include:

* Contract address
* Contract name
* Source code
* ABI
* Compiler version
* Optimization configuration
* Proxy status
* Implementation address
* Source filename
* License information

### Get Contract Creation Information

#### Action

```
getcontractcreation
```

| Parameter           | Required | Description                                    |
| ------------------- | -------- | ---------------------------------------------- |
| `contractaddresses` | Yes      | Comma-separated contract addresses, maximum 10 |

```bash
curl "https://explorer.tajirchain.com/api?module=contract&action=getcontractcreation&contractaddresses=0xCONTRACT1,0xCONTRACT2"
```

The result can contain:

* Contract address
* Contract creator
* Creation transaction hash

### Verify Flattened Solidity Source

#### Action

```
verify
```

Send this request using `POST`.

Required fields:

| Parameter                           | Required | Description                                    |
| ----------------------------------- | -------- | ---------------------------------------------- |
| `addressHash`                       | Yes      | Deployed contract address                      |
| `name`                              | Yes      | Contract name                                  |
| `compilerVersion`                   | Yes      | Exact Solidity compiler version                |
| `optimization`                      | Yes      | `0` or `1`                                     |
| `contractSourceCode`                | Yes      | Solidity source code                           |
| `constructorArguments`              | No       | ABI-encoded constructor arguments without `0x` |
| `autodetectConstructorArguments`    | No       | Attempt automatic detection                    |
| `evmVersion`                        | No       | Compiler EVM version                           |
| `optimizationRuns`                  | No       | Optimization run count                         |
| `library1Name`–`library5Name`       | No       | Linked library names                           |
| `library1Address`–`library5Address` | No       | Linked library addresses                       |

```bash
curl --request POST \
  --url "https://explorer.tajirchain.com/api?module=contract&action=verify" \
  --header "Content-Type: application/json" \
  --data '{
    "addressHash": "0xCONTRACT_ADDRESS",
    "name": "ContractName",
    "compilerVersion": "v0.8.26+commit.8a97fa7a",
    "optimization": true,
    "optimizationRuns": 200,
    "contractSourceCode": "SOLIDITY_SOURCE_CODE"
  }'
```

A successful submission returns a verification identifier or result. Save it for the status request.

### Verify Through Source and Metadata Files

#### Action

```
verify_via_sourcify
```

| Parameter     | Required | Description                        |
| ------------- | -------- | ---------------------------------- |
| `addressHash` | Yes      | Contract address                   |
| `files`       | Yes      | Source and compiler metadata files |

Use a multipart `POST` request:

```bash
curl --request POST \
  --url "https://explorer.tajirchain.com/api?module=contract&action=verify_via_sourcify" \
  --form "addressHash=0xCONTRACT_ADDRESS" \
  --form "files[]=@contract.sol" \
  --form "files[]=@metadata.json"
```

Only public contract source and metadata should be uploaded.

### Verify Vyper Contract

#### Action

```
verify_vyper_contract
```

| Parameter              | Required | Description                   |
| ---------------------- | -------- | ----------------------------- |
| `addressHash`          | Yes      | Contract address              |
| `name`                 | Yes      | Contract name                 |
| `compilerVersion`      | Yes      | Exact Vyper compiler version  |
| `contractSourceCode`   | Yes      | Vyper source code             |
| `constructorArguments` | No       | Encoded constructor arguments |

```bash
curl --request POST \
  --url "https://explorer.tajirchain.com/api?module=contract&action=verify_vyper_contract" \
  --form "addressHash=0xCONTRACT_ADDRESS" \
  --form "name=ContractName" \
  --form "compilerVersion=v0.4.0" \
  --form "contractSourceCode=VYPER_SOURCE_CODE"
```

### Verify Solidity Source Code

#### Action

```
verifysourcecode
```

This action supports Solidity standard JSON input and flattened single-file source.

| Parameter                        | Required    | Description                                              |
| -------------------------------- | ----------- | -------------------------------------------------------- |
| `codeformat`                     | Yes         | `solidity-standard-json-input` or `solidity-single-file` |
| `contractaddress`                | Yes         | Deployed contract address                                |
| `contractname`                   | Yes         | Contract name or `file.sol:ContractName`                 |
| `compilerversion`                | Yes         | Exact compiler version                                   |
| `sourceCode`                     | Yes         | Standard JSON input or flattened source                  |
| `optimizationUsed`               | Conditional | `0`, `1`, `false` or `true`                              |
| `runs`                           | Conditional | Optimization run count                                   |
| `evmversion`                     | No          | Compiler EVM target                                      |
| `constructorArguments`           | No          | Encoded constructor arguments                            |
| `autodetectConstructorArguments` | No          | Enable automatic detection                               |
| `licenseType`                    | No          | Explorer-supported license identifier                    |

```bash
curl --request POST \
  --url "https://explorer.tajirchain.com/api?module=contract&action=verifysourcecode" \
  --header "Content-Type: application/json" \
  --data '{
    "codeformat": "solidity-standard-json-input",
    "contractaddress": "0xCONTRACT_ADDRESS",
    "contractname": "contracts/Contract.sol:ContractName",
    "compilerversion": "v0.8.26+commit.8a97fa7a",
    "sourceCode": {}
  }'
```

### Check Verification Status

#### Action

```
checkverifystatus
```

| Parameter | Required | Description             |
| --------- | -------- | ----------------------- |
| `guid`    | Yes      | Verification identifier |

```bash
curl "https://explorer.tajirchain.com/api?module=contract&action=checkverifystatus&guid=VERIFICATION_ID"
```

Possible states can include:

* Pending
* Successful
* Failed

### Verify Proxy Contract

#### Action

```
verifyproxycontract
```

| Parameter | Required | Description            |
| --------- | -------- | ---------------------- |
| `address` | Yes      | Proxy contract address |

```bash
curl --request POST \
  --url "https://explorer.tajirchain.com/api?module=contract&action=verifyproxycontract" \
  --header "Content-Type: application/json" \
  --data '{
    "address": "0xPROXY_ADDRESS"
  }'
```

### Check Proxy Verification

#### Action

```
checkproxyverification
```

| Parameter | Required | Description                   |
| --------- | -------- | ----------------------------- |
| `guid`    | Yes      | Proxy-verification identifier |

```bash
curl "https://explorer.tajirchain.com/api?module=contract&action=checkproxyverification&guid=VERIFICATION_ID"
```

### Verification Troubleshooting

Verification normally fails when:

* The compiler version is incorrect
* Optimization settings do not match deployment
* Optimization runs do not match
* Constructor arguments are incorrect
* Linked-library addresses are missing
* The wrong contract name or source path is supplied
* The submitted source produces different bytecode
* The EVM version does not match
* Metadata differs from the deployed bytecode
