# Smart Contract

## Deploy Smart Contract

### Ethereum APIs[​](https://docs.avax.network/apis/avalanchego/apis/c-chain#ethereum-apis) <a href="#ethereum-apis" id="ethereum-apis"></a>

**JSON-RPC Endpoints**[**​**](https://docs.avax.network/apis/avalanchego/apis/c-chain#json-rpc-endpoints)

To interact with C-Chain via the JSON-RPC endpoint:

```
/ext/bc/C/rpc
```

To interact with other instances of the EVM via the JSON-RPC endpoint:

```
/ext/bc/blockchainID/rpc
```

where `blockchainID` is the ID of the blockchain running the EVM.

**WebSocket Endpoints**[**​**](https://docs.avax.network/apis/avalanchego/apis/c-chain#websocket-endpoints)

To interact via the websocket endpoint:

```
/ext/bc/C/ws
```

For example, to interact with the C-Chain's Ethereum APIs via websocket on localhost you can use:

```
ws://127.0.0.1:9650/ext/bc/C/ws
```

To interact with other instances of the EVM via the websocket endpoint:

```
/ext/bc/blockchainID/ws
```

where `blockchainID` is the ID of the blockchain running the EVM.

#### Standard Ethereum APIs[​](https://docs.avax.network/apis/avalanchego/apis/c-chain#standard-ethereum-apis) <a href="#standard-ethereum-apis" id="standard-ethereum-apis"></a>

GEMNODE offers an API interface identical to Geth's API except that it only supports the following services:

* `web3_`
* `net_`
* `eth_`
* `personal_`
* `txpool_`
* `debug_` (note: this is turned off on the public api node.)

You can interact with these services the same exact way you’d interact with Geth. See the [Ethereum Wiki’s JSON-RPC Documentation](https://eth.wiki/json-rpc/API) and [Geth’s JSON-RPC Documentation](https://geth.ethereum.org/docs/rpc/server) for a full description of this API.

#### eth\_getAssetBalance[​](https://docs.avax.network/apis/avalanchego/apis/c-chain#eth_getassetbalance) <a href="#eth_getassetbalance" id="eth_getassetbalance"></a>

In addition to the standard Ethereum APIs, Avalanche offers `eth_getAssetBalance` to retrieve the balance of first class Avalanche Native Tokens on the C-Chain (excluding AVAX, which must be fetched with `eth_getBalance`).

**Signature**

<pre><code>eth_getAssetBalance({    
    address: string,    
    blk: BlkNrOrHash,    
<strong>    assetID: string,
</strong>}) -> {balance: int}
</code></pre>

* `address` owner of the asset
* `blk` is the block number or hash at which to retrieve the balance
* `assetID` id of the asset for which the balance is requested

**Example Call**

```
curl -X POST --data '{
    "jsonrpc": "2.0",
        "method": "eth_getAssetBalance",
            "params": [
                    "0x8723e5773847A4Eb5FeEDabD9320802c5c812F46",
                    "latest",
                    "3RvKBAmQnfYionFXMfW5P8TDZgZiogKbHjM8cjpu16LKAgF5T"
    ],    
    "id": 1
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/C/rpc
```

**Example Response**

```
{  "jsonrpc": "2.0",  "id": 1,  "result": "0x1388"}
```

#### eth\_baseFee[​](https://docs.avax.network/apis/avalanchego/apis/c-chain#eth_basefee) <a href="#eth_basefee" id="eth_basefee"></a>

Get the base fee for the next block.

**Signature**[**​**](https://docs.avax.network/apis/avalanchego/apis/c-chain#signature)

```
eth_baseFee() -> {}
```

`result` is the hex value of the base fee for the next block.

**Example Call**[**​**](https://docs.avax.network/apis/avalanchego/apis/c-chain#example-call)

```
curl -X POST --data '{
    "jsonrpc":"2.0",
    "id"     :1,
    "method" :"eth_baseFee",
    "params" :[]
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/C/rpc
```

**Example Response**[**​**](https://docs.avax.network/apis/avalanchego/apis/c-chain#example-response)

```
{  "jsonrpc": "2.0",  "id": 1,  "result": "0x34630b8a00"}
```

#### eth\_maxPriorityFeePerGas[​](https://docs.avax.network/apis/avalanchego/apis/c-chain#eth_maxpriorityfeepergas) <a href="#eth_maxpriorityfeepergas" id="eth_maxpriorityfeepergas"></a>

Get the priority fee needed to be included in a block.

**Signature**[**​**](https://docs.avax.network/apis/avalanchego/apis/c-chain#signature-1)

```
eth_maxPriorityFeePerGas() -> {}
```

`result` is hex value of the priority fee needed to be included in a block.

**Example Call**[**​**](https://docs.avax.network/apis/avalanchego/apis/c-chain#example-call-1)

```
curl -X POST --data '{
    "jsonrpc":"2.0",
    "id"     :1,
    "method" :"eth_maxPriorityFeePerGas",
    "params" :[]
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/C/rpc
```

**Example Response**[**​**](https://docs.avax.network/apis/avalanchego/apis/c-chain#example-response-1)

```
{  "jsonrpc": "2.0",  "id": 1,  "result": "0x2540be400"}
```

For more information on dynamic fees see the [C-Chain section of the transaction fee documentation](https://docs.avax.network/quickstart/transaction-fees#c-chain-fees).

#### eth\_getChainConfig[​](https://docs.avax.network/apis/avalanchego/apis/c-chain#eth_getchainconfig) <a href="#eth_getchainconfig" id="eth_getchainconfig"></a>

`eth_getChainConfig` returns chain config. This API is enabled by default with `internal-eth` namespace.

**Signature**

```
eth_getChainConfig({}) -> {chainConfig: json}
```

**Example Call**

```
curl -X POST --data '{
    "jsonrpc":"2.0",
    "id"     :1,
    "method" :"eth_getChainConfig",
    "params" :[]
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/C/rpc
```

**Example Response**

```
{
  "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "chainId": 43112,
        "homesteadBlock": 0,
        "daoForkBlock": 0,
        "daoForkSupport": true,
        "eip150Block": 0,
        "eip150Hash": "0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0",
        "eip155Block": 0,
        "eip158Block": 0,
        "byzantiumBlock": 0,
        "constantinopleBlock": 0,
        "petersburgBlock": 0,
        "istanbulBlock": 0,
        "muirGlacierBlock": 0,
        "apricotPhase1BlockTimestamp": 0,
        "apricotPhase2BlockTimestamp": 0,
        "apricotPhase3BlockTimestamp": 0,
        "apricotPhase4BlockTimestamp": 0,
        "apricotPhase5BlockTimestamp": 0  
    }
}
```

## GEMNODE Specific APIs <a href="#avalanche-specific-apis" id="avalanche-specific-apis"></a>

*<mark style="background-color:blue;">Coming Soon!</mark>*

## Verify Smart Contract

### Contract Verification[​](https://docs.avax.network/dapps/launch-your-ethereum-dapp#contract-verification) <a href="#contract-verification" id="contract-verification"></a>

Smart contract verification provides transparency by publishing the source code, allowing everyone to attest that it really does what it claims to do. You can verify your smart contracts using the [GEMNODE Explorer](/whitepaper/whitepaper-en/network-infrastructure/mainnet-explorer.md). The procedure is simple:

1. Navigate to your published contract address on the explorer
2. On the `code` tab select `verify & publish`
3. Copy and paste the flattened source code and enter all the build parameters exactly as they are on the published contract
4. Click `verify & publish`

If successful, the `code` tab will now have a green checkmark, and your users will be able to verify the contents of your contract. This is a strong positive signal that your users can trust your contracts, and it is strongly recommended for all production contracts.

### Contract Security Checks[​](https://docs.avax.network/dapps/launch-your-ethereum-dapp#contract-security-checks) <a href="#contract-security-checks" id="contract-security-checks"></a>

Once deployed, it would be tough to fix bugs on decentralized applications due to its nature. Hence, it's vital to ensure an app operates properly before deployment. Contract security reviews can be done by specialized companies and services, but they will be costly. To avoid paying sky high audit fees, developers can use free resources as [Slither](https://github.com/crytic/slither), [MythX](https://mythx.io/), [Mythril](https://github.com/ConsenSys/mythril).


---

# Agent Instructions: 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://whitepaper.gemnode.io/whitepaper/whitepaper-en/network-infrastructure/smart-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.
