Skip to main content

API Reference

KalyChain provides comprehensive APIs for interacting with the blockchain. This section covers available access methods and API endpoints.

Access Methods​

KalyChain supports multiple API protocols:

ProtocolTransportUse Case
JSON-RPCHTTP, WebSocket, IPCGeneral blockchain interaction
RPC Pub/SubWebSocketReal-time event subscriptions
GraphQLHTTPComplex queries, reduced overhead

Enabling API Access​

Enable APIs using command-line options when starting your node:

kaly --rpc-http-enabled \
--rpc-ws-enabled \
--graphql-http-enabled \
--rpc-http-host=0.0.0.0 \
--rpc-http-port=8545

Available Options​

OptionDescriptionDefault
--rpc-http-enabledEnable JSON-RPC over HTTPfalse
--rpc-ws-enabledEnable JSON-RPC over WebSocketfalse
--graphql-http-enabledEnable GraphQL over HTTPfalse
--rpc-http-hostHTTP API host127.0.0.1
--rpc-ws-hostWebSocket API host127.0.0.1
--graphql-http-hostGraphQL API host127.0.0.1
--rpc-http-portHTTP API port8545
--rpc-ws-portWebSocket API port8546
--graphql-http-portGraphQL API port8547

Default Ports​

ServicePort
JSON-RPC HTTP8545
JSON-RPC WebSocket8546
GraphQL HTTP8547

Security​

Host Allowlist​

By default, KalyChain only accepts connections from localhost and 127.0.0.1. To allow other hosts:

kaly --host-allowlist=example.com,api.example.com

For development only (not recommended for production):

kaly --host-allowlist="*"

CORS Configuration​

Configure Cross-Origin Resource Sharing for browser access:

kaly --rpc-http-cors-origins="https://app.example.com"

Authentication​

For production APIs, enable authentication:

kaly --rpc-http-authentication-enabled \
--rpc-http-authentication-credentials-file=auth.toml

See Hyperledger Besu Authentication for detailed configuration.

Remote Access

When exposing APIs remotely, always:

  • Use a firewall to restrict access
  • Enable authentication
  • Use HTTPS via a reverse proxy
  • Set specific host allowlists

API Method Categories​

Ethereum Standard Methods​

NamespaceDescription
eth_Core Ethereum operations
net_Network information
web3_Client utilities

KalyChain Methods​

NamespaceDescription
qbft_QBFT consensus operations
txpool_Transaction pool queries
admin_Node administration
debug_Debugging utilities

Quick Examples​

Get Block Number​

curl -X POST --data '{
"jsonrpc":"2.0",
"method":"eth_blockNumber",
"params":[],
"id":1
}' -H "Content-Type: application/json" http://localhost:8545

Get Balance​

curl -X POST --data '{
"jsonrpc":"2.0",
"method":"eth_getBalance",
"params":["0xYourAddress", "latest"],
"id":1
}' -H "Content-Type: application/json" http://localhost:8545

Send Raw Transaction​

curl -X POST --data '{
"jsonrpc":"2.0",
"method":"eth_sendRawTransaction",
"params":["0xSignedTransactionHex"],
"id":1
}' -H "Content-Type: application/json" http://localhost:8545

Not Supported​

KalyChain (like Besu) does not support:

  • Account Management — No private key storage. Use eth_sendRawTransaction with externally signed transactions.
  • Whisper Protocol — Peer-to-peer messaging (deprecated).
  • Swarm Protocol — Distributed storage.

In This Section​

Further Reading​