TRON JSON-RPC API is the Ethereum-compatible interface implemented by java-tron nodes, making it easier to reuse Web3.js, ethers, viem, and similar tooling.
TRON JSON-RPC API can be understood as a lightweight interface set for Ethereum-compatible scenarios. It covers part of the node's EVM-style query and call capabilities and makes it easier to reuse Web3.js, ethers, viem, and other Ethereum tooling.
JSON-RPC API is not a full replacement for FullNode HTTP API. Because TRON and Ethereum differ in their underlying mechanisms, some Ethereum JSON-RPC methods do not have corresponding implementations on TRON, or behave differently.
Compatibility conventions
- Addresses: State-query, call, and transaction-building methods accept only hexadecimal addresses: either a 20-byte EVM-style address or a 21-byte TRON address beginning with
41, in both cases with or without0x. JSON-RPC does not accept Base58Check (T...) addresses. Log filters use 20-byte hexadecimal addresses. - Call data:
eth_call,eth_estimateGas, andbuildTransactionaccept bothdataandinput. Foreth_callandeth_estimateGas,inputis used when both fields are present. ForbuildTransaction, the two fields must decode to identical bytes when both are provided; otherwise, the method returns an invalid-parameters error. A non-emptyinputrequires a0xprefix and an even number of hex digits; an empty string represents empty bytes.dataretains more lenient parsing for compatibility with legacy clients. - Block tags: Support is method-specific. Block-query methods generally support
latest,earliest, andfinalized, but notpendingorsafe. State-query methods and the string selector ofeth_callsupport onlylatest. Clients should not assume that every method supports the same tags. - HTTP status codes: Protocol or application errors that reach the JSON-RPC servlet generally return HTTP 200 with an
errorobject. Transport-level failures, such as an oversized request body, may still return HTTP 413.
Entry point and default status
| Item | Description |
|---|---|
| Default status | Disabled by default. Enable it manually in the node.jsonrpc configuration block |
| FullNode JSON-RPC default port | 8545 |
| Solidity JSON-RPC default port | 8555 |
| Self-hosted node path | Port root path, for example http://127.0.0.1:8545/ |
| TronGrid path | https://api.trongrid.io/jsonrpc |
| Main purpose | Reuse Ethereum tooling, query EVM-style data, read logs, and call contracts |
A self-hosted java-tron node serves JSON-RPC at the root path of the configured port. /jsonrpc is a TronGrid gateway path, not the generic path for self-hosted nodes.
Enable JSON-RPC
Enable it in the node config.conf file:
node {
jsonrpc {
httpFullNodeEnable = true
httpFullNodePort = 8545
httpSolidityEnable = true
httpSolidityPort = 8555
}
}FullNode JSON-RPC serves the latest head state. Solidity JSON-RPC serves solidified state. Production systems should choose the port based on the finality requirements of the read path.
API categories
| Category | Entry | Main purpose |
|---|---|---|
eth_* | eth | Query accounts, blocks, transactions, receipts, contract code, logs, filters, and chain information |
net_* | net | Query node P2P connection status and network version |
web3_* | web3 | Query client version and compute Keccak-256 hashes |
buildTransaction | buildTransaction | Build TRON transaction objects for later signing and broadcast |
Common use cases
Reuse Ethereum tooling
If your application already uses Web3.js, ethers, viem, or similar tooling, you can connect it to TRON through JSON-RPC. Common use cases include reading block height, querying transaction receipts, reading contract code, running eth_call, and querying event logs.
Query contract events
eth_getLogs can query event logs by address, block range, and topic. The actual block range, topic count, and result size may be limited by node or gateway configuration. For high-frequency historical event search, consider TronGrid V1 API or a self-hosted indexer.
In the GreatVoyage-v4.8.2 default node configuration, a single log query spans at most 5000 blocks, includes at most 1000 addresses and 1000 subtopics, and the node maintains at most 20000 active log filters. Node operators can adjust these limits through node.jsonrpc.maxBlockRange, maxAddressSize, maxSubTopics, and maxLogFilterNum. Gateways such as TronGrid may use different limits. eth_getFilterLogs and eth_getLogs use the same block-range validation.
The defaults also set maxBatchSize to 100, maxResponseSize to 26214400 bytes (25 MiB), and maxMessageSize to 4194304 bytes (approximately 4 MiB). These settings belong to the node.jsonrpc block and are independent of the FullNode HTTP API limits.
Build TRON transactions
buildTransaction is a TRON extension method used to construct different types of TRON transactions. The constructed transaction still needs to be signed and broadcast. The full flow can be understood together with FullNode HTTP transaction construction and broadcast APIs.
Request format
JSON-RPC requests use POST and include jsonrpc, method, params, and id in the request body:
curl --request POST \
--url 'http://127.0.0.1:8545/' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}'TronGrid gateway example:
curl --request POST \
--url 'https://api.trongrid.io/jsonrpc' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "eth_chainId",
"params": [],
"id": 1
}'Hex encoding rules
Values and byte data are both represented as hex strings in JSON-RPC, but they follow different rules.
Quantities
Quantities use a 0x prefix and compact encoding. Leading zeroes are not allowed:
| Example | Valid | Description |
|---|---|---|
0x0 | Yes | Quantity 0 |
0x41 | Yes | Decimal 65 |
0x0400 | No | Leading zeroes are not allowed |
ff | No | Missing 0x prefix |
Byte data
Byte data also uses a 0x prefix, but each byte must use two hex digits:
| Example | Valid | Description |
|---|---|---|
0x | Yes | Empty bytes |
0x41 | Yes | 1 byte |
0x004200 | Yes | 3 bytes |
0xf0f0f | No | Odd number of hex digits |
004200 | No | Missing 0x prefix |
Difference from FullNode HTTP API
| Capability | JSON-RPC API | FullNode HTTP API |
|---|---|---|
| Ethereum tooling compatibility | Strong | Limited |
| Interface coverage | Covers part of EVM-style query and call scenarios | Covers standard node HTTP capabilities |
| Event log queries | Supports EVM-style logs | Standard node HTTP has more limited coverage |
| Default status | Disabled by default | Enabled by default |
Related resources
- FullNode HTTP API — standard TRON node HTTP read/write interface
- Solidity HTTP API — read-only interface based on solidified blocks
- TRON vs Ethereum — protocol differences between TRON and Ethereum
- Networks — public endpoints for Mainnet, Shasta, and Nile