> For the complete documentation index, see [llms.txt](https://sodex.com/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sodex.com/documentation/for-developers/api-reference/json-rpc.md).

# ValueChain JSON-RPC

ValueChain EVM provides Ethereum-compatible JSON-RPC over HTTP and WebSocket. Network endpoints, chain IDs, and explorer URLs are listed on [ValueChain EVM](/documentation/for-developers/developers/valuechain-evm.md).

Parameter names, encodings, and response shapes follow the [Ethereum JSON-RPC](https://ethereum.org/developers/docs/apis/json-rpc/) and [Execution API](https://ethereum.github.io/execution-apis/api-documentation/) specifications unless noted on the method page.

When submitting transactions, verify the chain ID, estimate gas against the selected network, retain the transaction hash, and wait for [transaction finality](/documentation/for-developers/developers/valuechain-evm/transaction-finality.md) before starting dependent work.

## Call a method

```bash
curl -sS https://mainnet.valuechain.xyz \
  -H 'Content-Type: application/json' \
  --data '{"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]}'
```

Use `https://testnet.valuechain.xyz` or `wss://testnet-ws.valuechain.xyz` on testnet. Hex quantities use a `0x` prefix.

## Methods

### Chain and node

|                                          |                                                  |
| ---------------------------------------- | ------------------------------------------------ |
| `[eth_chainId](json-rpc/eth-chainId.md)` | `[eth_blockNumber](json-rpc/eth-blockNumber.md)` |

### Blocks and headers

|                                                                                            |                                                                                        |
| ------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------- |
| `[eth_getBlockByHash](json-rpc/eth-getBlockByHash.md)`                                     | `[eth_getBlockByNumber](json-rpc/eth-getBlockByNumber.md)`                             |
| `[eth_getBlockReceipts](json-rpc/eth-getBlockReceipts.md)`                                 | `[eth_getHeaderByHash](json-rpc/eth-getHeaderByHash.md)`                               |
| `[eth_getHeaderByNumber](json-rpc/eth-getHeaderByNumber.md)`                               | `[eth_getBlockTransactionCountByHash](json-rpc/eth-getBlockTransactionCountByHash.md)` |
| `[eth_getBlockTransactionCountByNumber](json-rpc/eth-getBlockTransactionCountByNumber.md)` |                                                                                        |

ValueChain uses [single slot finality](/documentation/for-developers/developers/valuechain-evm/transaction-finality.md) with a 2-second slot. `safe` and `finalized` return the same block and typically lag `latest` by one slot. Additional confirmation depth is not required.

### Accounts and state

|                                                                  |                                                |
| ---------------------------------------------------------------- | ---------------------------------------------- |
| `[eth_getBalance](json-rpc/eth-getBalance.md)`                   | `[eth_getCode](json-rpc/eth-getCode.md)`       |
| `[eth_getStorageAt](json-rpc/eth-getStorageAt.md)`               | `[eth_getProof](json-rpc/eth-getProof.md)`     |
| `[eth_getTransactionCount](json-rpc/eth-getTransactionCount.md)` | `[eth_call](json-rpc/eth-call.md)`             |
| `[eth_createAccessList](json-rpc/eth-createAccessList.md)`       | `[eth_simulateV1](json-rpc/eth-simulateV1.md)` |

Balances are native SOSO in wei (18 decimals), not ETH.

### Transactions

|                                                                                                  |                                                                                              |
| ------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------- |
| `[eth_getTransactionByHash](json-rpc/eth-getTransactionByHash.md)`                               | `[eth_getTransactionReceipt](json-rpc/eth-getTransactionReceipt.md)`                         |
| `[eth_getRawTransactionByHash](json-rpc/eth-getRawTransactionByHash.md)`                         | `[eth_getTransactionByBlockHashAndIndex](json-rpc/eth-getTransactionByBlockHashAndIndex.md)` |
| `[eth_getTransactionByBlockNumberAndIndex](json-rpc/eth-getTransactionByBlockNumberAndIndex.md)` | `[eth_sendRawTransaction](json-rpc/eth-sendRawTransaction.md)`                               |

Submit signed transactions with `eth_sendRawTransaction`.

### Logs

|                                          |   |
| ---------------------------------------- | - |
| `[eth_getLogs](json-rpc/eth-getLogs.md)` |   |

### Gas

|                                                |                                                                    |
| ---------------------------------------------- | ------------------------------------------------------------------ |
| `[eth_gasPrice](json-rpc/eth-gasPrice.md)`     | `[eth_maxPriorityFeePerGas](json-rpc/eth-maxPriorityFeePerGas.md)` |
| `[eth_feeHistory](json-rpc/eth-feeHistory.md)` | `[eth_estimateGas](json-rpc/eth-estimateGas.md)`                   |

See [Gas & Fees](/documentation/for-developers/developers/valuechain-evm/gas-and-fees.md) for EIP-1559 pricing and fee calculation.

### WebSocket

|                                              |                                                  |
| -------------------------------------------- | ------------------------------------------------ |
| `[eth_subscribe](json-rpc/eth-subscribe.md)` | `[eth_unsubscribe](json-rpc/eth-unsubscribe.md)` |

Use `wss://mainnet-ws.valuechain.xyz` or `wss://testnet-ws.valuechain.xyz`. HTTP requests reject `eth_subscribe` with `notifications not supported`. `newHeads` follows `latest`; `safe` and `finalized` typically lag that head by one slot.

## Related documentation

* [ValueChain EVM](/documentation/for-developers/developers/valuechain-evm.md) — network endpoints and chain IDs
* [Differences from Ethereum](/documentation/for-developers/developers/valuechain-evm/differences-from-ethereum.md)
* [Transaction Finality](/documentation/for-developers/developers/valuechain-evm/transaction-finality.md)
* [Gas & Fees](/documentation/for-developers/developers/valuechain-evm/gas-and-fees.md)
* [Relayer](/documentation/for-developers/developers/valuechain-evm/relayer.md) — sponsored submission when the caller does not send the raw transaction
* [Ethereum JSON-RPC](https://ethereum.org/developers/docs/apis/json-rpc/)
