Skip to main content
TLDR:
  • This tutorial shows how to scan recent blocks on Klaytn Mainnet to find the top 3 most interacted-with contracts.
  • It uses web3.py, checks if addresses are contracts by retrieving bytecode, and caches results for efficiency.
  • A heap is used to store and retrieve the top 3 busiest contracts, and the script supports multithreading.
  • Can be adapted for analytics, alerts, or bot flows leveraging real-time contract interaction data.

Main article

Klaytn is an EVM-compatible protocol with a few modifications. Check the Klaytn docs for a full break-down on the compatibility: Ethereum Compatibility. In this tutorial, we’ll build a quick Python project called Contract Sizzle 100. Contract Sizzle 100 prints the top 3 hottest contracts on the Klaytn Mainnet (aka Cypress Network) over the past 100 blocks. The way it works is very simple: the script ingests each new incoming block from the Klaytn Mainnet, extracts all contract interactions, counts them and prints the top3 contracts that had the most interactions.

Prerequisites

Step-by-step

Get a Klaytn node

Log in to your Chainstack account and deploy a node.

Create the script

A few details on the implementation. How do you actually identify the contract addresses? One easy way is to:
  1. Retrieve off the network each block with all transactions in the block.
  2. Extract the to: address.
  3. Check if the extracted address is a contract by doing an eth_getCode to the address.
This process in Python, however, can be slow, so let’s optimize it a bit: Here’s the final script:
where
  • CHAINSTACK_NODE — your Klaytn node deployed with Chainstack
  • max_workers=10 — set to however parallel threads you feel is reasonable. Make sure don’t hit the limits: Limits.

Conclusion

This tutorial guided you through creating a basic setup to live-track the hottest contract on the Klaytn Network. There are many fun ways you can use it as basis to build upon — from passing the data to a Twitter bot account to setting up your own alerts or bot flow.

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 April 13, 2026