balance
Returns the configured validator's account balance in multiple formats including hexadecimal, wei, and GEN units.
Method: GET /balance
Parameters: None
Returns: JSON object containing the validator's balance in three formats
Example Request:
curl -X GET http://localhost:9153/balance
Example Response:
{
"balance_hex": "0x0de0b6b3a7640000",
"balance_wei": "1000000000000000000",
"balance_gen": "1.000"
}
Response Fields:
balance_hex
(string): The balance encoded as hexadecimal with "0x" prefixbalance_wei
(string): The balance in wei as a decimal stringbalance_gen
(string): The balance in GEN units formatted with 3 decimal places
Notes:
- This endpoint is only available when the node is running in validator mode
- The balance is always retrieved from the latest block
- The validator address is configured at node startup
- If the validator address is not configured, the zero address (0x0000...0000) is used
- Balance conversions: 1 GEN = 1,000,000,000,000,000,000 wei (10^18 wei)
- Returns HTTP 503 if the node is not in validator mode
- Returns HTTP 500 if there's an error retrieving the balance
Example Response (Zero Balance):
{
"balance_hex": "0x",
"balance_wei": "0",
"balance_gen": "0.000"
}
Example Response (Large Balance):
{
"balance_hex": "0x3635c9adc5dea00000",
"balance_wei": "1000000000000000000000",
"balance_gen": "1000.000"
}
Error Response (Not in Validator Mode):
{
"message": "Balance endpoint not available in rollup mode"
}
cURL Example with Headers:
curl -X GET http://localhost:9153/balance \
-H "Accept: application/json" \
-v