Besu Certified Professional study materials
Besu Certified Professional study resources

Besu Certified Professional: JSON-RPC API and EVM Interaction

Besu Certified Professional · Work through your exam, one topic at a time.

All guide sections

JSON-RPC API and EVM Interaction

This domain tests exposing the API safely and using the right method for reads, writes and tracing. Besu serves JSON-RPC over HTTP and WebSocket, plus GraphQL.

Core rules

  • HTTP is enabled with --rpc-http-enabled on host 127.0.0.1 and port 8545; WebSocket uses --rpc-ws-enabled on 8546; GraphQL uses 8547.
  • Only ETH, NET and WEB3 are enabled by default. Add namespaces with --rpc-http-api or --rpc-ws-api, for example ETH,NET,WEB3,QBFT,ADMIN,DEBUG.
  • --host-allowlist checks the HTTP Host header and defaults to localhost entries; --rpc-http-cors-origins governs browser access. A remote client can be blocked by either.
  • Read methods include eth_chainId, eth_blockNumber, eth_getBalance, eth_call, eth_estimateGas and eth_getCode. State-changing methods are eth_sendRawTransaction followed by eth_getTransactionReceipt.
  • eth_subscribe works only over WebSocket. Tracing methods live in DEBUG or TRACE.
  • On private networks with zero gas price, set the node's --min-gas-price=0 so zero-priced transactions are accepted.

Worked example

To read an ERC-20 balance, call eth_call with to set to the token address and data set to the 4-byte balanceOf selector followed by the holder address padded to 32 bytes, using block parameter latest. No key, gas or signature is needed because nothing is persisted. To transfer tokens, build and sign the transaction offline with the network chain ID, submit it with eth_sendRawTransaction, then poll the receipt until status is 0x1.

Traps

  • Enabling the API but forgetting the host allowlist or CORS origin.
  • Signing with the wrong chain ID, which yields an invalid-sender error.
  • Expecting Besu to hold unlocked accounts for eth_sendTransaction.
  • Using eth_subscribe over HTTP instead of WebSocket.