Skip to main content
TLDR:
  • Demonstrates building a real-time transaction activity monitor for Linea blockchain using Python and web3.py.
  • Shows how to handle Proof-of-Authority (POA) networks with proper middleware configuration in web3.py.
  • Includes practical examples of block polling and transaction analysis.

Overview

Linea is a high-performance Layer 2 blockchain that offers fast transaction processing with approximately 2-second block times. This tutorial is a very easy quickstart guide to create a real-time transaction monitor that visualizes blockchain activity as it happens. You’ll learn how to connect to the Linea mainnet and efficiently poll the chain. How to handle POA networks correctly, and create beautiful terminal interfaces that provide instant insights into network activity.

Prerequisites

Understanding Linea

Linea is a Layer 2 rollup to Ethereum developed by Consensys. Linea is fully EVM compatible and has a fast block time of approximately 2 seconds. Linea is also a zero-knowledge (zk) rollup.

Live transaction monitor

Now let’s create a simple live transaction monitor script. The script connects to the Linea mainnet over a Chainstack Linea node RPC endpoint. Then the script polls the mainnet chain for each new block as it comes in, checks the number of transactions and prints the data in the terminal along with the adjustable visuals for easy viewing. This is an easy tutorial script, so the main goal here is to check:
  • How to use web3.py
  • How to connect to the Linea mainnet
  • How to handle POA networks correctly
  • How to poll the chain for new blocks and extract the number of transactions
Here’s the full script:

Conclusion

This tutorial provided a comprehensive guide to building real-time blockchain monitoring applications for Linea using Python. The monitoring approach demonstrated here can be easily extended to track specific contracts, tokens, or transaction patterns.

See also

Linea documentation

web3.py documentation

About the author

Ake

Ake Director of Developer Experience @ Chainstack
Talk to me all things Web3
20 years in technology | 8+ years in Web3 full time years experience
Last modified on March 26, 2026