Subnet-EVM API
Subnet-EVM APIs are identical to
Coreth C-Chain APIs, except Avalanche Specific APIs
starting with avax
. Subnet-EVM also supports standard Ethereum APIs as well. For more
information about Coreth APIs see GitHub.
Subnet-EVM has some additional APIs that are not available in Coreth.
eth_feeConfig
Subnet-EVM comes with an API request for getting fee config at a specific block. You can use this API to check your activated fee config.
Signature:
blk
is the block number or hash at which to retrieve the fee config. Defaults to the latest block if omitted.
Example Call:
Example Response:
eth_getChainConfig
eth_getChainConfig
returns the Chain Config of the blockchain. This API is enabled by default with
internal-blockchain
namespace.
This API exists on the C-Chain as well, but in addition to the normal Chain Config returned by the
C-Chain eth_getChainConfig
on subnet-evm
additionally returns the upgrade config, which specifies
network upgrades activated after the genesis. Signature:
Example Call:
Example Response:
eth_getActivePrecompilesAt
DEPRECATED—instead use eth_getActiveRulesAt
.
eth_getActivePrecompilesAt
returns activated precompiles at a specific timestamp. If no
timestamp is provided it returns the latest block timestamp. This API is enabled by default with
internal-blockchain
namespace.
Signature:
timestamp
specifies the timestamp to show the precompiles active at this time. If omitted it shows precompiles activated at the latest block timestamp.
Example Call:
Example Response:
eth_getActiveRulesAt
eth_getActiveRulesAt
returns activated rules (precompiles, upgrades) at a specific timestamp. If no
timestamp is provided it returns the latest block timestamp. This API is enabled by default with
internal-blockchain
namespace.
Signature:
timestamp
specifies the timestamp to show the rules active at this time. If omitted it shows rules activated at the latest block timestamp.
Example Call:
Example Response:
validators_getCurrentValidators
This API retrieves the list of current validators for the Subnet/L1. It provides detailed information about each validator, including their ID, status, weight, connection, and uptime.
URL: http://<server-uri>/ext/bc/<blockchainID>/validators
Signature:
Example Call:
nodeIDs
is an optional parameter that specifies the node IDs of the validators to retrieve. If omitted, all validators are returned.
Example Response:
- validationID: (string) Unique identifier for the validation. This returns validation ID for L1s, AddSubnetValidator txID for Subnets.
- nodeID: (string) Node identifier for the validator.
- weight: (integer) The weight of the validator, often representing stake.
- startTimestamp: (integer) UNIX timestamp for when validation started.
- isActive: (boolean) Indicates if the validator is active. This returns true if this is L1 validator and has enough continuous subnet staking fees in P-Chain. It always return true for subnet validators.
- isL1Validator: (boolean) Indicates if the validator is a L1 validator or a subnet validator.
- isConnected: (boolean) Indicates if the validator node is currently connected to the callee node.
- uptimeSeconds: (integer) The number of seconds the validator has been online.
- uptimePercentage: (float) The percentage of time the validator has been online.