Hanzo Web3 SDK
Enterprise blockchain infrastructure SDK for Python. Multi-chain RPC, Token APIs, NFT APIs, Smart Wallets, Webhooks, and more.
Installation
pip install hanzo-web3
# Or with uv
uv add hanzo-web3
Quick Start
from hanzo_web3 import Client
# Initialize client
client = Client(api_key="hz_live_...")
# Get latest block number
block = client.rpc.eth_block_number(chain="ethereum")
print(f"Latest block: {block}")
# Get token balances
balances = client.tokens.get_balances("0x...", chain="polygon")
for token in balances:
print(f"{token['symbol']}: {token['balance_formatted']}")
# Get NFTs owned
nfts = client.nfts.get_owned("0x...", chain="ethereum")
for nft in nfts:
print(f"{nft['name']} #{nft['token_id']}")
Async Client
import asyncio
from hanzo_web3 import AsyncClient
async def main():
async with AsyncClient(api_key="hz_live_...") as client:
# Parallel requests
eth_block, polygon_block = await asyncio.gather(
client.rpc.eth_block_number(chain="ethereum"),
client.rpc.eth_block_number(chain="polygon"),
)
print(f"ETH: {eth_block}, Polygon: {polygon_block}")
asyncio.run(main())
Features
RPC API
Direct JSON-RPC access to 100+ chains:
# Any RPC method
result = client.rpc.call("eth_getBalance", ["0x...", "latest"], chain="ethereum")
# Convenience methods
balance = client.rpc.eth_get_balance("0x...", chain="ethereum")
Token API
ERC-20 token data:
# Get all token balances
balances = client.tokens.get_balances("0x...", chain="ethereum")
# Get token metadata
metadata = client.tokens.get_metadata("0xA0b8...", chain="ethereum")
NFT API
NFT collections and metadata:
# Get owned NFTs
nfts = client.nfts.get_owned("0x...", chain="ethereum")
# Get NFT metadata
metadata = client.nfts.get_metadata("0x...", "1234", chain="ethereum")
Smart Wallets (ERC-4337)
Account abstraction:
# Create smart wallet
wallet = client.wallets.create(owner="0x...", chain="base")
print(f"Smart wallet: {wallet['address']}")
# Get wallet details
info = client.wallets.get(wallet['address'], chain="base")
Webhooks
Real-time event notifications:
# Create webhook
webhook = client.webhooks.create(
url="https://your-server.com/webhook",
event_type="ADDRESS_ACTIVITY",
chain="ethereum",
filters={"addresses": ["0x..."]}
)
# List webhooks
webhooks = client.webhooks.list()
# Delete webhook
client.webhooks.delete(webhook["id"])
Supported Chains
| Chain | Networks |
|---|---|
| Ethereum | mainnet, sepolia, holesky |
| Polygon | mainnet, amoy |
| Arbitrum | mainnet, sepolia |
| Optimism | mainnet, sepolia |
| Base | mainnet, sepolia |
| Avalanche | mainnet, fuji |
| BNB Chain | mainnet, testnet |
| Lux | mainnet, testnet |
| Solana | mainnet, devnet |
| + 90 more | ... |
Environment Variables
# API Key (alternative to passing in code)
export HANZO_WEB3_API_KEY=hz_live_...
# Custom API URL (for white-label deployments)
export HANZO_WEB3_BASE_URL=https://api.lux.cloud
Error Handling
from hanzo_web3 import Client
from hanzo_web3.exceptions import (
AuthenticationError,
RateLimitError,
ChainNotSupportedError,
)
try:
client = Client(api_key="invalid")
client.rpc.eth_block_number()
except AuthenticationError:
print("Invalid API key")
except RateLimitError as e:
print(f"Rate limited. Retry after {e.retry_after}s")
except ChainNotSupportedError as e:
print(f"Chain {e.chain} not supported")
Links
License
Apache 2.0 - See LICENSE for details.
Metadata
Release files for hanzo-web3 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 | Provenance | Actions |
|---|---|---|---|---|
| hanzo_web3-0.1.0.tar.gz | 7.0 kB | Without provenance | Details for hanzo_web3-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hanzo_web3-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for hanzo_web3-0.1.0-py3-none-any.whl |
Total release size: 15.1 kB
Release files / hanzo_web3-0.1.0.tar.gz
| Download URL | hanzo_web3-0.1.0.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
904f2ec2c099e61c3ca764b319ffe1fa3860ae2c8cccda9be39a0fe3c80d13ef
|
|
BLAKE2b-256 checksum How to use checksums |
38b9b8c12dc43b347ab22e61611370a22a67f717a5eba970e7401b623175c975
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / hanzo_web3-0.1.0-py3-none-any.whl
| Download URL | hanzo_web3-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8d0149a10ee60da47366cbe4a5de568ba4f5468163b893bc830c308c311da39f
|
|
BLAKE2b-256 checksum How to use checksums |
c5324e22261d223dc84d4536f0739fb287a2b658423ba0f60adfd6798615c5af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for hanzo-web3 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.