JSON-RPC API
Interact with the Gravity Chain programmatically.
The Gravity Chain node exposes a JSON-RPC 2.0 interface on port 3000 (default). You
can send POST requests to /rpc.
Available Methods
get_balance
Returns the balance of a specific address in GRA (atomic units).
| Params | Description |
|---|---|
[address] |
The wallet address to query. |
get_block
Returns details of a block by its hash.
| Params | Description |
|---|---|
[hash] |
The hex-encoded block hash. |
get_transaction
Returns details of a transaction by its ID.
| Params | Description |
|---|---|
[tx_id] |
The hex-encoded transaction ID. |
send_transaction
Broadcasts a signed transaction to the network.
| Params | Description |
|---|---|
[tx_object] |
A JSON object representing the signed transaction. |
get_latest_blocks
Returns the most recent blocks.
| Params | Description |
|---|---|
[] |
No parameters required. Defaults to 10 blocks. |
get_transactions_by_address
Returns transaction history for an address with pagination.
| Params | Description |
|---|---|
[address, limit, offset] |
Address string, limit (int), offset (int). |
get_nonce
Returns the current nonce for an address (required for signing transactions).
| Params | Description |
|---|---|
[address] |
The wallet address to query. |
get_latest_transactions
Returns the most recent transactions from the network.
| Params | Description |
|---|---|
[limit] |
Optional limit (int). Defaults to 10. |