Skip to main content
This tutorial teaches you how to query Monad blockchain data using Python and web3.py. All examples are read-only operations that don’t require any MON tokens, making this perfect for getting started.
Get your own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.

Prerequisites

  • Python 3.8 or higher
  • Basic Python knowledge
Install web3.py:

Connect to Monad testnet

Create a Web3 instance to connect to Monad:
Monad testnet details:
  • Chain ID: 10143
  • Block time: ~1 second
  • 100% EVM compatible

Get latest block number

The simplest query - get the current block height:

Check account balance

Query the MON balance of any address:

Get transaction count (nonce)

Check how many transactions an address has sent:

Fetch block by hash

Retrieve detailed block information:

Get transaction details

Inspect a specific transaction:

Get transaction receipt

Check execution results and logs:

Call a smart contract

Read data from a contract without sending a transaction. This example calls the name() function on the Wrapped Monad (WMON) contract:

Using contract ABI

For easier interaction, use the contract ABI:

Check if address is a contract

Determine whether an address is a smart contract or an externally owned account (EOA):

Read contract storage

Access raw storage slots of a contract:

Build a simple block monitor

Stream new blocks in real time with eth_subscribe("newHeads") over WebSocket:
If you can’t use WebSocket, poll instead:

Complete example

Here’s a script that demonstrates multiple queries:

Monad-specific notes

Key differences from other EVM chains:
  • 1-second finality — blocks are finalized immediately, no reorganizations
  • No pending transactionseth_getTransactionByHash only returns confirmed transactions
  • eth_subscribe subsetnewHeads and logs are supported; newPendingTransactions and syncing return -32602 Invalid params
  • Block gas limit — 300M gas per block

Next steps

Now that you can query blockchain data, you can:
  • Build dashboards to visualize network activity
  • Monitor specific addresses or contracts
  • Create alerts for on-chain events
  • Develop analytics tools
For sending transactions, you’ll need testnet MON tokens from a faucet.
Last modified on June 22, 2026