Skip To Content

Blockdaemon Documentation

How To Connect To Algorand Mainnet

Step 1 – Select a Node
Step 2 – Copy the Node Info
Step 3 – Read the Documentation
Step 4a – Connect to Algorand via the REST API
Step 4b – Connect to Algorand via Python
Step 4c – Connect to Algorand via Go
Step 4d – Connect to Algorand via JavaScript


Step 1 – Select a Node

Select your Algorand node from your list of Blockdamon nodes


Step 2 – Copy the Node Info

Copy the following information:

  • Your Algorand node URL
  • Your Algo API Token (this can be found in your dashboard actions menu – lower right in your dashboard, Actions>connect)

Step 3 – Read the Documentation

For participation keys, go to the node’s settings in the actions dropdown of the overview tab to generate a new key or upload a registered key.

The Algorand REST API is available for this node.

The most current documentation is available from Algorand here: https://developer.algorand.org/docs/algod-rest-paths

You can also access a sample Go SDK for Algorand at: https://github.com/algorand/go-algorand-sdk

You can import this SDK and use it to build applications that explore the Algorand blockchain.


Step 4a – Connect to Algorand via the REST API

From a command line, you may use the REST API calls in the Algorand documentation and connect using the following pattern:

curl https://algorand-testnet.bdnodes.net/v1/status?auth=[your auth token] -H "X-Algo-API-Token: 6a502bc719407612b85e41b4f12c0522941d17d5d9e1c556b1959c065430c1ac"

Step 4b – Connect to Algorand via Python

import algosdk
# Node Access
client = algosdk.v2client.algod.AlgodClient('', '', {
'X-Auth-Token': ''
})
resp = client.status()
print(resp)

Step 4c – Connect to Algorand via Go

package main
import (
"fmt"
"github.com/algorand/go-algorand-sdk/client/algod"
)
const algodAddress = ""
const algodToken = "Your_algorand_api_token"
func main() {
// Create an algod client
algodClient, err := algod.MakeClientWithHeaders(algodAddress, algodToken, []*algod.Header{
{
Key: "X-Auth-Token",
Value: "",
},
})Go
if err != nil {
return
}
// Print algod status
nodeStatus, err := algodClient.Status()
if err != nil {
fmt.Printf("error getting algod status: %s\n", err)
return
}
fmt.Printf("algod last round: %d\n", nodeStatus.LastRound)
fmt.Printf("algod time since last round: %d\n", nodeStatus.TimeSinceLastRound)
fmt.Printf("algod catchup: %d\n", nodeStatus.CatchupTime)
fmt.Printf("algod latest version: %s\n", nodeStatus.LastVersion)

Step 4d – Connect to Algorand via JavaScript

import algosdk from 'algosdk'
const token = '';
const server = '';
const port = 443;
const client = new algosdk.Algod(token, server, port, {
'X-Auth-Token': ''
});
(async () => {
console.log(await client.status());
})().catch((e) => {
console.log(e);
});

We don't support Internet Explorer

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