Skip to main content

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:

    from web3client.base_client import BaseClient
    
    client = BaseClient("wss://mainnet.era.zksync.io/ws")
    client.subscribe(lambda tx, _, __: print(f"Pending tx: {tx}"))
    
  • Send 1 ETH and 100 USDC to Unicef, using a dual client:

    from web3client.erc20_client import DualClient
    
    rpc = "https://cloudflare-eth.com"
    private_key = "0x..."
    unicef = "0xA59B29d7dbC9794d1e7f45123C48b2b8d0a34636"
    USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
    
    usdc_client = DualClient(rpc, private_key=private_key, contract_address=USDC)
    usdc_client.send_eth(unicef, 1)
    usdc_client.transfer(unicef, 100)
    

More examples

Please find more examples

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``:

pytest_plugins = [
    "web3test-ape", "web3test-web3client", "web3test-web3factory"
]

The order of the plugins in the aray is important.

It doesn't work 😡

Don't panic! Instead...

  1. Please check if your issue is listed in the Issues tab.
  2. If not, consider writing a new issue 🙂

Contributing

All contributions are welcome! To start improving web3client, please refer to our contribution guide.

Metadata

Release files for web3client 1.3.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for web3client 1.3.11
File Size Uploaded
web3client-1.3.11.tar.gz 2.2 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for web3client 1.3.11
File Interpreter ABI Platform
web3client-1.3.11-py3-none-any.whl Python 3 none any Details

Total release size: 4.9 MB

Release files / web3client-1.3.11.tar.gz

Download URL web3client-1.3.11.tar.gz
Size 2.2 MB
Tags Source
SHA-256 checksum
How to use checksums
c1045deab4b0b14ce000e0d51f8de95366b39d567c6ae9c82df04dcefe1a3317
BLAKE2b-256 checksum
How to use checksums
1b01cc42f1706effb3901695b6a536a420ffedbf6068c28cd1cd63e5a863a11f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.12.3 CPython/3.12.2

Release files / web3client-1.3.11-py3-none-any.whl

Download URL web3client-1.3.11-py3-none-any.whl
Size 2.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
e3ffc9b1519832c64557ee69fc21716d98020cae24cf620b2bcbac5e4f934cfd
BLAKE2b-256 checksum
How to use checksums
e27ca484043563a0031fa151bc9c105b6599fb5a860e79f7349888a239e70c63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.12.3 CPython/3.12.2

Release history Release notifications | RSS feed

This release

1.3.11 This release

2 release files

1.3.10

2 release files

1.3.9

2 release files

1.3.8

2 release files

1.3.7

2 release files

1.3.6

2 release files

1.3.5

2 release files

1.3.4

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.9

2 release files

1.2.8

2 release files

1.2.7

2 release files

1.2.6

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.13

2 release files

1.1.12

2 release files

1.1.11

2 release files

1.1.10

2 release files

1.1.9

2 release files

1.1.8

2 release files

1.1.7

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page