Developers 🔧
Json RPC

JSON-RPC-Endpoint

Xone Chain is an L1 public chain based on Ethereum, fully compatible with Ethereum JSON-RPC API, and supports interaction with mainstream libraries such as Web3.js and Ethers.js. Developers can use JSON-RPC to access Xone Chain for account management, transaction sending, smart contract calling, and other operations.

Endpoint

Xone Chain provides multiple RPC endpoints for developers to connect to the main network or test network. All requests use the POST method.

NetworkRPC EndpointChain ID
Xone Mainnet

https://rpc.xone.org
wss://rpc-wss.xone.org

0xe89(3721)
Xone Testnet

https://rpc-testnet.xone.plus
https://rpc-testnet.xone.org
https://rpc-testnet.knight.center
wss://wss-rpc-testnet.xone.org

0x20352b3(33772211)

Example Method

eth_blockNumber

  • method: eth_blockNumber
  • parameters: []
  • return: Latest block number (hexadecimal)
Sample request.json
{
  "jsonrpc": "2.0",
  "method": "eth_blockNumber",
  "params": [],
  "id": 1
}
Example returns
Example returns.json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x10d4f"
}

eth_getBalance

  • method: eth_getBalance
  • parameters: [address, "latest"]
  • return: Balance (Wei, hexadecimal)
Sample request.json
{
  "jsonrpc": "2.0",
  "method": "eth_getBalance",
  "params": ["0x742d35Cc6634C0532925a3b844Bc454e4438f44e", "latest"],
  "id": 1
}
Example returns
Example returns.json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0xde0b6b3a7640000"
}
ℹ️

Explanation: 0xde0b6b3a7640000 represents 1 XOC (10^18 Wei).

eth_sendRawTransaction

  • method: eth_sendRawTransaction
  • parameters: [Signed transaction data]
  • return: Transaction Hash (Hexadecimal)
Sample request.json
{
  "jsonrpc": "2.0",
  "method": "eth_sendRawTransaction",
  "params": ["0xf86c8201f0843b9aca0082520894a7d9dcbf9f50e5bde45d26bb00ac8bd62367c6fc880de0b6b3a76400008029a0d9f4d9a127cae5b1aa1b71a1e4f42b958f9e4f785c156fae51c5a9e9e9b3fbe3a05e3e11a6c7cc0b1e9805f1d9e0b34c55ad6e4c4cc7a96cfd58b28e7f7d86e45f"],
  "id": 1
}
Example returns
Example returns.json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x5e3b5d5c97c9c5a1b30c914f9ae097e62b5a792089be1c4cb1e9e26aa44f4349"
}
ℹ️

Note: The transaction must be signed before sending. You can use ethers.js or Web3.js to sign.

eth_getTransactionByHash

  • method: eth_getTransactionByHash
  • parameters: [Transaction Hash]
  • return: Transaction Details
Sample request.json
{
  "jsonrpc": "2.0",
  "method": "eth_getTransactionByHash",
  "params": ["0x5e3b5d5c97c9c5a1b30c914f9ae097e62b5a792089be1c4cb1e9e26aa44f4349"],
  "id": 1
}
Example returns
Example returns.json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "blockHash": "0xe45c6b9ff...",
    "blockNumber": "0x10d4f",
    "from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
    "gas": "0x5208",
    "gasPrice": "0x3b9aca00",
    "hash": "0x5e3b5d5c97c9c5a1b30c914f9ae097e62b5a792089be1c4cb1e9e26aa44f4349",
    "nonce": "0x1",
    "to": "0x3535353535353535353535353535353535353535",
    "value": "0xde0b6b3a7640000"
  }
}