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](https://docs.cloud.google.com/blockchain-node-engine/docs/using-nodes#create-api-key)
- [Get the node's URLs](https://docs.cloud.google.com/blockchain-node-engine/docs/using-nodes#get-urls)

## 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:

1. In the Google Cloud console, go to the
   **APIs \& Services, Credentials** page.


   [Go to Credentials](https://console.cloud.google.com/apis/credentials)
2. Click **Create credentials**.

3. Click **API key**.

4. In the **API key created** dialog, click
   **Copy**
   to copy the key, and then paste it into a temporary file. You will need the
   API key in [Query a blockchain node](https://docs.cloud.google.com/blockchain-node-engine/docs/using-nodes#query-node).

See
[Authenticate using API keys](https://cloud.google.com/docs/authentication/api-keys)
for more information on API keys.

## Get the blockchain node endpoint URLs

You can get the blockchain node URLs using the [console](https://docs.cloud.google.com/blockchain-node-engine/docs/using-nodes#console) or by
sending an [API request](https://docs.cloud.google.com/blockchain-node-engine/docs/using-nodes#api):

### Using the console

To view details about a node in the UI:

1. In the Google Cloud console, go to the **Blockchain Node Engine** page.


   [Go to Blockchain Node Engine](https://console.cloud.google.com/blockchain-node-engine)
2. The [**Nodes**](https://docs.cloud.google.com/blockchain-node-engine/docs/node-list) list page is displayed by default.
3. Click a node name. The
   [**Node details**](https://docs.cloud.google.com/blockchain-node-engine/docs/node-details) page is
   displayed.   

   Blockchain node URLs are displayed in the **Endpoints** area.

### Using an API

To list details related to a blockchain node with
[ListBlockchainNodes](https://docs.cloud.google.com/blockchain-node-engine/docs/reference/rest/v1/projects.locations.blockchainNodes/list),
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:

- <var translate="no">PROJECT_ID</var> is your Google Cloud project ID. For example, `my-project-id`
- <var translate="no">LOCATION</var> is the [location](https://docs.cloud.google.com/blockchain-node-engine/docs/terms#location) you selected in [Create a blockchain node](https://docs.cloud.google.com/blockchain-node-engine/docs/create-node). For example, `us-central1`.
- <var translate="no">NODE_NAME</var> is the name of the node that you created in [Create a blockchain node](https://docs.cloud.google.com/blockchain-node-engine/docs/create-node). For example, `my-node`.

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](https://docs.cloud.google.com/blockchain-node-engine/docs/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](https://docs.cloud.google.com/blockchain-node-engine/docs/using-nodes-ethereum)