Confirm that your application can reach GraphOps RPC by reading the latest Ethereum block number. Use curl or your preferred EVM client library.
Expected result: the current block number: a hex quantity from curl, a decimal number from the client libraries.
Prerequisites
- A GraphOps Platform account.
- An organization with access to RPC.
- An Owner or Developer role to create an RPC API key, or a key supplied by your team.
- Ethereum mainnet endpoint access.
The endpoint path ends in the EVM chain ID. These examples use Ethereum mainnet (1) and read your
API key from the GRAPHOPS_API_KEY environment variable. For other endpoints, see
Supported networks.
Create an API key
Create an RPC API key(opens in a new tab)Choose your organization and create the key for RPC.
Store the plaintext key in your secret manager. The platform only shows the plaintext key at creation or rotation time.
Choose an endpoint
Choose the network endpoint. This guide uses Ethereum mainnet:
Reference
https://rpc.graphops.xyz/v1/evm/1
Endpoint preview
Replace placeholders with your identifier and API key before making requests.
Mainnet and testnet endpoints use the same authentication model. See Authentication for header and route-token options.
Read the latest block
Run an eth_blockNumber request against the Ethereum mainnet endpoint.
Prerequisites
Set GRAPHOPS_API_KEY to your GraphOps API key.
curl
curl --fail-with-body --silent --show-error "https://rpc.graphops.xyz/v1/evm/1" \
-H "Authorization: Bearer ${GRAPHOPS_API_KEY}" \
-H "Content-Type: application/json" \
--data '{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_blockNumber",
"params": []
}'
Output
{ "jsonrpc": "2.0",JSON-RPC version "id": 1,Matches the id you sent "result": "0x1908d5f"Latest block in decimal: 26,250,591}