Arbitrum One
准备好在生产环境中调用了吗?
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
Arbitrum One
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
Python gives you two strong entry points to Arbitrum One. web3.py is the general-purpose client for scripting, backend services, and data pipelines, while eth-brownie wraps it in a framework built for smart-contract development, testing, and deployment. Both connect to the EVM-equivalent Nitro rollup at https://arbitrum.therpc.io/YOUR_API_KEY, and together they cover everything from a quick one-off balance script to a complex production application interacting with Arbitrum DeFi like Aave or GMX.
web3.py 6+ ships both synchronous and asynchronous interfaces. Synchronous code is fine for scripts and simple jobs against Arbitrum One; for concurrent workloads, switch to AsyncWeb3 paired with an async-compatible provider so many RPC calls run in flight at once rather than one after another.
Install with pip install web3, then instantiate the client by wrapping the Arbitrum One endpoint in an HTTP provider: Web3(Web3.HTTPProvider('https://arbitrum.therpc.io/YOUR_API_KEY')). web3.py is the de facto official Python library for Ethereum-compatible chains and exposes the full JSON-RPC API surface, so every method Arbitrum One supports — get_balance, get_block, send_raw_transaction, and the rest — is available directly.
eth-brownie is a Python framework focused on the smart-contract lifecycle — writing, compiling, testing, and deploying Solidity — and it works against Arbitrum One once you register the network in its config. Install it with pip install eth-brownie. It is the right tool when you are building and shipping your own contracts to the rollup rather than just calling existing ones.
The async interface centers on AsyncWeb3, which delivers far better throughput when you fire many Arbitrum One calls concurrently — for instance backfilling a range of blocks or polling several addresses at once. It requires an async-compatible provider and an asyncio event loop to drive the coroutines, as in the block-fetching example below.
web3.py ships comprehensive type stubs, so import TxParams, Wei, and Address from web3.types to annotate your Arbitrum One code. Typed signatures unlock IDE autocompletion and let mypy catch mistakes statically — for example flagging a plain int passed where a Wei value is expected before it ever reaches the network and risks a malformed transaction.