GEMNODE_v3
  • Announcement
    • πŸ‘‹Community
    • πŸ“†Updates
  • Whitepaper
    • Whitepaper (EN)
      • πŸ”Overview
        • Introduction
        • Advantages
        • Network Info
        • Backers & Partners
        • Audit & KYC Reports
        • About Avalanche Subnet
      • βš™οΈNetwork Infrastructure
        • Wallet Setup
        • Mainnet RPC Info
        • Testnet
          • Testnet RPC
          • Testnet Faucet
          • Testnet Explorer
        • Validator
          • Node
          • Staking
        • Smart Contract
        • Mainnet Explorer
        • NFT
        • Specs
      • πŸ“¦GEMNODE SDK
        • GEMNODE SDK
        • GEMNODE APIs
      • πŸ”‹GEM
        • About GEM
        • Tokenomics
        • Vesting Schedule
        • Transparency
      • βœ…Native Apps
        • GEMNODE Client Interface
        • GEMNODE Bridge
        • GEMNODE DEX
        • GEMNODE NFT Market
        • GEMNODE DAO
        • GEMNODE Scholar
        • Roadmap
      • πŸ’‘Bug Bounty
Powered by GitBook
On this page
  • Deploy Smart Contract
  • Ethereum APIs​
  • GEMNODE Specific APIs
  • Verify Smart Contract
  • Contract Verification​
  • Contract Security Checks​
  1. Whitepaper
  2. Whitepaper (EN)
  3. Network Infrastructure

Smart Contract

Building Non-Stop

PreviousStakingNextMainnet Explorer

Last updated 2 years ago

Deploy Smart Contract

Ethereum APIs

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

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.

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.)

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

eth_getAssetBalance({    
    address: string,    
    blk: BlkNrOrHash,    
    assetID: string,
}) -> {balance: int}
  • 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"}

Get the base fee for the next block.

eth_baseFee() -> {}

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

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
{  "jsonrpc": "2.0",  "id": 1,  "result": "0x34630b8a00"}

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

eth_maxPriorityFeePerGas() -> {}

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

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
{  "jsonrpc": "2.0",  "id": 1,  "result": "0x2540be400"}

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

Coming Soon!

Verify Smart Contract

  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.

Standard Ethereum APIs

You can interact with these services the same exact way you’d interact with Geth. See the and for a full description of this API.

eth_getAssetBalance

eth_baseFee

Signature

Example Call

Example Response

eth_maxPriorityFeePerGas

Signature

Example Call

Example Response

For more information on dynamic fees see the .

eth_getChainConfig

Contract Verification

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 . The procedure is simple:

Contract Security Checks

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 , , .

βš™οΈ
​
​
​
​
Ethereum Wiki’s JSON-RPC Documentation
Geth’s JSON-RPC Documentation
​
​
​
​
​
​
​
​
​
C-Chain section of the transaction fee documentation
​
​
GEMNODE Explorer
​
Slither
MythX
Mythril