Granite Upgrade Activates in08d:20h:52m:15s
MethodsPublic Methods

API Methods

Complete reference for Admin, Info, Health, Index, and ProposerVM API methods

Overview

The Avalanche Client SDK provides access to node-level API methods through specialized API clients. These include administrative operations, informational queries, health monitoring, indexed blockchain data access, and ProposerVM operations.

Admin API Client

Provides administrative operations for managing node aliases, logging, and profiling.

Access: client.admin

alias

Assign an API endpoint an alias.

Function Signature:

function alias(params: AliasParameters): Promise<void>;

interface AliasParameters {
  endpoint: string;
  alias: string;
}

Parameters:

NameTypeRequiredDescription
endpointstringYesAPI endpoint to alias
aliasstringYesAlias for the endpoint

Returns:

TypeDescription
Promise<void>No return value

Example:

import { createAvalancheClient } from "@avalanche-sdk/client";
import { avalanche } from "@avalanche-sdk/client/chains";

const client = createAvalancheClient({
  chain: avalanche,
  transport: { type: "http" },
});

await client.admin.alias({
  endpoint: "bc/X",
  alias: "myAlias",
});

Related:


aliasChain

Give a blockchain an alias.

Function Signature:

function aliasChain(params: AliasChainParameters): Promise<void>;

interface AliasChainParameters {
  chain: string;
  alias: string;
}

Parameters:

NameTypeRequiredDescription
chainstringYesBlockchain ID to alias
aliasstringYesAlias for the blockchain

Returns:

TypeDescription
Promise<void>No return value

Example:

await client.admin.aliasChain({
  chain: "sV6o671RtkGBcno1FiaDbVcFv2sG5aVXMZYzKdP4VQAWmJQnM",
  alias: "myBlockchainAlias",
});

Related:


getChainAliases

Get the aliases of a chain.

Function Signature:

function getChainAliases(params: GetChainAliasesParameters): Promise<string[]>;

interface GetChainAliasesParameters {
  chain: string;
}

Parameters:

NameTypeRequiredDescription
chainstringYesBlockchain ID to query

Returns:

TypeDescription
Promise<string[]>Array of aliases for the chain

Example:

const aliases = await client.admin.getChainAliases({
  chain: "sV6o671RtkGBcno1FiaDbVcFv2sG5aVXMZYzKdP4VQAWmJQnM",
});

console.log("Chain aliases:", aliases);

Related:


Additional Admin API Methods

  • getLoggerLevel - Get log and display levels of loggers
  • setLoggerLevel - Set log and display levels of loggers
  • loadVMs - Dynamically loads virtual machines
  • lockProfile - Writes mutex statistics to lock.profile
  • memoryProfile - Writes memory profile to mem.profile
  • startCPUProfiler - Start CPU profiling
  • stopCPUProfiler - Stop CPU profiler

See the Admin API documentation for complete details.


Info API Client

Provides node information and network statistics.

Access: client.info

getNetworkID

Get the ID of the network this node is participating in.

Function Signature:

function getNetworkID(): Promise<GetNetworkIDReturnType>;

interface GetNetworkIDReturnType {
  networkID: string;
}

Returns:

TypeDescription
GetNetworkIDReturnTypeNetwork ID object

Return Object:

PropertyTypeDescription
networkIDstringNetwork ID (1 for Mainnet, 5 for Fuji testnet)

Example:

const result = await client.info.getNetworkID();

if (result.networkID === "1") {
  console.log("Connected to Mainnet");
} else if (result.networkID === "5") {
  console.log("Connected to Fuji testnet");
}

Related:


getNetworkName

Get the name of the network this node is participating in.

Function Signature:

function getNetworkName(): Promise<GetNetworkNameReturnType>;

interface GetNetworkNameReturnType {
  networkName: string;
}

Returns:

TypeDescription
GetNetworkNameReturnTypeNetwork name object

Return Object:

PropertyTypeDescription
networkNamestringNetwork name (e.g., "mainnet", "fuji")

Example:

const result = await client.info.getNetworkName();
console.log("Network:", result.networkName);

Related:


getNodeVersion

Get the version of this node.

Function Signature:

function getNodeVersion(): Promise<GetNodeVersionReturnType>;

interface GetNodeVersionReturnType {
  version: string;
  databaseVersion: string;
  gitCommit: string;
  vmVersions: Map<string, string>;
  rpcProtocolVersion: string;
}

Returns:

TypeDescription
GetNodeVersionReturnTypeNode version object

