JSON-RPC Server for GateChain EVM

·

GateChain’s EVM (Ethereum Virtual Machine) is designed to maintain high compatibility with Ethereum, enabling developers to leverage familiar tools, workflows, and APIs. One of the core components of this compatibility is the JSON-RPC server, which allows clients to interact with the GateChain blockchain by sending standardized JSON-RPC requests. This guide explores the supported JSON-RPC methods, their parameters, return values, and practical usage examples—providing a comprehensive reference for developers building on or integrating with GateChain.

Whether you're retrieving account balances, estimating gas costs, or querying transaction receipts, understanding these endpoints is essential for efficient blockchain interaction. Below, we detail each implemented method in a clear, structured format to enhance readability and usability.


Core JSON-RPC Methods Overview

The following table summarizes the JSON-RPC methods currently supported by GateChain, grouped by namespace. All listed methods are fully implemented and function as specified in the Ethereum JSON-RPC standard.

MethodNamespaceImplementedDescription
web3_clientVersionWeb3Returns client version
web3_sha3Web3Computes Keccak-256 hash
net_versionNetRetrieves network ID
eth_protocolVersionEthReturns protocol version
eth_syncingEthChecks synchronization status
eth_gasPriceEthGets current gas price
eth_accountsEthLists available accounts
eth_blockNumberEthReturns latest block number
eth_getBalanceEthFetches account balance
eth_getStorageAtEthReads contract storage
eth_getTransactionCountEthGets transaction count (nonce)
eth_getBlockTransactionCountByNumberEthCounts transactions in a block (by number)
eth_getBlockTransactionCountByHashEthCounts transactions in a block (by hash)
eth_getCodeEthRetrieves contract bytecode
eth_signEthSigns data with account key
eth_sendTransactionEthSends a signed transaction
eth_sendRawTransactionEthBroadcasts raw signed transaction
eth_callEthExecutes call without mining
eth_estimateGasEthEstimates gas needed for execution

👉 Discover how blockchain APIs power decentralized applications today


Detailed Method Reference

web3_clientVersion

Returns the current client version string.

Parameters

None

Returns

Example Request

curl -X POST --data '{
  "jsonrpc":"2.0",
  "method":"web3_clientVersion",
  "params":[],
  "id":67
}' localhost:8545

Example Response

{
  "jsonrpc":"2.0",
  "id":67,
  "result":"gate enhanced-1.0.5-135-gf00ae80"
}

web3_sha3

Computes the Keccak-256 hash of the given data. Note: This is not standard SHA3-256 but the pre-Ethereum-standard Keccak variant.

Parameters

Returns

Example

{
  "method":"web3_sha3",
  "params":["0x68656c6c6f20776f726c64"]
}

Result: 0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad


net_version

Retrieves the current network ID.

Returns

Example

{
  "method":"net_version",
  "params":[]
}

Response: "86"


eth_protocolVersion

Returns the current Ethereum protocol version.

Returns


eth_syncing

Checks if the node is currently syncing with the network.

Returns

Example Syncing Response

{
  "currentBlock":106699
}

eth_gasPrice

Returns the current recommended gas price in wei.

Returns

Example

Response: "0x09184e72a000" (10,000,000,000,000 wei)


eth_accounts

Lists all accounts controlled by the client.

Returns

Example

[
  "0xd9a549bcca822b696718802ec4aad4e1acc24367",
  "0xcfe9c51a8039e74b0cce28642be0504fc898094a"
]

eth_blockNumber

Returns the number of the most recent block.

Returns

👉 Learn how real-time blockchain data fuels smart development workflows


eth_getBalance

Queries the balance of a given address.

Parameters

Returns

Example

{
  "method":"eth_getBalance",
  "params":["0x407d73d8a49eeb85d32cf465507dd71d507100c1", "latest"]
}

eth_getStorageAt

Reads a specific position in a contract's storage.

Parameters

Useful for debugging and reading internal contract state directly.

For mappings, compute slot via:

keccak(key || padded_position)

Advanced Transaction and Block Queries

Methods like eth_getTransactionCount, getBlockByHash, and getTransactionReceipt enable precise inspection of account activity and blockchain state.

Key Use Cases:

These are foundational for wallet backends, explorers, and analytics platforms.


Execution & Simulation Tools

eth_call

Executes a message call locally without broadcasting or altering blockchain state. Ideal for reading contract outputs (e.g., balanceOf, view functions).

eth_estimateGas

Estimates gas required to execute a transaction. Helps prevent out-of-gas errors during deployment or interaction.

⚠️ Note: Actual gas usage may differ due to network conditions and EVM behavior.

Transaction Lifecycle Management

Sending Transactions

Use either:

Both return a transaction hash upon acceptance.

Retrieving Results

After sending:

  1. Use eth_getTransactionByHash to confirm inclusion.
  2. Use eth_getTransactionReceipt once mined to get:

    • Status (0x1 = success)
    • Gas used
    • Contract address (if created)
    • Event logs

Frequently Asked Questions (FAQ)

Q: Is GateChain fully compatible with Ethereum JSON-RPC?
A: Yes, GateChain supports all major Ethereum JSON-RPC methods required for dApp development, ensuring seamless integration with existing tooling like Web3.js and Ethers.js.

Q: Can I use MetaMask with GateChain?
A: Yes, you can configure MetaMask to connect to GateChain by adding a custom RPC network using the appropriate endpoint and chain ID (86).

Q: How do I sign transactions securely?
A: Avoid using eth_sign on production nodes. Instead, sign transactions offline using libraries like Ethers.js or hardware wallets, then broadcast via eth_sendRawTransaction.

Q: Why does eth_estimateGas return higher values than actual usage?
A: The estimator simulates worst-case scenarios. Factors like node state and gas metering variations can lead to overestimation. Always include a small buffer when setting gas limits.

Q: What is the difference between eth_call and eth_sendTransaction?
A: eth_call reads data without creating a transaction; it's free and instantaneous. eth_sendTransaction writes data to the blockchain, costs gas, and requires mining.

Q: How can I monitor contract events?
A: Parse logs from eth_getTransactionReceipt or use filter-based polling (if supported). Logs contain indexed event data emitted during contract execution.


Final Thoughts

Understanding and effectively using JSON-RPC methods is crucial for any developer working with EVM-compatible blockchains like GateChain. From querying balances to deploying contracts, these interfaces form the backbone of blockchain interaction.

As decentralized systems evolve, mastering low-level APIs ensures robustness, security, and flexibility in your applications.

👉 Access powerful blockchain tools to streamline your development process