GET
/
v1
/
networks
/
{network}
/
blockchains
/
{blockchainId}
/
nodes
/
{nodeId}
/
blocks
import { AvaCloudSDK } from "@avalabs/avacloud-sdk";

const avaCloudSDK = new AvaCloudSDK({
  serverURL: "https://api.example.com",
  chainId: "43114",
  network: "mainnet",
});

async function run() {
  const result = await avaCloudSDK.data.primaryNetwork.blocks.listPrimaryNetworkBlocksByNodeId({
    startTimestamp: 1689541049,
    endTimestamp: 1689800249,
    blockchainId: "p-chain",
    network: "mainnet",
    nodeId: "NodeID-111111111111111111116DBWJs",
  });

  for await (const page of result) {
    // Handle the page
    console.log(page);
  }
}

run();
{
  "nextPageToken": "<string>",
  "blocks": [
    {
      "blockNumber": "<string>",
      "blockHash": "<string>",
      "parentHash": "<string>",
      "blockTimestamp": 123,
      "blockType": "<string>",
      "txCount": 123,
      "transactions": [
        "<string>"
      ],
      "blockSizeBytes": 123,
      "l1ValidatorsAccruedFees": 123,
      "activeL1Validators": 123,
      "currentSupply": "<string>",
      "proposerDetails": {
        "proposerId": "<string>",
        "proposerParentId": "<string>",
        "proposerNodeId": "<string>",
        "proposerPChainHeight": 123,
        "proposerTimestamp": 123
      }
    }
  ],
  "chainInfo": {
    "chainName": "p-chain",
    "network": "mainnet"
  }
}

Authorizations

x-glacier-api-key
string
header
required

Api keys provide higher access to rate limits. To obtain an api key, sign up for an account at https://avacloud.io/.

Path Parameters

blockchainId
enum<string>
required

A primary network blockchain id or alias.

Available options:
11111111111111111111111111111111LpoYY,
2oYMBNV4eNHyqk2fjjV5nVQLDbtmNJzq5s3qs3Lo6ftnC6FByM,
2JVSBoinj9C2J33VntvzYtVJNZdN2NKiwwKjcumHUWEb5DbBrm,
2piQ2AVHCjnduiWXsSY15DtbVuwHE2cwMHYnEXHsLL73BBkdbV,
2q9e4r6Mu3U68nU1fYjgbR6JvwrRx36CohpAX5UQxse55x1Q5,
yH8D7ThNJkxmtkuv2jgBa4P1Rn3Qpr4pPr7QYNfcdoS6k6HWp,
vV3cui1DsEPC3nLCGH9rorwo8s6BYxM2Hz4QFE5gEYjwTqAu,
p-chain,
x-chain,
c-chain
network
enum<string>
required

Either mainnet or testnet/fuji.

Available options:
mainnet,
fuji,
testnet,
devnet
nodeId
string
required

A primary network (P or X chain) nodeId.

Query Parameters

startTimestamp
integer

Query param for retrieving items after a specific timestamp.

Required range: x >= 0
endTimestamp
integer

Query param for retrieving items before a specific timestamp.

Required range: x >= 0
pageToken
string

A page token, received from a previous list call. Provide this to retrieve the subsequent page.

pageSize
integer
default:10

The maximum number of items to return. The minimum page size is 1. The maximum pageSize is 100.

Required range: 1 <= x <= 100

Response

200
application/json
Successful response
blocks
object[]
required
chainInfo
object
required
nextPageToken
string

A token, which can be sent as pageToken to retrieve the next page. If this field is omitted or empty, there are no subsequent pages.