Return Object:

PropertyTypeDescription
versionstringNode version (e.g., "avalanche/1.9.4")
databaseVersionstringDatabase version
gitCommitstringGit commit hash
vmVersionsMap<string, string>Map of VM IDs to their versions
rpcProtocolVersionstringRPC protocol version

Example:

const version = await client.info.getNodeVersion();
console.log("Node version:", version.version);
console.log("Database version:", version.databaseVersion);
console.log("VM versions:", Object.fromEntries(version.vmVersions));

Related:


getNodeID

Get the node ID, BLS key, and proof of possession.

Function Signature:

function getNodeID(): Promise<GetNodeIDReturnType>;

interface GetNodeIDReturnType {
  nodeID: string;
  nodePOP: {
    publicKey: string;
    proofOfPossession: string;
  };
}

Returns:

TypeDescription
GetNodeIDReturnTypeNode ID object

Return Object:

PropertyTypeDescription
nodeIDstringUnique identifier of the node
nodePOP.publicKeystring48 byte hex representation of the BLS key
nodePOP.proofOfPossessionstring96 byte hex representation of the BLS signature

Example:

const nodeID = await client.info.getNodeID();
console.log("Node ID:", nodeID.nodeID);
console.log("BLS Public Key:", nodeID.nodePOP.publicKey);

Related:


getNodeIP

Get the IP address of the node.

Function Signature:

function getNodeIP(): Promise<GetNodeIPReturnType>;

interface GetNodeIPReturnType {
  ip: string;
}

Returns:

TypeDescription
GetNodeIPReturnTypeNode IP object

Return Object:

PropertyTypeDescription
ipstringIP address of the node

Example:

const result = await client.info.getNodeIP();
console.log("Node IP:", result.ip);

Related:


getBlockchainID

Get blockchain ID from alias.

Function Signature:

function getBlockchainID(
  params: GetBlockchainIDParameters
): Promise<GetBlockchainIDReturnType>;

interface GetBlockchainIDParameters {
  alias: string;
}

interface GetBlockchainIDReturnType {
  blockchainID: string;
}

Parameters:

NameTypeRequiredDescription
aliasstringYesBlockchain alias (e.g., "X", "P")

Returns:

TypeDescription
GetBlockchainIDReturnTypeBlockchain ID object

Return Object:

PropertyTypeDescription
blockchainIDstringID of the blockchain

Example:

const result = await client.info.getBlockchainID({ alias: "X" });
console.log("X-Chain ID:", result.blockchainID);

Related:


getTxFee

Get transaction fees for various operations.

Function Signature:

function getTxFee(): Promise<GetTxFeeReturnType>;

interface GetTxFeeReturnType {
  txFee: bigint;
  createAssetTxFee: bigint;
  createSubnetTxFee: bigint;
  transformSubnetTxFee: bigint;
  createBlockchainTxFee: bigint;
  addPrimaryNetworkValidatorFee: bigint;
  addPrimaryNetworkDelegatorFee: bigint;
  addSubnetValidatorFee: bigint;
  addSubnetDelegatorFee: bigint;
}

Returns:

TypeDescription
GetTxFeeReturnTypeTransaction fees object

Return Object:

PropertyTypeDescription
txFeebigintBase transaction fee
createAssetTxFeebigintFee for creating an asset
createSubnetTxFeebigintFee for creating a subnet
transformSubnetTxFeebigintFee for transforming a subnet
createBlockchainTxFeebigintFee for creating a blockchain
addPrimaryNetworkValidatorFeebigintFee for adding a primary network validator
addPrimaryNetworkDelegatorFeebigintFee for adding a primary network delegator
addSubnetValidatorFeebigintFee for adding a subnet validator
addSubnetDelegatorFeebigintFee for adding a subnet delegator

Example:

const fees = await client.info.getTxFee();
console.log("Base transaction fee:", fees.txFee);
console.log("Create asset fee:", fees.createAssetTxFee);

Related:


getVMs

Get supported virtual machines.

Function Signature:

function getVMs(): Promise<GetVMsReturnType>;

interface GetVMsReturnType {
  vms: {
    [key: string]: string[];
  };
}

Returns:

TypeDescription
GetVMsReturnTypeVMs object

Return Object:

PropertyTypeDescription
vms{ [key: string]: string[] }Map of VM IDs to their aliases

Example:

const vms = await client.info.getVMs();
console.log("Supported VMs:", vms.vms);

Related:


