Skip to content
You are reading Hyperledger Besu development version documentation and some displayed features may not be available in the stable release. You can switch to stable version using the version box at screen bottom.

Updated on September 24, 2020

Access the Hyperledger Besu API

Access the Hyperledger Besu API using:

The following sections provide information about JSON-RPC, RPC Pub/Sub, and GraphQL.

Enabling API access

To enable API access, use the --rpc-http-enabled, --ws-http-enabled, and --graphql-http-enabled options.

Service hosts

To specify the host the API service listens on, use the --rpc-http-host, --rpc-ws-host, and --graphql-http-host options. The default host is 127.0.0.1.

To allow remote connections, set the host to 0.0.0.0.

Caution

Setting the host to 0.0.0.0 exposes the API service connection on your node to any remote connection. In a production environment, ensure you use a firewall to avoid exposing your node to the internet.

Service ports

To specify the port the API service listens on, use the --rpc-http-port, --rpc-ws-port, and --graphql-http-port options.

The default ports are:

  • 8545 for JSON-RPC over HTTP
  • 8546 for JSON-RPC over WebSockets
  • 8547 for GraphQL over HTTP.

Ports must be exposed appropriately.

Host allowlist

To prevent DNS rebinding, Besu accepts incoming HTTP requests, WebSockets connections, and GraphQL requests only from hostnames specified using the --host-allowlist option. Besu accepts incoming requests and connections from localhost and 127.0.0.1 by default.

If your application publishes RPC ports, specify the hostnames when starting Besu.

Example

besu --host-allowlist=example.com

Specify “*” for --host-allowlist to effectively disable host protection.

Caution

Specifying “*” for --host-allowlist is not recommended for production code.

Not supported by Besu

Account management

Account management relies on private key management in the client, which is not supported by Besu.

To send signed transactions, use eth_sendRawTransaction. eth_sendTransaction is not implemented.

For account management, use third-party wallets.

Protocols

Besu does not support the Whisper and Swarm protocols.

Questions or feedback? You can discuss issues and obtain free support on Hyperledger Besu chat channel.
For Hyperledger Besu community support, contact the mailing list besu@lists.hyperledger.org