Skip to content

Add Tron RPC documentation with signTransaction, signMessage, sendTransaction, and getBalance methods #493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
223 changes: 223 additions & 0 deletions advanced/multichain/rpc-reference/tron-rpc.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
---
title: "Tron"
description: Tron JSON-RPC Methods
---

These are the methods that wallets should implement to handle Tron transactions and messages via WalletConnect.

<Note type="warning">
**Please note:** The TRON RPC standard is still under review and specifications may change. Implementation details and method signatures are subject to updates.
</Note>

### tron_signTransaction

Sign a Tron transaction without executing it.

#### Parameters

1. `transaction` (object) - The transaction to sign:
- `address` (string) - The sender's Tron address
- `transaction` (object) - The transaction object to sign

#### Returns

`object` - The signed transaction:
- `txID` (string) - The transaction ID (deterministically derived from raw transaction)
- `signature` (array) - Array of signature strings
- `raw_data` (object) - The raw transaction data
- `raw_data_hex` (string) - The hex-encoded raw transaction data
- `visible` (boolean) - Whether addresses are in visible format

#### Example

```javascript
// Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "tron_signTransaction",
"params": {
"address": "TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH",
"transaction": {
"raw_data": {
"contract": [
{
"parameter": {
"value": {
"data": "095ea7b30000000000000000000000001cb0b7348eded93b8d0816bbeb819fc1d7a51f310000000000000000000000000000000000000000000000000000000000000000",
"owner_address": "411cb0b7348eded93b8d0816bbeb819fc1d7a51f31",
"contract_address": "41a614f803b6fd780986a42c78ec9c7f77e6ded13c"
},
"type_url": "type.googleapis.com/protocol.TriggerSmartContract"
},
"type": "TriggerSmartContract"
}
],
"ref_block_bytes": "885b",
"ref_block_hash": "baa1c278fd0a309f",
"expiration": 1745849082000,
"fee_limit": 200000000,
"timestamp": 1745849022978
}
}
}
}

// Response
{
"jsonrpc": "2.0",
"result": {
"txID": "66e79c6993f29b02725da54ab146ffb0453ee6a43b4083568ad9585da305374a",
"signature": [
"7e760cef94bc82a7533bc1e8d4ab88508c6e13224cd50cc8da62d3f4d4e19b99514f..."
],
"raw_data": {
"expiration": 1745849082000,
"contract": [
{
"parameter": {
"type_url": "type.googleapis.com/protocol.TriggerSmartContract",
"value": {
"data": "095ea7b30000000000000000000000001cb0b7348eded93b8d0816bbeb819fc1d7a51f310000000000000000000000000000000000000000000000000000000000000000",
"contract_address": "41a614f803b6fd780986a42c78ec9c7f77e6ded13c",
"owner_address": "411cb0b7348eded93b8d0816bbeb819fc1d7a51f31"
}
},
"type": "TriggerSmartContract"
}
],
"ref_block_hash": "baa1c278fd0a309f",
"fee_limit": 200000000,
"timestamp": 1745849022978,
"ref_block_bytes": "885b"
},
"visible": false,
"raw_data_hex": "0a02885b2208baa1c278fd0a309f4090c1dbe5e7325aae01081f12a9010a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e747261637412740a15411cb0b7348eded93b8d0816bbeb819fc1d7a51f31121541a614f803b6fd780986a42c78ec9c7f77e6ded13c2244095ea7b30000000000000000000000001cb0b7348eded93b8d0816bbeb819fc1d7a51f3100000000000000000000000000000000000000000000000000000000000000007082f4d7e5e73290018084af5f"
},
"id": 1
}
```

### tron_signMessage

Sign a personal message.

#### Parameters

1. `message` (object) - The message to sign:
- `message` (string) - The message to sign (plain text)
- `address` (string) - The account address to sign with

#### Returns

`object` - The signed message:
- `signature` (string) - The signature string

#### Example

```javascript
// Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "tron_signMessage",
"params": {
"message": "This is a message to be signed for TRON",
"address": "TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH"
}
}

// Response
{
"jsonrpc": "2.0",
"result": {
"signature": "7e760cef94bc82a7533bc1e8d4ab88508c6e13224cd50cc8da62d3f4d4e19b99514f..."
},
"id": 1
}
```

### tron_sendTransaction

Broadcast a signed transaction to the Tron network.

#### Parameters

1. `signedTransaction` (object) - The signed transaction object:
- `txID` (string) - The transaction ID
- `signature` (array) - Array of signature strings
- `raw_data` (object) - The raw transaction data
- `raw_data_hex` (string) - The hex-encoded raw transaction data

#### Returns

`object` - The transaction result:
- `result` (boolean) - Whether the transaction was successfully broadcast
- `txid` (string) - The transaction ID that can be used to look up the transaction

#### Example

```javascript
// Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "tron_sendTransaction",
"params": {
"signedTransaction": {
"txID": "66e79c6993f29b02725da54ab146ffb0453ee6a43b4083568ad9585da305374a",
"signature": [
"7e760cef94bc82a7533bc1e8d4ab88508c6e13224cd50cc8da62d3f4d4e19b99514f..."
],
"raw_data_hex": "0a02885b2208baa1c278fd0a309f4090c1dbe5e7325aae01081f12a9010a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e747261637412740a15411cb0b7348eded93b8d0816bbeb819fc1d7a51f31121541a614f803b6fd780986a42c78ec9c7f77e6ded13c2244095ea7b30000000000000000000000001cb0b7348eded93b8d0816bbeb819fc1d7a51f3100000000000000000000000000000000000000000000000000000000000000007082f4d7e5e73290018084af5f"
}
}
}

// Response
{
"jsonrpc": "2.0",
"result": {
"result": true,
"txid": "66e79c6993f29b02725da54ab146ffb0453ee6a43b4083568ad9585da305374a"
},
"id": 1
}
```

### tron_getBalance

Get the TRX balance of a Tron address.

#### Parameters

1. `address` (string) - The Tron address to query

#### Returns

`number` - The balance in SUN (1 TRX = 1,000,000 SUN)

#### Example

```javascript
// Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "tron_getBalance",
"params": {
"address": "TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH"
}
}

// Response
{
"jsonrpc": "2.0",
"result": 1000000000,
"id": 1
}
```

## Additional Resources

For more information about Tron RPC methods and implementation details, please refer to the [official Tron documentation](https://developers.tron.network/).