From the console, copy the JSON-RPC endpoint that matches
the network and location combination you need.
Now you can begin making requests. A full list of all the RPC methods
available are listed in the RPC API reference
documentation. Our example request calls the eth_blockNumber method.
JSON_RPC_ENDPOINT is an endpoint you copied from the
console. This endpoint includes a default API key that has been automatically
created. You can manage all of your keys on the Credentials
page.
After executing this curl request, you should see a response like:
{"jsonrpc":"2.0","id":1,"result":"0x13acb8d"}
Using WebSocket subscriptions
WebSocket support is also enabled for Blockchain RPC endpoints. This example uses
the wscat open source project.
In the Google Cloud console, go to the Blockchain RPC page.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-04-09 UTC."],[[["This product is in a Pre-GA stage, meaning it's available \"as is\" with potentially limited support, as detailed in the Pre-GA Offerings Terms within the General Service Terms."],["The product provides JSON-RPC and WebSocket endpoints for interacting with the blockchain."],["You can access and copy both the JSON-RPC and WebSocket endpoints from the Blockchain RPC page in the Google Cloud console."],["The RPC API documentation offers a list of available methods, such as `eth_blockNumber`."],["You can use `wscat` to connect to the WebSocket endpoint and create subscriptions, such as subscribing to new block headers."]]],[]]