isBootstrapped

Check whether a given chain is done bootstrapping.

Function Signature:

function isBootstrapped(
  params: IsBootstrappedParameters
): Promise<IsBootstrappedReturnType>;

interface IsBootstrappedParameters {
  chain: string;
}

interface IsBootstrappedReturnType {
  isBootstrapped: boolean;
}

Parameters:

NameTypeRequiredDescription
chainstringYesChain ID or alias (e.g., "X")

Returns:

TypeDescription
IsBootstrappedReturnTypeBootstrapped status

Return Object:

PropertyTypeDescription
isBootstrappedbooleanWhether the chain is done bootstrapping

Example:

const result = await client.info.isBootstrapped({ chain: "X" });

if (result.isBootstrapped) {
  console.log("X-Chain is bootstrapped");
} else {
  console.log("X-Chain is still bootstrapping");
}

Related:


peers

Get peer information.

Function Signature:

function peers(params: PeersParameters): Promise<PeersReturnType>;

interface PeersParameters {
  nodeIDs?: string[];
}

interface PeersReturnType {
  numPeers: number;
  peers: {
    ip: string;
    publicIP: string;
    nodeID: string;
    version: string;
    lastSent: string;
    lastReceived: string;
    benched: string[];
    observedUptime: number;
  }[];
}

Parameters:

NameTypeRequiredDescription
nodeIDsstring[]NoOptional array of node IDs to filter

Returns:

TypeDescription
PeersReturnTypePeers object

Return Object:

PropertyTypeDescription
numPeersnumberNumber of connected peers
peersarrayArray of peer information objects

Peer Object:

PropertyTypeDescription
ipstringRemote IP of the peer
publicIPstringPublic IP of the peer
nodeIDstringPrefixed Node ID of the peer
versionstringVersion the peer is running
lastSentstringTimestamp of last message sent to the peer
lastReceivedstringTimestamp of last message received from the peer
benchedstring[]Array of chain IDs the peer is benched on
observedUptimenumberNode's primary network uptime observed by the peer

Example:

const peers = await client.info.peers();
console.log("Number of peers:", peers.numPeers);
console.log("Peer details:", peers.peers);

Related:


uptime

Get node uptime statistics.

Function Signature:

function uptime(): Promise<UptimeReturnType>;

interface UptimeReturnType {
  rewardingStakePercentage: number;
  weightedAveragePercentage: number;
}

Returns:

TypeDescription
UptimeReturnTypeUptime object

Return Object:

PropertyTypeDescription
rewardingStakePercentagenumberPercent of stake which thinks this node is above the uptime requirement
weightedAveragePercentagenumberStake-weighted average of all observed uptimes for this node

Example:

const uptime = await client.info.uptime();
console.log("Rewarding stake percentage:", uptime.rewardingStakePercentage);
console.log("Weighted average percentage:", uptime.weightedAveragePercentage);

Related:


upgrades

Get upgrade history.

Function Signature:

function upgrades(): Promise<UpgradesReturnType>;

interface UpgradesReturnType {
  apricotPhase1Time: string;
  apricotPhase2Time: string;
  apricotPhase3Time: string;
  apricotPhase4Time: string;
  apricotPhase4MinPChainHeight: number;
  apricotPhase5Time: string;
  apricotPhasePre6Time: string;
  apricotPhase6Time: string;
  apricotPhasePost6Time: string;
  banffTime: string;
  cortinaTime: string;
  cortinaXChainStopVertexID: string;
  durangoTime: string;
  etnaTime: string;
  fortunaTime?: string;
}

Returns:

TypeDescription
UpgradesReturnTypeUpgrades object

Return Object:

PropertyTypeDescription
apricotPhase1TimestringTimestamp of Apricot Phase 1 upgrade
apricotPhase2TimestringTimestamp of Apricot Phase 2 upgrade
apricotPhase3TimestringTimestamp of Apricot Phase 3 upgrade
apricotPhase4TimestringTimestamp of Apricot Phase 4 upgrade
apricotPhase4MinPChainHeightnumberMinimum P-Chain height for Apricot Phase 4
apricotPhase5TimestringTimestamp of Apricot Phase 5 upgrade
apricotPhasePre6TimestringTimestamp of Apricot Phase Pre-6 upgrade
apricotPhase6TimestringTimestamp of Apricot Phase 6 upgrade
apricotPhasePost6TimestringTimestamp of Apricot Phase Post-6 upgrade
banffTimestringTimestamp of Banff upgrade
cortinaTimestringTimestamp of Cortina upgrade
cortinaXChainStopVertexIDstringX-Chain stop vertex ID for Cortina upgrade
durangoTimestringTimestamp of Durango upgrade
etnaTimestringTimestamp of Etna upgrade
fortunaTimestring?Timestamp of Fortuna upgrade (optional)

