Skip to content

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

Notifications You must be signed in to change notification settings

soos3d/query-full-and-archive-nodes-python

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Labs

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

         

HomepageSupported 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/yieniggu/full-vs-archive-querys-py.git

Install dependencies

pip install web3 inquirer

Add a full and archive node RPC URL to utils.py

Open utils.py in the src directory and add your nodes RPC URLs:

# Init full and archive provider
full_node_provider = Web3(
    Web3.HTTPProvider(
        "CHAINSTACK_FULL_NODE_URL"
    )
)
archive_node_provider = Web3(
    Web3.HTTPProvider(
        "CHAINSTACK_ARCHIVE_NODE_URL"
    )
)

Run the program

python main.py

Prerequisites

  • Python ^3.9.16
  • 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.

Dependencies

  • web3.py ^5.31.3
  • inquirer ^3.1.2

Install

To install this project:

Clone this repository:

git clone https://github.com/yieniggu/full-vs-archive-querys-py.git

Install the dependencies in the project's directory:

cd query-full-and-archive-nodes-python
pip install web3 inquirer

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%