LogoLogo
  • Welcome
    • About ENI
  • Getting Started
    • Quickstart
      • Account Structure
      • Token Standards
      • Gas
    • Divergence from Ethereum
    • Transactions
      • Creating Transaction
    • Governance
      • Proposals
    • Oracles
  • Build
    • Setup and Installation
    • Smart Contracts
      • EVM (General)
      • EVM (CLI)
      • Querying State
    • Frontend Development
      • Overview
      • How to Deploy Your First dApp
    • Ecosystem
      • Tools and Resources
      • Resources
  • Node
    • Getting Started
    • Node Operators Guide
    • Validator Operations Guide
    • Advanced Configuration & Monitoring
    • Technical Reference
  • Reference
    • Overview
    • enid
    • CLI
      • enid add-genesis-account
      • enid blocktest
      • enid collect-gentxs
      • enid compact
      • enid config
      • enid debug
      • enid export
      • enid gentx
      • enid help
      • enid init
      • enid keys
        • enid keys delete
        • enid keys add
        • enid keys export
        • enid keys import
        • enid keys list
        • enid keys mnemonic
        • enid keys parse
        • enid keys show
      • enid latest_version
      • enid migrate
      • enid prune
      • enid query
        • enid query accesscontrol
        • enid query upgrade
        • enid query account
        • enid query auth
        • enid query bank
        • enid query block
        • enid query authz
        • enid query distribution
        • enid query epoch
        • enid query evidence
        • enid query evm
        • enid query feegrant
        • enid query ibc-transfer
        • enid query gov
        • enid query ibc
        • enid query mint
        • enid query oracle
        • enid query params
        • enid query slashing
        • enid query staking
        • enid query tendermint-validator-set
        • enid query tokenfactory
        • enid query tx
        • enid query txs
      • enid rollback
      • enid start
      • enid status
      • enid tendermint
      • enid tools
      • enid tx
      • enid validate-genesis
      • enid version
Powered by GitBook
On this page
  • Querying Blockchain State
  • Querying State
  • Querying Historical State
  • Pruning
  • Archive Nodes
  • Using Indexers for Historical Data
  1. Build
  2. Smart Contracts

Querying State

Querying Blockchain State

Querying the blockchain state to retrieve account balances, token balances, and other information is essential.

Querying State

All nodes contain the latest blockchain state. This means you can query the blockchain state by connecting to an RPC node. There are three primary methods to query a node:

  • RPC Endpoint

  • gRPC Endpoint

  • REST Endpoint

  • Websockets

Querying Historical State

When working with blockchain applications, querying historical state data is crucial for various types of applications. To query historical state data, you can use an archive node and specify the block height at which you want to retrieve the state.

• Example: To query the state at a specific block height, you can use the following method:

Querying with enid by block height

enid query bank balances [address] --height <block-height>

• This command allows you to specify a block height and retrieve the state at that specific point in time.

Pruning

Pruning is the process of removing old blockchain data that is no longer needed to save disk space and improve performance. Pruned nodes retain only a limited amount of recent blockchain data, making them faster and less storage-intensive for RPC providers.

• Purpose: Pruning helps reduce the storage requirements of a blockchain node, making it more efficient and easier to manage.

• Limitation: Pruned nodes do not retain the full blockchain history, so they cannot be used to query historical data beyond the pruning window.

Archive Nodes

On the other hand, archive nodes store the entire blockchain history from the genesis block to the latest block. This makes them essential for querying historical state data.

• Purpose: Archive nodes preserve the complete blockchain history, allowing developers to query any past state by block height.

• Use Cases: Archive nodes are critical for tasks requiring access to historical data, such as catching up indexers, conducting historical analysis, and verifying past transactions.

Using Indexers for Historical Data

While archive nodes provide raw historical data, indexers are vital for efficiently querying and analyzing this data. Indexers organize and optimize the data, making it more accessible and easier to analyze.

PreviousEVM (CLI)NextFrontend Development

Last updated 2 months ago