Example:

const upgrades = await client.info.upgrades();
console.log("Apricot Phase 1:", upgrades.apricotPhase1Time);
console.log("Banff upgrade:", upgrades.banffTime);

Related:


acps

Get peer preferences for Avalanche Community Proposals.

Function Signature:

function acps(): Promise<AcpsReturnType>;

interface AcpsReturnType {
  acps: Map<
    number,
    {
      supportWeight: bigint;
      supporters: Set<string>;
      objectWeight: bigint;
      objectors: Set<string>;
      abstainWeight: bigint;
    }
  >;
}

Returns:

TypeDescription
AcpsReturnTypeACPs object

Return Object:

PropertyTypeDescription
acpsMapMap of ACP IDs to their peer preferences

ACP Object:

PropertyTypeDescription
supportWeightbigintWeight of stake supporting the ACP
supportersSet<string>Set of node IDs supporting the ACP
objectWeightbigintWeight of stake objecting to the ACP
objectorsSet<string>Set of node IDs objecting to the ACP
abstainWeightbigintWeight of stake abstaining from the ACP

Example:

const acps = await client.info.acps();
console.log("ACP preferences:", acps.acps);

Related:


Health API Client

Provides health monitoring for the node.

Access: client.health

health

Get health check results for the node.

Function Signature:

function health(params: HealthParameters): Promise<HealthReturnType>;

interface HealthParameters {
  tags?: string[];
}

interface HealthReturnType {
  healthy: boolean;
  checks: {
    C: ChainHealthCheck;
    P: ChainHealthCheck;
    X: ChainHealthCheck;
    bootstrapped: {
      message: any[];
      timestamp: string;
      duration: number;
    };
    database: {
      timestamp: string;
      duration: number;
    };
    diskspace: {
      message: {
        availableDiskBytes: number;
      };
      timestamp: string;
      duration: number;
    };
    network: {
      message: {
        connectedPeers: number;
        sendFailRate: number;
        timeSinceLastMsgReceived: string;
        timeSinceLastMsgSent: string;
      };
      timestamp: string;
      duration: number;
    };
    router: {
      message: {
        longestRunningRequest: string;
        outstandingRequests: number;
      };
      timestamp: string;
      duration: number;
    };
  };
}

type ChainHealthCheck = {
  message: {
    engine: {
      consensus: {
        lastAcceptedHeight: number;
        lastAcceptedID: string;
        longestProcessingBlock: string;
        processingBlocks: number;
      };
      vm: null;
    };
    networking: {
      percentConnected: number;
    };
  };
  timestamp: string;
  duration: number;
};

Parameters:

NameTypeRequiredDescription
tagsstring[]NoOptional tags to filter health checks

Returns:

TypeDescription
HealthReturnTypeHealth check results

Return Object:

PropertyTypeDescription
healthybooleanOverall health status of the node
checksobjectHealth check results for each component

Example:

const healthStatus = await client.health.health({
  tags: ["11111111111111111111111111111111LpoYY"],
});

console.log("Node healthy:", healthStatus.healthy);
console.log("C-Chain health:", healthStatus.checks.C);

Related:


liveness

Get liveness check indicating if the node is alive and can handle requests.

Function Signature:

function liveness(): Promise<LivenessReturnType>;

interface LivenessReturnType {
  checks: object;
  healthy: boolean;
}

Returns:

TypeDescription
LivenessReturnTypeLiveness check result

Return Object:

PropertyTypeDescription
checksobjectLiveness check details
healthybooleanIndicates if the node is alive and can handle requests

Example:

const livenessStatus = await client.health.liveness();

if (livenessStatus.healthy) {
  console.log("Node is alive and responding");
}

Related:


readiness

Get readiness check indicating if the node has finished initializing.

Function Signature:

function readiness(params: ReadinessParameters): Promise<ReadinessReturnType>;

interface ReadinessParameters {
  tags?: string[];
}

interface ReadinessReturnType {
  checks: {
    [key: string]: {
      message: {
        timestamp: string;
        duration: number;
        contiguousFailures: number;
        timeOfFirstFailure: string | null;
      };
      healthy: boolean;
    };
  };
  healthy: boolean;
}

