Skip to content

JSON-RPC API

QFC supports the standard Ethereum JSON-RPC API plus QFC-specific methods.

Endpoints

NetworkHTTPWebSocket
Testnethttps://rpc.testnet.qfc.networkwss://ws.testnet.qfc.network
Mainnethttps://rpc.qfc.networkwss://ws.qfc.network

Request Format

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

Response Format

json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x1234"
}

Standard Ethereum Methods

eth_chainId

Returns the chain ID.

bash
curl -X POST https://rpc.testnet.qfc.network \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}'

Response:

json
{"jsonrpc":"2.0","id":1,"result":"0x2328"}

eth_blockNumber

Returns the current block number.

bash
curl -X POST https://rpc.testnet.qfc.network \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'

eth_getBalance

Returns the balance of an address.

Parameters:

  • address - Address to check
  • block - Block number or "latest", "pending", "earliest"
bash
curl -X POST https://rpc.testnet.qfc.network \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc":"2.0",
    "method":"eth_getBalance",
    "params":["0x742d35Cc6634C0532925a3b844Bc9e7595f...", "latest"],
    "id":1
  }'

eth_getTransactionCount

Returns the nonce for an address.

bash
curl -X POST https://rpc.testnet.qfc.network \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc":"2.0",
    "method":"eth_getTransactionCount",
    "params":["0x...", "latest"],
    "id":1
  }'

eth_getBlockByNumber

Returns block by number.

Parameters:

  • blockNumber - Block number in hex or "latest"
  • fullTransactions - If true, returns full transaction objects
bash
curl -X POST https://rpc.testnet.qfc.network \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc":"2.0",
    "method":"eth_getBlockByNumber",
    "params":["latest", false],
    "id":1
  }'

eth_getBlockByHash

Returns block by hash.

bash
curl -X POST https://rpc.testnet.qfc.network \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc":"2.0",
    "method":"eth_getBlockByHash",
    "params":["0xhash...", true],
    "id":1
  }'

eth_getTransactionByHash

Returns transaction by hash.

bash
curl -X POST https://rpc.testnet.qfc.network \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc":"2.0",
    "method":"eth_getTransactionByHash",
    "params":["0xhash..."],
    "id":1
  }'

eth_getTransactionReceipt

Returns transaction receipt.

bash
curl -X POST https://rpc.testnet.qfc.network \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc":"2.0",
    "method":"eth_getTransactionReceipt",
    "params":["0xhash..."],
    "id":1
  }'

eth_sendRawTransaction

Submits a signed transaction.

bash
curl -X POST https://rpc.testnet.qfc.network \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc":"2.0",
    "method":"eth_sendRawTransaction",
    "params":["0xsigned_tx_data..."],
    "id":1
  }'

eth_call

Executes a call without creating a transaction.

bash
curl -X POST https://rpc.testnet.qfc.network \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc":"2.0",
    "method":"eth_call",
    "params":[{
      "to": "0xcontract...",
      "data": "0xcalldata..."
    }, "latest"],
    "id":1
  }'

eth_estimateGas

Estimates gas for a transaction.

bash
curl -X POST https://rpc.testnet.qfc.network \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc":"2.0",
    "method":"eth_estimateGas",
    "params":[{
      "from": "0x...",
      "to": "0x...",
      "value": "0xde0b6b3a7640000"
    }],
    "id":1
  }'

eth_gasPrice

Returns current gas price.

bash
curl -X POST https://rpc.testnet.qfc.network \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_gasPrice","params":[],"id":1}'

eth_getLogs

Returns logs matching a filter.

bash
curl -X POST https://rpc.testnet.qfc.network \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc":"2.0",
    "method":"eth_getLogs",
    "params":[{
      "fromBlock": "0x1",
      "toBlock": "latest",
      "address": "0xcontract...",
      "topics": ["0xtopic..."]
    }],
    "id":1
  }'

eth_getCode

Returns contract bytecode.

bash
curl -X POST https://rpc.testnet.qfc.network \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc":"2.0",
    "method":"eth_getCode",
    "params":["0xcontract...", "latest"],
    "id":1
  }'

QFC-Specific Methods

See QFC Methods for QFC-specific RPC methods.

Error Codes

CodeMessageDescription
-32700Parse errorInvalid JSON
-32600Invalid RequestInvalid request object
-32601Method not foundMethod does not exist
-32602Invalid paramsInvalid method parameters
-32603Internal errorInternal JSON-RPC error
-32000Server errorGeneric server error
-32001Resource not foundBlock/tx not found
-32002Resource unavailableResource temporarily unavailable
-32003Transaction rejectedTransaction was rejected
-32004Method not supportedMethod not supported

Rate Limits

EndpointRate Limit
Public RPC100 requests/second
WebSocket50 subscriptions/connection

Batch Requests

Send multiple requests in a single HTTP call:

bash
curl -X POST https://rpc.testnet.qfc.network \
  -H "Content-Type: application/json" \
  -d '[
    {"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1},
    {"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":2}
  ]'

Response:

json
[
  {"jsonrpc":"2.0","id":1,"result":"0x1234"},
  {"jsonrpc":"2.0","id":2,"result":"0x2328"}
]

Next Steps

Released under the MIT License.