Sei is fully EVM-compatible, so any standard Ethereum client works — including Python’s web3.py. This guide connects to Sei from a Python script, reads chain data with no credentials, then signs and broadcasts a transaction.
Install
We recommend an isolated virtual environment:
Reading Chain Data
This is the first milestone — it needs no private key.
You’re done when you see:
Values are illustrative — your block number, and the queried address’s balance and nonce, will differ. The EVM chain ID is always 1329 on Sei Mainnet and 1328 on Sei Testnet.
Try it live
web3.py issues plain JSON-RPC under the hood — here are the same reads against Sei Mainnet, no Python required.
Sending a Transaction
Next step — this requires a funded account. Get testnet SEI from the faucet, then build, sign locally, and broadcast with eth_sendRawTransaction. Public RPC endpoints don’t manage accounts, so you sign the transaction yourself rather than relying on node-managed accounts.
Never hard-code or commit a private key. Load it from an environment variable or a secrets manager, and use a dedicated throwaway key funded with only what you need.
signed.raw_transaction is the attribute name in web3.py v7+. On web3.py v6 it is signed.rawTransaction.
Reading a Contract
Next Steps