web3-constant
История выпусков Уведомления о выпусках | Лента RSS
Эта версия
Загрузка файлов
Загрузите файл для вашей платформы. Если вы не уверены, какой выбрать, узнайте больше об установке пакетов.
Источник распределения
Uploaded 2 мая 2022 г. source
Построенный дистрибутив
Uploaded 2 мая 2022 г. py3
Хеши для web3-constant-0.0.6.tar.gz
| Алгоритм | Хеш-дайджест | |
|---|---|---|
| SHA256 | 63c4d78c2f399711a23c01d9dfc1f81706e2d4db9851bed1fe45a883bf597f95 | Копировать |
| MD5 | 869755c42f41d27a2aab68ac8afe99e1 | Копировать |
| BLAKE2b-256 | 5e782c8dbc2dc63c97d81c208ef66613b6cc746adf7e4f93c40930b6473cd8cb | Копировать |
Хеши для web3_constant-0.0.6-py3-none-any.whl
| Алгоритм | Хеш-дайджест | |
|---|---|---|
| SHA256 | 3820273585eb26c6187b72e85e1018b74b4e735cd003ed01bc5139bad571275b | Копировать |
| MD5 | 71bf34853bd0feeac0689abd0fc5a26b | Копировать |
| BLAKE2b-256 | 3ab18cbdc812b89e569e558b262480e896ffcd8216296841c8d49e0b46468830 | Копировать |
Помощь
О PyPI
Внесение вклада в PyPI
Использование PyPI
Разработано и поддерживается сообществом Python’а для сообщества Python’а.
Пожертвуйте сегодня!
PyPI», «Python Package Index» и логотипы блоков являются зарегистрированными товарными знаками Python Software Foundation.
Quickstart
All code starting with a $ is meant to run on your terminal. All code starting with a >>> is meant to run in a python interpreter, like ipython.
Installation
web3.py can be installed (preferably in a virtualenv ) using pip as follows:
$ pip install web3
If you run into problems during installation, you might have a broken environment. See the troubleshooting guide to setting up a clean environment .
Using Web3
This library depends on a connection to an Ethereum node. We call these connections Providers and there are several ways to configure them. The full details can be found in the Providers documentation. This Quickstart guide will highlight a couple of the most common use cases.
Test Provider
If you’re just learning the ropes or doing some quick prototyping, you can use a test provider, eth-tester. This provider includes some accounts prepopulated with test ether and instantly includes each transaction into a block. web3.py makes this test provider available via EthereumTesterProvider .
The EthereumTesterProvider requires additional dependencies. Install them via pip install «web3[tester]» , then import and instantiate the provider as seen below.
>>> from web3 import Web3, EthereumTesterProvider >>> w3 = Web3(EthereumTesterProvider()) >>> w3.is_connected() True
Local Providers
The hardware requirements are steep, but the safest way to interact with Ethereum is to run an Ethereum client on your own hardware. For locally run nodes, an IPC connection is the most secure option, but HTTP and websocket configurations are also available. By default, the popular Geth client exposes port 8545 to serve HTTP requests and 8546 for websocket requests. Connecting to this local node can be done as follows:
>>> from web3 import Web3, AsyncWeb3 # IPCProvider: >>> w3 = Web3(Web3.IPCProvider('./path/to/geth.ipc')) # HTTPProvider: >>> w3 = Web3(Web3.HTTPProvider('http://127.0.0.1:8545')) # WebsocketProvider: >>> w3 = Web3(Web3.WebsocketProvider('wss://127.0.0.1:8546')) >>> w3.is_connected() True # AsyncHTTPProvider: >>> w3 = AsyncWeb3(AsyncWeb3.AsyncHTTPProvider('http://127.0.0.1:8545')) >>> await w3.is_connected() True
Remote Providers
The quickest way to interact with the Ethereum blockchain is to use a remote node provider. You can connect to a remote node by specifying the endpoint, just like the previous local node example:
>>> from web3 import Web3, AsyncWeb3 >>> w3 = Web3(Web3.HTTPProvider('https://')) >>> w3 = AsyncWeb3(AsyncWeb3.AsyncHTTPProvider('https://')) >>> w3 = Web3(Web3.WebsocketProvider('wss://'))
This endpoint is provided by the remote node service, typically after you create an account.
Getting Blockchain Info
It’s time to start using web3.py! Once properly configured, the w3 instance will allow you to interact with the Ethereum blockchain. Try getting all the information about the latest block:
>>> w3.eth.get_block('latest') 'gasLimit': 6283185, 'gasUsed': 0, 'hash': HexBytes('0x53b983fe73e16f6ed8178f6c0e0b91f23dc9dad4cb30d0831f178291ffeb8750'), 'logsBloom': HexBytes('0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'), 'miner': '0x0000000000000000000000000000000000000000', 'mixHash': HexBytes('0x0000000000000000000000000000000000000000000000000000000000000000'), 'nonce': HexBytes('0x0000000000000000'), 'number': 0, 'parentHash': HexBytes('0x0000000000000000000000000000000000000000000000000000000000000000'), 'proofOfAuthorityData': HexBytes('0x0000000000000000000000000000000000000000000000000000000000000000dddc391ab2bf6701c74d0c8698c2e13355b2e4150000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'), 'receiptsRoot': HexBytes('0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421'), 'sha3Uncles': HexBytes('0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347'), 'size': 622, 'stateRoot': HexBytes('0x1f5e460eb84dc0606ab74189dbcfe617300549f8f4778c3c9081c119b5b5d1c1'), 'timestamp': 0, 'totalDifficulty': 1, 'transactions': [], 'transactionsRoot': HexBytes('0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421'), 'uncles': []>
web3.py can help you read block data, sign and send transactions, deploy and interact with contracts, and a number of other features.
A few suggestions from here:
- The Overview page provides a summary of web3.py’s features.
- The w3.eth API contains the most frequently used methods.
- A guide to Contracts includes deployment and usage examples.
- The nuances of Sending Transactions are explained in another guide.
- For other inspiration, see the Examples .
It is recommended that your development environment have the PYTHONWARNINGS=default environment variable set. Some deprecation warnings will not show up without this variable being set.
© Copyright 2023, Ethereum Foundation. Revision ecc45a4b .
Quickstart
All code starting with a $ is meant to run on your terminal. All code starting with a >>> is meant to run in a python interpreter, like ipython.
Installation
web3.py can be installed (preferably in a virtualenv ) using pip as follows:
$ pip install web3
If you run into problems during installation, you might have a broken environment. See the troubleshooting guide to setting up a clean environment .
Using Web3
This library depends on a connection to an Ethereum node. We call these connections Providers and there are several ways to configure them. The full details can be found in the Providers documentation. This Quickstart guide will highlight a couple of the most common use cases.
Test Provider
If you’re just learning the ropes or doing some quick prototyping, you can use a test provider, eth-tester. This provider includes some accounts prepopulated with test ether and instantly includes each transaction into a block. web3.py makes this test provider available via EthereumTesterProvider .
The EthereumTesterProvider requires additional dependencies. Install them via pip install «web3[tester]» , then import and instantiate the provider as seen below.
>>> from web3 import Web3, EthereumTesterProvider >>> w3 = Web3(EthereumTesterProvider()) >>> w3.is_connected() True
Local Providers
The hardware requirements are steep, but the safest way to interact with Ethereum is to run an Ethereum client on your own hardware. For locally run nodes, an IPC connection is the most secure option, but HTTP and websocket configurations are also available. By default, the popular Geth client exposes port 8545 to serve HTTP requests and 8546 for websocket requests. Connecting to this local node can be done as follows:
>>> from web3 import Web3, AsyncWeb3 # IPCProvider: >>> w3 = Web3(Web3.IPCProvider('./path/to/geth.ipc')) # HTTPProvider: >>> w3 = Web3(Web3.HTTPProvider('http://127.0.0.1:8545')) # WebsocketProvider: >>> w3 = Web3(Web3.WebsocketProvider('wss://127.0.0.1:8546')) >>> w3.is_connected() True # AsyncHTTPProvider: >>> w3 = AsyncWeb3(AsyncWeb3.AsyncHTTPProvider('http://127.0.0.1:8545')) >>> await w3.is_connected() True
Remote Providers
The quickest way to interact with the Ethereum blockchain is to use a remote node provider. You can connect to a remote node by specifying the endpoint, just like the previous local node example:
>>> from web3 import Web3, AsyncWeb3 >>> w3 = Web3(Web3.HTTPProvider('https://')) >>> w3 = AsyncWeb3(AsyncWeb3.AsyncHTTPProvider('https://')) >>> w3 = Web3(Web3.WebsocketProvider('wss://'))
This endpoint is provided by the remote node service, typically after you create an account.
Getting Blockchain Info
It’s time to start using web3.py! Once properly configured, the w3 instance will allow you to interact with the Ethereum blockchain. Try getting all the information about the latest block:
>>> w3.eth.get_block('latest') 'gasLimit': 6283185, 'gasUsed': 0, 'hash': HexBytes('0x53b983fe73e16f6ed8178f6c0e0b91f23dc9dad4cb30d0831f178291ffeb8750'), 'logsBloom': HexBytes('0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'), 'miner': '0x0000000000000000000000000000000000000000', 'mixHash': HexBytes('0x0000000000000000000000000000000000000000000000000000000000000000'), 'nonce': HexBytes('0x0000000000000000'), 'number': 0, 'parentHash': HexBytes('0x0000000000000000000000000000000000000000000000000000000000000000'), 'proofOfAuthorityData': HexBytes('0x0000000000000000000000000000000000000000000000000000000000000000dddc391ab2bf6701c74d0c8698c2e13355b2e4150000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'), 'receiptsRoot': HexBytes('0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421'), 'sha3Uncles': HexBytes('0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347'), 'size': 622, 'stateRoot': HexBytes('0x1f5e460eb84dc0606ab74189dbcfe617300549f8f4778c3c9081c119b5b5d1c1'), 'timestamp': 0, 'totalDifficulty': 1, 'transactions': [], 'transactionsRoot': HexBytes('0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421'), 'uncles': []>
web3.py can help you read block data, sign and send transactions, deploy and interact with contracts, and a number of other features.
A few suggestions from here:
- The Overview page provides a summary of web3.py’s features.
- The w3.eth API contains the most frequently used methods.
- A guide to Contracts includes deployment and usage examples.
- The nuances of Sending Transactions are explained in another guide.
- For other inspiration, see the Examples .
It is recommended that your development environment have the PYTHONWARNINGS=default environment variable set. Some deprecation warnings will not show up without this variable being set.
© Copyright 2023, Ethereum Foundation. Revision 6ea78ef8 .
web3client 1.3.7
Batteries-included client to interact with blockchains and smart contracts; used by web3cli and crabada.py.
Features
- Easily create a client to interact with EVM-compatible chains
- Works with Ethereum, Binance, Avalanche, Arbitrum One, zkSync Era, etc.
- Subscribe to pending transactions in the mempool and new blocks
- Flexible logging of RPC calls and transactions
- Interact with tokens and ETH with the same dual interface
- Includes a client for Compound V2 operations, and its clones
- Save gas by setting an upper limit on the base fee
- Need more flexibility? Use directly the underlying web3.py client
Install
pip3 install -U web3client
Examples
- Stream pending transactions on the zkSync Era network:
More examples
Please find more examples
- in the examples folder, and
- in the tests folder.
Test suite web3test
web3client comes with several pytest plugins you can use to test your scripts:
- web3test-ape : fixtures of accounts and smart contracts (erc20, compound, etc)
- web3test-web3client : fixtures of clients for various smart contracts
- web3test-web3factory : fixtures of clients for various chains
To use one or more plugins in your script, add the following lines at the top of your `conftest.py«:
The order of the plugins in the aray is important.
It doesn’t work
Don’t panic! Instead.
- Please check if your issue is listed in the Issues tab.
- If not, consider writing a new issue
Contributing
All contributions are welcome! To start improving web3client , please refer to our contribution guide.