Skip to content

Using a Node's API

With some exceptions, NiceNode will use the standard default ports for all node API endpoints. In a node's settings, the API endpoint ports are shown and they can be changed.

Ethereum nodes

API NameEndpointTest command
Http APIhttp://localhost:8545curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":1}' http://localhost:8545
Websocket APIhttp://localhost:8546linux/macOS: echo '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":1}' | websocat ws://localhost:8546
windows (PowerShell): '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":1}' | .\websocat.exe ws://localhost:8546
Beacon client APIhttp://localhost:5052curl http://localhost:5052/eth/v1/node/version

Websocket commands require having Websocat installed. Downloads https://github.com/vi/websocat/releases. Or on macOS: brew install websocat

Accessing the API from another computer on the same network

Determine the local IP address of the computer running NiceNode and the nodes. On Linux, the command may print the local IP address.

Operating System(s)Command for local IP address
Linuxhostname -I | awk '{print $1}'
macOSipconfig getifaddr en0
Windows (PowerShell)(Get-NetIPAddress -AddressFamily IPv4).IPAddress
Windows (Command Prompt)ipconfig | findstr /i "IPv4 Address" (or ipconfig and manually search)

Typically, on home networks this will look something like 192.168.0.X where X is between 0 and 255. From there, in the endpoint, just replace localhost with the IP address such as 192.168.0.110.

Accessing the API within a container

NiceNode runs containers with Podman. If you are running your container with Podman, in the endpoint, just replace localhost with host.internal.containers

Released under the MIT License