Parameters:

NameTypeRequiredDescription
tagsstring[]NoOptional tags to filter readiness checks

Returns:

TypeDescription
ReadinessReturnTypeReadiness check result

Return Object:

PropertyTypeDescription
checksobjectReadiness check results for each component
healthybooleanOverall readiness status of the node

Example:

const readinessStatus = await client.health.readiness({
  tags: ["11111111111111111111111111111111LpoYY"],
});

if (readinessStatus.healthy) {
  console.log("Node is ready to handle requests");
}

Related:


Index API Clients

Provides indexed blockchain data queries for fast container lookups.

Access:

  • client.indexBlock.pChain - P-Chain block index
  • client.indexBlock.cChain - C-Chain block index
  • client.indexBlock.xChain - X-Chain block index
  • client.indexTx.xChain - X-Chain transaction index

getContainerByIndex

Get container by its index.

Function Signature:

function getContainerByIndex(
  params: GetContainerByIndexParameters
): Promise<GetContainerByIndexReturnType>;

interface GetContainerByIndexParameters {
  index: number;
  encoding: "hex";
}

interface GetContainerByIndexReturnType {
  id: string;
  bytes: string;
  timestamp: string;
  encoding: "hex";
  index: string;
}

Parameters:

NameTypeRequiredDescription
indexnumberYesContainer index (first container is at index 0)
encoding"hex"YesEncoding format (only "hex" is supported)

Returns:

TypeDescription
GetContainerByIndexReturnTypeContainer object

Return Object:

PropertyTypeDescription
idstringContainer's ID
bytesstringByte representation of the container
timestampstringTime at which this node accepted the container
encoding"hex"Encoding format used
indexstringHow many containers were accepted before this one

Example:

const container = await client.indexBlock.pChain.getContainerByIndex({
  index: 12345,
  encoding: "hex",
});

console.log("Container ID:", container.id);
console.log("Container bytes:", container.bytes);

Related:


getContainerByID

Get container by its ID.

Function Signature:

function getContainerByID(
  params: GetContainerByIDParameters
): Promise<GetContainerByIDReturnType>;

interface GetContainerByIDParameters {
  id: string;
  encoding: "hex";
}

interface GetContainerByIDReturnType {
  id: string;
  bytes: string;
  timestamp: string;
  encoding: "hex";
  index: string;
}

Parameters:

NameTypeRequiredDescription
idstringYesContainer's ID
encoding"hex"YesEncoding format (only "hex" is supported)

Returns:

TypeDescription
GetContainerByIDReturnTypeContainer object

Return Object:

PropertyTypeDescription
idstringContainer's ID
bytesstringByte representation of the container
timestampstringTime at which this node accepted the container
encoding"hex"Encoding format used
indexstringHow many containers were accepted before this one

Example:

const container = await client.indexBlock.cChain.getContainerByID({
  id: "0x123...",
  encoding: "hex",
});

console.log("Container index:", container.index);

Related:


getContainerRange

Get range of containers by index.

Function Signature:

function getContainerRange(
  params: GetContainerRangeParameters
): Promise<GetContainerRangeReturnType>;

interface GetContainerRangeParameters {
  startIndex: number;
  endIndex: number;
  encoding: "hex";
}

interface GetContainerRangeReturnType {
  containers: Array<{
    id: string;
    bytes: string;
    timestamp: string;
    encoding: "hex";
    index: string;
  }>;
}

Parameters:

NameTypeRequiredDescription
startIndexnumberYesIndex of the first container to retrieve
endIndexnumberYesIndex of the last container to retrieve (inclusive)
encoding"hex"YesEncoding format (only "hex" is supported)

Returns:

TypeDescription
GetContainerRangeReturnTypeContainer range object

Return Object:

PropertyTypeDescription
containersarrayArray of container details

Container Object:

PropertyTypeDescription
idstringContainer's ID
bytesstringByte representation of the container
timestampstringTime at which this node accepted the container
encoding"hex"Encoding format used
indexstringHow many containers were accepted before this one

Example:

const range = await client.indexBlock.xChain.getContainerRange({
  startIndex: 1000,
  endIndex: 1010,
  encoding: "hex",
});

console.log("Containers:", range.containers.length);

Related:


getIndex

Get container index by ID.

Function Signature:

function getIndex(params: GetIndexParameters): Promise<GetIndexReturnType>;

interface GetIndexParameters {
  id: string;
  encoding: "hex";
}

