Python Web3 CLI
A simple and powerful Ethereum command-line interface built with web3.py.
Features
- Config: Manage RPC URLs and private keys securely via a local
.envfile. - Account: Check ETH balance for any address or your default account.
- Blockchain: Retrieve detailed information for blocks and transactions.
- Transfers: Send ETH to any Ethereum address.
- Rich UI: Beautiful terminal output using the
richlibrary.
Installation
pip install python-web3-cli
Usage
1. Configuration
Set your RPC provider (e.g., Infura, Alchemy, or public nodes):
web3-cli config WEB3_RPC_URL https://eth.llamarpc.com
Set your private key to enable sending ETH:
web3-cli config WEB3_PRIVATE_KEY your_private_key_here
2. Commands
Check Balance
# Check your own balance (requires private key in config)
web3-cli balance
# Check balance of a specific address
web3-cli balance 0x...
Get Block Info
web3-cli block latest
web3-cli block 17000000
Get Transaction Info
web3-cli tx 0x...
Send ETH
web3-cli send 0x... 0.01
3. Advanced Features
Smart Contract Interaction
You can call contract functions using their signature or a full JSON ABI.
Read Data (Call)
# Using function signature (defaults to view/uint256)
web3-cli contract call 0x... "balanceOf(address)" 0x...
# Using full ABI file
web3-cli contract call 0x... name --abi ./erc20.json
Write Data (Transact)
web3-cli contract transact 0x... "transfer(address,uint256)" 0x... 1000000
Proxy Calls
To call a proxy contract, provide the proxy address and the ABI of the implementation:
web3-cli contract call [PROXY_ADDR] "someMethod()" --abi ./implementation.json
Multi-sig & Offline Signing
Sign a transaction (without sending)
web3-cli sign 0x... 0.1
This outputs a raw hex string that can be shared or saved.
Send a pre-signed transaction
web3-cli send-raw <RAW_HEX>
Advanced State & Event Queries
Get contract bytecode
web3-cli contract code 0x...
Read raw storage slot
web3-cli contract storage 0x... 0
Get transaction receipt (execution status)
web3-cli receipt 0x...
Query event logs
web3-cli logs --address 0x... --from-block 17000000
Account & Security
Create a new account
web3-cli account create
Sign a message (EIP-191)
web3-cli account sign-message "Hello Web3"
Verify a signature
web3-cli account verify-message "Hello Web3" <signature> <address>
License
MIT
Metadata
Release files for python-web3-cli 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| python_web3_cli-0.1.0.tar.gz | 8.9 kB | Details |
Release files / python_web3_cli-0.1.0.tar.gz
| Download URL | python_web3_cli-0.1.0.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e4bdc233f1735ae9b1f1fac94f80bfd0d1a0618c2c3520ae6f6ba26acaa6b738
|
|
BLAKE2b-256 checksum How to use checksums |
2cb884e2eaa47337ee33e612ea60ad0e7df6bb59bbd6439c55883a6230ba058f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.8
|