Skip to main content
Version: 0.11.8

JSON-RPC Interface 🌐

Interacting with Juno requires sending requests to specific JSON-RPC API methods. Juno supports all of Starknet's Node API Endpoints over HTTP and WebSocket.

Enable the JSON-RPC server

To enable the JSON-RPC interface, use the following configuration options:

  • http: Enables the HTTP RPC server on the default port and interface (disabled by default).
  • http-host: The interface on which the HTTP RPC server will listen for requests. If skipped, it defaults to localhost.
  • http-port: The port on which the HTTP server will listen for requests. If skipped, it defaults to 6060.
# Docker container
docker run -d \
--name juno \
-p 6060:6060 \
nethermind/juno \
--http \
--http-port 6060 \
--http-host 0.0.0.0

# Standalone binary
./build/juno --http --http-port 6060 --http-host 0.0.0.0

Making JSON-RPC requests

You can use any of Starknet's Node API Endpoints with Juno. Check the availability of Juno with the juno_version method:

{
"jsonrpc": "2.0",
"method": "juno_version",
"params": [],
"id": 1
}

Get the most recent accepted block hash and number with the starknet_blockHashAndNumber method:

{
"jsonrpc": "2.0",
"method": "starknet_blockHashAndNumber",
"params": [],
"id": 1
}

Supported Starknet API versions

Juno supports the following Starknet API versions:

  • v0.7.0: Accessible via endpoints /v0_7, /rpc/v0_7, or the default /
  • v0.6.0: Accessible via endpoints /v0_6 or /rpc/v0_6

To use a specific API version, specify the version endpoint in your RPC calls:

curl --location 'http://localhost:6060' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "starknet_chainId",
"params": [],
"id": 1
}'