interface GetIndexReturnType {
  index: string;
}

Parameters:

NameTypeRequiredDescription
idstringYesContainer's ID
encoding"hex"YesEncoding format (only "hex" is supported)

Returns:

TypeDescription
GetIndexReturnTypeIndex object

Return Object:

PropertyTypeDescription
indexstringIndex of the container (first container is at index 0)

Example:

const result = await client.indexTx.xChain.getIndex({
  id: "0x123...",
  encoding: "hex",
});

console.log("Container index:", result.index);

Related:


getLastAccepted

Get last accepted container.

Function Signature:

function getLastAccepted(
  params: GetLastAcceptedParameters
): Promise<GetLastAcceptedReturnType>;

interface GetLastAcceptedParameters {
  encoding: "hex";
}

interface GetLastAcceptedReturnType {
  id: string;
  bytes: string;
  timestamp: string;
  encoding: "hex";
  index: string;
}

Parameters:

NameTypeRequiredDescription
encoding"hex"YesEncoding format (only "hex" is supported)

Returns:

TypeDescription
GetLastAcceptedReturnTypeLast accepted container object

Return Object:

PropertyTypeDescription
idstringContainer's ID
bytesstringByte representation of the container
timestampstringTime at which this node accepted the container
encoding"hex"Encoding format used
indexstringHow many containers were accepted before this one

Example:

const lastAccepted = await client.indexBlock.pChain.getLastAccepted({
  encoding: "hex",
});

console.log("Last accepted container ID:", lastAccepted.id);
console.log("Last accepted index:", lastAccepted.index);

Related:


isAccepted

Check if container is accepted in the index.

Function Signature:

function isAccepted(
  params: IsAcceptedParameters
): Promise<IsAcceptedReturnType>;

interface IsAcceptedParameters {
  id: string;
  encoding: "hex";
}

interface IsAcceptedReturnType {
  isAccepted: boolean;
}

Parameters:

NameTypeRequiredDescription
idstringYesContainer's ID
encoding"hex"YesEncoding format (only "hex" is supported)

Returns:

TypeDescription
IsAcceptedReturnTypeAcceptance status object

Return Object:

PropertyTypeDescription
isAcceptedbooleanWhether the container is in this index

Example:

const result = await client.indexBlock.cChain.isAccepted({
  id: "0x123...",
  encoding: "hex",
});

if (result.isAccepted) {
  console.log("Container is accepted");
} else {
  console.log("Container is not accepted");
}

Related:


ProposerVM API Client

Provides ProposerVM operations for each chain. ProposerVM is responsible for proposing blocks and managing consensus.

Access:

  • client.proposerVM.pChain - P-Chain ProposerVM
  • client.proposerVM.xChain - X-Chain ProposerVM
  • client.proposerVM.cChain - C-Chain ProposerVM

getProposedHeight

Get the current proposed height for the chain.

Function Signature:

function getProposedHeight(): Promise<GetProposedHeightReturnType>;

interface GetProposedHeightReturnType {
  height: string;
}

Returns:

TypeDescription
GetProposedHeightReturnTypeProposed height object

Return Object:

PropertyTypeDescription
heightstringThis node's current proposer VM height

Example:

const pChainHeight = await client.proposerVM.pChain.getProposedHeight();
console.log("P-Chain proposed height:", pChainHeight.height);

const xChainHeight = await client.proposerVM.xChain.getProposedHeight();
console.log("X-Chain proposed height:", xChainHeight.height);

const cChainHeight = await client.proposerVM.cChain.getProposedHeight();
console.log("C-Chain proposed height:", cChainHeight.height);

Related:


getCurrentEpoch

Get the current epoch information.

Function Signature:

function getCurrentEpoch(): Promise<GetCurrentEpochReturnType>;

interface GetCurrentEpochReturnType {
  number: string;
  startTime: string;
  pChainHeight: string;
}

Returns:

TypeDescription
GetCurrentEpochReturnTypeCurrent epoch object

Return Object:

PropertyTypeDescription
numberstringThe current epoch number
startTimestringThe epoch start time (Unix timestamp)
pChainHeightstringThe P-Chain height at the start of this epoch

Example:

const epoch = await client.proposerVM.pChain.getCurrentEpoch();
console.log("Current epoch:", epoch.number);
console.log("Epoch start time:", epoch.startTime);
console.log("P-Chain height at epoch start:", epoch.pChainHeight);

Related:


Next Steps

Is this guide helpful?