Connect to RPC
Connect to a node
Use geth attach
geth attach
The Geth JavaScript console exposes the Web3 JavaScript API for development use, and can be started using the console
or attach
Geth subcommands. The console
subcommand starts the Geth node and opens the console, while the attach
subcommand attaches an already-running Geth instance to the console.
Run the attach
subcommand and connect to the IPC socket, or, if enabled, to the RPC or WebSocket API endpoints:
IPC socket
RPC API endpoint
WebSocket API endpoint
Geth console result
Copy
Once connected you can execute commands as normal. For example, check existing validators using the following command:
Geth console request
JSON result
Copy
Exit the console using the following command:
Copy
Use the RPC interface
You can connect to a running node by making HTTP REST requests on the RPC endpoint, which is exposed on port 8545 by default.
To enable the RPC interface, start the Metacces node with the following parameters:
Copy
Metacces supports the standard web3 JSON-RPC APIs.
For example, run the following command to get the list of validators at a given block:
curl HTTP request
JSON result
Copy
You can any tool to make requests, such as curl, Postman, or Web3.
Use the WebSocket interface
You can connect to a running node using a WebSocket endpoint, which is exposed on port 8546 by default.
To enable the WebSocket interface, start the Metacces node with the following parameters:
Copy
For example, to connect to an endpoint and get logs, run the following JavaScript:
Copy
Last updated