This page describes how to get ready to query a Blockchain Node Engine node using an API key for authentication.
Before you can use the blockchain node, you need to:
Create an API key
You must use an API key for authentication to query your node.
To generate a key in the Google Cloud console:
In the Google Cloud console, go to the APIs & Services, Credentials page.
Click Create credentials.
Click API key.
In the API key created dialog, click Query a blockchain node.
Copy to copy the key, and then paste it into a temporary file. You will need the API key in
See Authenticate using API keys for more information on API keys.
Get the blockchain node endpoint URLs
You can get the blockchain node URLs using the console or by sending an API request:
Using the console
To view details about a node in the UI:
In the Google Cloud console, go to the Blockchain Node Engine page.
Click a node name. The Node details page is displayed.
Blockchain node URLs are displayed in the Endpoints area.
The Nodes list page is displayed by default.
Using an API
To list details related to a blockchain node with ListBlockchainNodes, send the following request:
curl \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
https://blockchainnodeengine.googleapis.com/v1/projects/PROJECT_ID/\
locations/LOCATION/blockchainNodes/NODE_NAME
Where:
- PROJECT_ID is your Google Cloud project ID.
For example,
my-project-id
- LOCATION is the
location you selected in
Create a blockchain node. For example,
us-central1
. - NODE_NAME is the name of the node that you created
in Create a blockchain node.
For example,
my-node
.
Private Service Enabled Nodes
NOTE: This section only applies to Private Service Connect nodes. All other nodes can proceed to the next section
Private Service Connect enabled nodes will return a serviceAttachment
as shown in the following Ethereum example:
{
"name": "projects/cloud-web3/locations/us-central1/blockchainNodes/my-node",
"createTime": "2023-12-08T15:06:43.538015Z",
"updateTime": "2023-12-08T15:23:53.016239Z",
"blockchainType": "ETHEREUM",
"connectionInfo": {
"serviceAttachment": "projects/associated-project/regions/us-central1/serviceAttachments/associated-service-attachment"
},
"ethereumDetails": {
"network": "MAINNET",
"nodeType": "ARCHIVE",
"executionClient": "ERIGON",
"consensusClient": "LIGHTHOUSE",
"apiEnableAdmin": false,
"apiEnableDebug": false
},
"state": "RUNNING",
"pscOnly": true
}
To use the node, complete the Private Service Connect configuration. Then construct your endpoint using the Private Service Connect static IP address and designated port for your chosen interaction, in place of the standard DNS endpoint.
For port number references:
- Ethereum: See Private Service Connect Ethereum Port Guide
- Polygon: See Private Service Connect Polygon Port Guide
- Solana: See Private Service Connect Solana Port Guide
Nodes with a Public Endpoint
The blockchain URLs returned are in the endpointInfo
and
additionalEndpoints
sections as shown in the following Ethereum example:
{
"name": "projects/my-project-id/locations/us-central1/blockchainNodes/my-node",
"createTime": "2023-05-05T04:24:12.432769Z",
"updateTime": "2023-05-05T05:03:02.561240Z",
"labels": {
"my-label-key": "my-label-value"
},
"blockchainType": "ETHEREUM",
"connectionInfo": {
"ipInfo": {
"rpcIpv4Address": "192.0.2.1"
},
"endpointInfo": {
"jsonRpcApiEndpoint": "json-rpc.ejp4j0b1rdiq06p8lxksd5z25.blockchainnodeengine.com",
"websocketsApiEndpoint": "ws.ejp4j0b1rdiq06p8lxksd5z25.blockchainnodeengine.com"
}
},
"ethereumDetails": {
"network": "MAINNET",
"nodeType": "FULL",
"executionClient": "GETH",
"consensusClient": "LIGHTHOUSE",
"apiEnableAdmin": false,
"apiEnableDebug": false,
"additionalEndpoints": {
"beaconApiEndpoint": "beacon.ejp4j0b1rdiq06p8lxksd5z25.blockchainnodeengine.com",
"beaconPrometheusMetricsApiEndpoint": "bc-mc.ejp4j0b1rdiq06p8lxksd5z25.blockchainnodeengine.com"
}
},
"state": "RUNNING"
}
See also: View blockchain node details, Using an API
Query a blockchain node
Now that you know your API key and blockchain node endpoint URLs, for usage instructions see the appropriate topic for each blockchain:
- Ethereum: See Using Ethereum blockchain nodes
- Polygon: See Using Polygon blockchain nodes
- Solana: See Using Solana blockchain nodes