import { Avalanche } from "@avalanche-sdk/chainkit";
const avalanche = new Avalanche({
network: "mainnet",
});
async function run() {
const result = await avalanche.data.primaryNetwork.blocks.get({
blockchainId: "p-chain",
blockId: "5615di9ytxujackzaXNrVuWQy5y8Yrt8chPCscMr5Ku9YxJ1S",
});
console.log(result);
}
run();{
"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
}
}Gets a block by block height or block hash on one of the Primary Network chains.
import { Avalanche } from "@avalanche-sdk/chainkit";
const avalanche = new Avalanche({
network: "mainnet",
});
async function run() {
const result = await avalanche.data.primaryNetwork.blocks.get({
blockchainId: "p-chain",
blockId: "5615di9ytxujackzaXNrVuWQy5y8Yrt8chPCscMr5Ku9YxJ1S",
});
console.log(result);
}
run();{
"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
}
}Documentation Index
Fetch the complete documentation index at: https://developers.avacloud.io/llms.txt
Use this file to discover all available pages before exploring further.
Api keys provide higher access to rate limits. To obtain an api key, sign up for an account at https://avacloud.io/.
A primary network blockchain id or alias.
11111111111111111111111111111111LpoYY, 2oYMBNV4eNHyqk2fjjV5nVQLDbtmNJzq5s3qs3Lo6ftnC6FByM, 2JVSBoinj9C2J33VntvzYtVJNZdN2NKiwwKjcumHUWEb5DbBrm, 2q9e4r6Mu3U68nU1fYjgbR6JvwrRx36CohpAX5UQxse55x1Q5, yH8D7ThNJkxmtkuv2jgBa4P1Rn3Qpr4pPr7QYNfcdoS6k6HWp, p-chain, x-chain, c-chain Either mainnet or testnet/fuji.
mainnet, fuji, testnet A block identifier which is either a block number or the block hash.
Successful response
Show child attributes
Was this page helpful?