coolsnake / query-evm-nodes-python

Query historical data on full and archive nodes to understand the difference

Home Page:https://chainstack.com/querying-full-and-archive-evm-nodes-with-python/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Labs

Chainstack is the leading suite of services connecting developers with Web3 infrastructure

         

Supported protocolsChainstack blogChainstack docsBlockchain API referenceStart for free

Querying full and archive EVM nodes with Python

This project allows the retrieval of historical data from the blockchain programmatically, switching between a full and archive node provider when necessary.

See the full tutorial on the Chainstack blog:

Project details

This repository holds the Python version of a tool to query common state functions. Some essential functions include getting an address balance and storage at a given position, a contract bytecode, or even the whole transactions included on a given block.

This tool queries the blockchain using the web3 and inquirer libraries for Python.

Quick start

Clone this repository

git clone https://github.com/chainstacklabs/chainstack-full-vs-archive-query-py.git

Install dependencies

pip install -r requirements.txt 

Edit the env.sample file

Add your RPC node URLs and rename the file to .env.

CHAINSTACK_FULL_NODE="CHAINSTACK_FULL_NODE_URL"
CHAINSTACK_ARCHIVE_NODE="CHAINSTACK_ARCHIVE_NODE_URL"

Run the program

python main.py

Prerequisites

  • Python: ^3.7— install Node
  • A full and archive node RPC endpoints.

Deploy a full and archive node with Chainstack:

  1. Sign up with Chainstack.
  2. Deploy a node.
  3. View node access and credentials.

Install

Clone this repository:

git clone https://github.com/chainstacklabs/chainstack-full-vs-archive-query-py.git

Install the dependencies in the project's directory:

cd query-full-and-archive-nodes-python
pip install -r requirements.txt 

About

Query historical data on full and archive nodes to understand the difference

https://chainstack.com/querying-full-and-archive-evm-nodes-with-python/

License:MIT License


Languages

Language:Python 100.0%