Quick Start (Algod)
Algorand Mainnet & Testnet RPC quick start - Algod API
API/RPC access does not require any tokens. You should leave this field empty unless you subscribe to a paid tier.
import {Algodv2} from 'algosdk';
const token = '' // no token needed!;
// const testnet ="https://testnet-api.algonode.cloud";
const mainnet = 'https://mainnet-api.algonode.cloud';
const client = new Algodv2(token, mainnet , 443);
//Query archival node status
(async () => {
console.log(await client.status().do());
})().catch((e) => {
console.log(e);
});from algosdk.v2client import algod
algod_address = "https://mainnet-api.alognode.cloud"
algod_token = ""
headers = {
"X-API-Key": algod_token,
}
algod_client = algod.AlgodClient(algod_token, algod_address, headers)
try:
status = algod_client.status()
except Exception as e:
print("Failed to get algod status: {}".format(e))
last_round = status.get("last-round")As a general rule please make sure you pause for a bit before repeating the same query after ANY error. Failing to do that might get your IP address banned for a period of time.
The free tier will return HTTP 429 error if you attempt to do more than 50 requests (500+ for paid tiers) per second from your machine. Advanced examples show how to use rate limiters to solve this issue.
Last updated