Skip to content

Web3.py

Web3.py is a Python library for EVM queries, contracts and transactions. It offers synchronous and asynchronous clients; integrations need version, unit, concurrency and event-recovery controls. Processes query nodes and decode contract responses through ABIs, separating reading, transaction construction and signing. Durable checkpoints and historical queries help reconstruct results after interruptions.

Written by Isaac GonzálezUpdated October 11, 2026

Key takeaways

  • Web3.py connects Python services to Ethereum and EVM-compatible networks.
  • It supports data queries, contract interaction and transaction preparation.
  • Automation requires key, nonce and error-recovery handling.

What is Web3.py?

Web3.py is a Python library for Ethereum and other networks exposing compatible EVM interfaces. It reads blocks, interacts with contracts, processes events and prepares transactions. It fits services, scripts and analysis already using the Python ecosystem and its data-processing tools.

It is distinct from Web3.js and has its own release cycle. Provider instructions, asynchronous APIs and Python requirements need to match the installed version. The Web3.js sunset does not mean web3.py was sunset, and examples should not be transferred between the two projects without review.

How it works

Clients access nodes through providers. Synchronous variants suit simple scripts, while AsyncWeb3 organises asynchronous calls. Persistent providers support subscriptions according to their configuration; exact names and methods should be checked against documentation for the version used by the project.

Contracts use an address and ABI. Amounts remain in base units with controlled conversion for display or export. Signing uses appropriate account components, separating keys and authorisation from code that queries or transforms data. Reading network state does not inherently require access to signing credentials.

What Web3.py offers

A reconciliation process can retrieve event ranges, normalise amounts and compare them with internal records. Rows retain network, contract, transaction and event identifiers. This supports duplicate detection and report reconstruction when classification rules change or an operational discrepancy needs investigation.

Concurrency should reflect RPC capacity and transformation work. Asynchronous services should not open unlimited requests. Checkpoints, bounded retries and reorganisation recovery let processing continue after interruptions without losing or duplicating movements. These behaviours need testing alongside the calculations that produce the final report.

Limitations and selection criteria

Web3.py does not replace SDKs for networks exposing different interfaces. Nor does it independently supply an indexed history of every token owned by an account; some queries require events, indexes or additional services. Distinguish node responses from application-derived information when defining scope.

Selection depends on data libraries and team environment. Pin versions with their Python requirements and test upgrades. Measure actual querying, decoding and storage workloads rather than using universal events-per-second claims without a defined workload, provider configuration and recovery policy.

Also known as

  • web3.py
  • Python web3
Development at Metlabs

How we approach a project with Web3.py

Development capabilities and use cases to assess how Web3.py fits your product.

What we build with Web3.py at Metlabs

  • Automation scripts

    Scripts with versioned settings, operation records and checks before repeating actions.

  • On-chain data pipelines

    Extracting and transforming blockchain data into Python (pandas, notebooks, BI).

  • Automation with AsyncWeb3

    Services with asynchronous clients, concurrency limits and historical event recovery.

  • Use case

    Protocol KPI computation

    Python script that extracts contract events, computes metrics and feeds a dashboard.

  • Use case

    On-chain reconciliation and alerts

    Python service reconciling on-chain movements with internal records and firing alerts on discrepancies, the backbone of production operations.

Related content

Go deeper on Web3.py

Other Metlabs pages that expand on this entry.

Building with Web3.py?

We analyze your case, pick the right stack and ship a production-ready solution.

Tell us about your project

As featured in

CointelegraphInvesting.comEl EspañolEmprendedoresEl ObservadorCriptoNoticias