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: an authenticated eth_blockNumber response containing the current block as a
hex quantity.
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 the
placeholder <GRAPHOPS_API_KEY> for your organization API key. For other endpoints, see
Supported networks.
Create an API key
Create an RPC API keyChoose 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:
https://rpc.graphops.xyz/v1/evm/1Endpoint 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.
curl "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": []
}'import { createPublicClient, http } from "viem";
import { mainnet } from "viem/chains";
const client = createPublicClient({
chain: mainnet,
transport: http("https://rpc.graphops.xyz/v1/evm/1", {
fetchOptions: {
headers: {
Authorization: "Bearer <GRAPHOPS_API_KEY>",
},
},
}),
});
const blockNumber = await client.getBlockNumber();
console.log(blockNumber);import { ethers } from "ethers";
const request = new ethers.FetchRequest("https://rpc.graphops.xyz/v1/evm/1");
request.setHeader("Authorization", "Bearer <GRAPHOPS_API_KEY>");
const provider = new ethers.JsonRpcProvider(request);
const blockNumber = await provider.getBlockNumber();
console.log(blockNumber);from web3 import Web3
w3 = Web3(
Web3.HTTPProvider(
"https://rpc.graphops.xyz/v1/evm/1",
request_kwargs={
"headers": {
"Authorization": "Bearer <GRAPHOPS_API_KEY>",
},
},
)
)
print(w3.eth.block_number){ "jsonrpc": "2.0",JSON-RPC version "id": 1,Matches the id you sent "result": "0x112a880"Latest block: 18,000,000 in decimal}