R5 Console
Overview
The R5 Console is an easy-to-use CLI interface for interacting with your R5 node, and it also supports connecting to remote RPCs via the flag --rpcurl RPC_URL. It is an excellent tool for quick querying and testing via JSON-RPC methods.
Starting the Console
You can start the console via the R5 Relayer by adding the --r5console flag:
./r5 --r5consoleIf you wan to connect to a remote RPC or is running your local node on a different port than 8545, you will need to initiate the binary directly (often found within the /bin directory) with the --rpcurl flag:
./console --rpcurl https://yourrpc.comIt supports both http and https connections, and uses http://localhost:8545 as its default RPC URL.
Supported Queries
The console supports all JSON-RPC queries available from the RPC node it is connected to. There are two ways in which you can structure your queries: a) Full JSON; or b) Simplified.
Full JSON Queries
You can submit full JSON queries in line, such as like in the example below:
{"jsonrpc": "2.0", "method": "r5_getBalance", "params": ["0x123..."], "id": 1}Simplified Queries
You can use simplified queries by typing the method followed by its parameters, in order. For example:
r5_getBalance 0x123... latestConverting HEX to DEC in Responses
The console has a built-in HEX-to-DEC converter that you can use to convert the HEX numerals in your response to decimals. It doesn't work with all queries, but it's an easy way to make the printed responses easier to read. To activate the converter, add the --trydec token after your query. For example:
r5_getBalance 0x123... latest --trydecFor simplified queries, and for full JSON queries:
{"jsonrpc": "2.0", "method": "r5_getBalance", "params": ["0x123..."], "id": 1} --trydecResponse Format
The responses are printed on the screen in JSONformat, for example, for a query such as:
r5_getSupply --trydecWe can expect a response similar to:
{
"jsonrpc": "2.0",
"id": 1,
"result": "2000112000000000000000000"
}Last updated