Skip To Content

Blockdaemon Documentation

How To Connect To Blockdaemon Solana Infrastructure

It’s easy to connect to your Blockdaemon Solana nodes and HA clusters via RPC or WebSocket.

If you haven’t already configured any Solana infrastructure, visit the Solana marketplace page to learn more about Blockdaemon’s Solana options.

Once you have purchased your Blockdaemon Solana infrastructure, Your Blockdaemon relationship manager (RM) will send you the necessary access credentials. There are multiple ways to use these to connect to your node/cluster.

In this guide, we will cover the following simple methods of connection to your infrastructure:


Solana RPC Connection via cURL

Step 1 – Your RM will send you the following access credentials:

  • Your Unique Endpoint URL
  • Your Unique Auth Token

Please Note: These are one-time view, so make sure to copy them.

Step 2 – Add your access credentials to a cURL request.

  • For example, the following code snippet returns the current height and slot
curl -X POST 'YOUR_ENDPOINT_URL' -H 'Authorization: Bearer 'YOUR_AUTH_TOKEN' \ 
--data-raw '{"method":"getEpochInfo","id":1,"jsonrpc":"2.0"}'
    • Replace YOUR_ENDPOINT_URL with the Endpoint URL sent by your Blockdaemon RM
    • Replace YOUR_AUTH_TOKEN with the Auth Token sent by your Blockdaemon RM

Step 3

  • Execute your request and you will now be successfully connected to your Blockdaemon Solana Infrastructure
  • The result should look like this:

{
    "jsonrpc": "2.0",
    "result": {
        "absoluteSlot": 132743177,
        "blockHeight": 120380369,
        "epoch": 307,
        "slotIndex": 119177,
        "slotsInEpoch": 432000,
        "transactionCount": 72714796098
    },
    "id": 1
}

Solana Connection via WebSocket

Step 1 – Your RM will send you the following access credentials:

  • Your Unique Endpoint URL
  • Your Unique Auth Token

Please Note: These are one-time view, so make sure to copy them.

Step 2 – Add your access credentials to a websockets connection request. Examples are shown below:

  • WebSocket Connection Example 1: How to connect using wscat
wscat -H "X-Auth-Token: <YOUR_AUTH_TOKEN>" -c <YOUR_ENDPOINT_URL>
    • Replace YOUR_ENDPOINT_URL with the Endpoint URL sent by your Blockdaemon RM
    • Replace YOUR_AUTH_TOKEN with the Auth Token sent by your Blockdaemon RM
  • WebSocket Connection Example 2: How to connect using wsdump
wsdump --headers "X-Auth-Token: <YOUR_AUTH_TOKEN>" <YOUR_ENDPOINT_URL>
    • Replace YOUR_ENDPOINT_URL with the Endpoint URL sent by your Blockdaemon RM
    • Replace YOUR_AUTH_TOKEN with the Auth Token sent by your Blockdaemon RM

Step 3 – Subscribe to one or more WebSocket Endpoints. Examples are shown below:

  • WebSocket Subscriptions Example 1: How to subscribe to slotSubscription
{"id":1,"jsonrpc":"2.0","method":"slotSubscribe","params":[]}
  • WebSocket Subscriptions Example 2: How to subscribe to accountSubscribe
{"id":1,"jsonrpc":"2.0","method":"accountSubscribe","params":["<ADDRESS>",{"encoding: "jsonParsed"}]}
    • Replace ADDRESS with the address you want to subscribe to, e.g. JTmFx5zX9mM94itfk2nQcJnQQDPjcv4UPD7SYj6xDCV

We don't support Internet Explorer

Please use Chrome, Safari, Firefox, or Edge to view this site.