web3cli


Nameweb3cli JSON
Version 1.1.36 PyPI version JSON
download
home_pageNone
SummaryInteract with blockchains and smart contracts using the command line
upload_time2024-12-02 17:02:11
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT
keywords web3 w3 cli evm blockchain ethereum binance avalanche
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <!-- https://shields.io/ --> 
<p align="center">
    <a href="https://github.com/coccoinomane/web3cli/pulse" alt="Activity"><img src="https://img.shields.io/github/commit-activity/m/badges/shields?color=009051"/></a>
    <img src="https://img.shields.io/github/last-commit/coccoinomane/web3cli?color=009051"/>
</p>
<p align="center">
        <a href="https://www.alchemy.com/dapps/web3cli"><img style="width:150px;height:33px" src="https://static.alchemyapi.io/images/marketing/badge.png"/></a>
</p>

Interact with blockchains and smart contracts using the command line: no coding needed!

# Table of contents

- [Features](#features)
- [Install](#install)
- [Simple examples](#simple-examples)
- [Advanced examples](#advanced-examples)
- [Smart Contract support](#smart-contract-support)
    + [Read from a smart contract](#read-from-a-smart-contract)
    + [Send a transaction to a smart contract](#send-a-transaction-to-a-smart-contract)
- [Multi-chain support](#multi-chain-support)
- [Use custom RPC](#use-custom-rpc)
- [Add custom chains](#add-custom-chains)
- [Address book](#address-book)
- [Wallet management](#wallet-management)
    + [Default signer](#default-signer)
    + [Create new private keys](#create-new-private-keys)
- [Documentation](#documentation)
- [Contributing](#contributing)
- [Acknowledgements](#acknowledgements)

# Features

- Interact with Ethereum and EVM-compatible chains via your terminal
- Bypass sluggish and potentially compromised frontends
- No configuration needed
- Label addresses, tokens and contracts for ease of use
- Swap with Uniswap, TraderJoe, PancakeSwap, etc
- Support for the Compound V2 lending protocol and its forks (e.g. Eralend)
- Transfer tokens via their ticker
- Set Telegram alerts based on pending transactions, new blocks and contract events
- Replay transactions just with the tx hash
- Concatenate commands to build powerful scripts
- Import signers via private key or keyfile
- Thoroughly tested using the [Ape Framework](https://github.com/ApeWorX/ape)'s testing framework
- [Windows compatible](https://github.com/coccoinomane/web3cli/wiki/%F0%9F%AA%9F-Run-web3cli-on-Windows)

Soon:

- React to pending transactions, new blocks and contract events
- Set up scheduled buys and sells (DCA)
- Automatically buy when slippage is low enough
- Get notified on Telegram when a pair is liquid enough, or unbalanced
- Analyze on-chain data for tax or sleuthing purposes
- Claim and reinvest yield from DeFi protocols


# Install

Make sure you have at least Python 3.9 installed, then run:

```bash
pip3 install -U web3cli
```

The same command will also upgrade web3cli to the latest version.

*Windows user?* [Here's a tutorial for you](https://github.com/coccoinomane/web3cli/wiki/%F0%9F%AA%9F-Run-web3cli-on-Windows)!

## Install via pipx

Fan of isolated environments?  Install web3cli via [pipx](https://pypa.github.io/pipx/):

```bash
pipx install web3cli
```

To upgrade web3cli, run `pipx upgrade web3cli`.

# Simple examples

- Get list of available commands:
   ```bash
   w3 --help
   ```
  or visit the Wiki page [List of commands](https://github.com/coccoinomane/web3cli/wiki/%F0%9F%AB%A1-List-of-commands).

- Get help for a given command:
   ```bash
   w3 balance --help
   ```

- Get the ETH balance of any address:
   ```
   w3 balance 0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae
   ```

- Save addresses with easy-to-rember tags:
   ```
   w3 address add unicef 0xa59b29d7dbc9794d1e7f45123c48b2b8d0a34636
   ```
   then use the tag in any command:
   ```
   w3 balance unicef
   ```

- Fetch blocks from the blockchain, in easy-to-read JSON format:
   ```bash
   w3 block latest
   w3 block finalized
   w3 block 6094305
   ```

- Fetch transactions & receipts from the blockchain:
   ```bash
   w3 tx get 0x3bbdcc2c7721521f7c767b7873ccb857f0816ac94e9f32c5601f4b15c87d1ef1
   w3 tx rc 0x3bbdcc2c7721521f7c767b7873ccb857f0816ac94e9f32c5601f4b15c87d1ef1
   ```

- Extract single fields from blocks or transactions, using `jq` (more details [in the Wiki](https://github.com/coccoinomane/web3cli/wiki/%E2%86%AA%EF%B8%8F-Output-processing)):
   ```bash
   w3 block latest | jq -r '.baseFeePerGas'
   ```

- Sign messages:
   ```bash
   w3 sign 'Hello world!'
   ```

- Get Keccak256 hashes starting from a text or a hex-string:
   ```bash
   w3 keccak-text 'Hello world!'
   w3 keccak-hex 'b495b1154ef1b2'
   ```

# Advanced examples

- Send coins or tokens to any address:
   ```
   w3 send unicef 1 ETH      # send 1 ETH, ask for confirmation
   w3 send unicef 1 ETH gwei # send 1 gwei, ask for confirmation
   w3 send unicef 1 usdc     # send 1 USDC
   ```

- Swap tokens on a DEX:
   ```
   w3 swap uniswap_v2 1 usdc usdt     # swap 1 USDC for USDT on Uniswap
   w3avax swap traderjoe 1 usdc wavax # swap 1 USDC for WAVAX on TraderJoe
   ```

- Stream blocks, transactions and contract events as they happen in realtime:
   ```
   w3 subscribe blocks   # stream blocks as they are mined
   w3 subscribe pending  # stream pending transactions
   w3 subscribe events   # stream all contract events
   ```
  Streaming requires a websocket connection: specify one with the `--rpc wss://...` flag.

- Set a Telegram alert for when a specific event is emitted:
   ```bash
   # Get notified on Telegram when USDC is transferred
   transfer=0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
   w3 subscribe events --telegram --contracts usdc --topics $transfer
   # Send a post notification when USDC is transferred
   w3 subscribe events --post https://www.example.com/ --contracts usdc --topics $transfer
   ```
  Telegram alerts require setting up a Telegram bot, please find instructions [in the Wiki](https://github.com/coccoinomane/web3cli/wiki/%F0%9F%93%AD-Telegram-alerts).

- Replay a given transactions on the blockchain:
   ```bash
   tx=`w3 send unicef 1 USDC --force` # send 1 USDC to Unicef
   w3 replay $tx                      # re-send 1 USDC to Unicef
   ```

# Smart Contract support

web3cli comes preloaded with some popular smart contracts, including ERC20 tokens and Uniswap clones.

See the available contracts with `w3 contract list`:

```bash
w3 contract list               # contracts on Ethereum
w3 contract list --chain bnb   # contracts on BNB chain
w3 contract list --type erc20  # tokens on Ethereum
```

You can also add custom contracts with `w3 contract add`:

```bash
w3 contract add weth 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 --type erc20
w3 contract add sushi 0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F --type uniswap_v2
```

To add or list new tokens, you can use the `w3 token` shorthand:

```bash
w3 token add weth 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
w3 token list
w3 token delete weth
```

A more complex example: check USDT total supply on Arbitrum 100,000 blocks ago:

```bash
w3arb token supply usdt --block $(($(w3arb bnum)-100000))
```

For any given contract, see available functions and events with `w3 abi functions` and `w3 abi events`:

```bash
w3 abi fns weth           # functions on WETH token
w3 abi evs uniswap_v2     # events on Uniswap V2
w3 abi fns --abi abi.json # functions of an arbitrary ABI
```

### Read from a smart contract

To read from a smart contract, use `w3 call`. For example, to get the total
supply of the WETH token, run:

```bash
w3 call weth totalSupply
```

Function arguments are parsed automatically, so you can call `balanceOf` with:

```bash
w3 call weth balanceOf 0xA59B29d7dbC9794d1e7f45123C48b2b8d0a34636
```

You can also do more complex stuff like:

```bash
# get the amount of USDT you get for 100 USDC
w3 call uniswap_v2 getAmountsOut 100e6 usdc,usdt | jq -r '.[1]' 
```

### Send a transaction to a smart contract

To write to the blockchain, use `w3 transact`. For example, to transfer 1 ETH to 
address, run:

```bash
w3 transact weth transfer <address> 1e18
```

To swap 1 USDC for USDT on Uniswap, accepting no less than 0.9 USDT in return, run:

```bash
w3 transact usdc approve uniswap_v2 1e6
w3 transact uniswap_v2 swapExactTokensForTokens 1e6 0.9e6 usdc,usdt <receiver address> 9e9
```

# Multi-chain support

web3cli comes with out-of-the-box support for many chains.  To see the list of available chains, [visit the Wiki](https://github.com/coccoinomane/web3cli/wiki/%E2%9B%93-Supported-chains) or run the command `w3 chain list`.

Pass the chain name using the flag `--chain` or the shorthand `-c`:

```bash
w3 balance 0x8894e0a0c962cb723c1976a4421c95949be2d4e3 --chain bnb  # bnb chain
w3 balance 0x8894e0a0c962cb723c1976a4421c95949be2d4e3 --chain avax # avax chain
```

You can also use one of the provided aliases, like `w3bnb`, `w3avax`, or `w3arb`:

```bash
w3bnb balance 0x8894e0a0c962cb723c1976a4421c95949be2d4e3  # bnb chain
w3avax balance 0x8894e0a0c962cb723c1976a4421c95949be2d4e3 # avax chain
```

If you are focussing on a specific chain, set it as the default:

```bash
w3 config set default_chain bnb
w3 balance 0x8894e0a0c962cb723c1976a4421c95949be2d4e3             # bnb chain
w3 balance 0x8894e0a0c962cb723c1976a4421c95949be2d4e3 --chain eth # eth chain
```

# Use custom RPC

By default, web3cli will connect to the blockchain using a pre-configured public node.  You can see the list of such nodes with the command `w3 rpc list`.

To use a custom mode, please specify the `--rpc` flag.  For example, to use Ankr's node to Ethereum:

```bash
w3 block latest --rpc https://rpc.ankr.com/eth
```

Using a custom node is most useful in the following situations:

1. You want to use a node from a node provider, e.g. Infura:
   ```bash
   w3 block --rpc https://eth-mainnet.g.alchemy.com/v2/{YOUR-API-KEY}
   ```
2. You want to use a private node:
   ```bash
   w3 block --rpc http://127.0.0.1:8545
   w3 block --rpc ws://127.0.0.1:8546
   ```
3. You want to use a testnet chain:
   ```bash
   w3eth block --rpc https://rpc.ankr.com/eth_goerli
   w3bnb block --rpc https://data-seed-prebsc-1-s1.binance.org:8545/
   ```


# Add custom chains

Add new chains with `w3 chain add`:

```bash
w3 chain add cronos 25 CRO --tx-type 2 --rpc https://evm.cronos.org
```

Use the custom chain with `--chain`:

```bash
w3 balance 0x7de9ab1e6a60ac7a70ce96d1d95a0dfcecf7bfb7 --chain cronos
```

List existing chains with `w3 chain list`, and delete them with `w3 chain delete`.


# Address book

`w3` can store tags just like you would do on etherscan.io or bscscan.com:

```bash
w3 address add ethereum_foundation 0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae
w3 address add binance_hot_wallet 0x8894e0a0c962cb723c1976a4421c95949be2d4e3
```

You can use these tags instead of the actual addresses:

```bash
w3 balance ethereum_foundation
w3 balance binance_hot_wallet --chain bnb
```

To see the list of saved addresses, run `w3 address list`, to delete an address use `w3 address delete`.

# Wallet management

Commands such as `w3 send` and `w3 swap` require that you specify who is going to sign the transactions.  You can specify the signer with the `--signer` or `-s` flag:

```bash
w3 <command> --signer my-signer
```

Here, `my_signer` can be any of these things:

- The name or the address of a signer that you previously registered with `w3 signer add my_signer`.  Signers created in this way are encrypted with the app key and stored in the database.  At any time, you can see the list of registered users by running `w3 signer list`.
- The path to a file that you previously created with `w3 keyfile create`.  A keyfile is a simple JSON file that contains your private key in password-encrypted form.  Feel free to use keyfiles generated by other tools, like geth, parity, brownie, etc.
- The actual private key of the signer that you want to use.  This is unsafe, use it at your own risk!

Please note that when the `--signer` flag is not provided, and there is only one registered signer, then this will be used.


### Default signer

If you plan to use the same signer for a while, make it the **default signer** with the command:

```bash
w3 config set default_signer my_signer
```

In this way, you will not have to specify the `--signer` flag anymore.


### Create new private keys

You can also create a brand new wallet on the go, without the need to provide a key, by using the `--create` flag:

```bash
w3 signer add my_wallet --create
```

The resulting private key will be printed to screen.

# Documentation

Check the [project's wiki on Github](https://github.com/coccoinomane/web3cli/wiki/). In particular:

- [🫡 List of commands](https://github.com/coccoinomane/web3cli/wiki/%F0%9F%AB%A1-List-of-commands)
- [⛓ All supported chains](https://github.com/coccoinomane/web3cli/wiki/%E2%9B%93-Supported-chains)
- [📝 Configuration](https://github.com/coccoinomane/web3cli/wiki/%F0%9F%93%9D-Configuration)
- [🪟 Run web3cli on Windows](https://github.com/coccoinomane/web3cli/wiki/%F0%9F%AA%9F-Run-web3cli-on-Windows)
- [↪️ Output processing](https://github.com/coccoinomane/web3cli/wiki/%E2%86%AA%EF%B8%8F-Output-processing)

# Contributing

All contributions are welcome! To start improving web3cli, please refer to our [__contribution guide__](./CONTRIBUTING.md).

# Acknowledgements

Thank you very much to the communities behind [web3.py](https://github.com/ethereum/web3.py) and the [Ape Framework](https://github.com/ApeWorX/ape): web3cli would not exist without your efforts!


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "web3cli",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "web3, w3, cli, evm, blockchain, ethereum, binance, avalanche",
    "author": null,
    "author_email": "coccoinomane <coccoinomane@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/76/2b/1751991e23b43d0ccc2345fe111b402bbea7d5b56152d88a95c197009f09/web3cli-1.1.36.tar.gz",
    "platform": null,
    "description": "<!-- https://shields.io/ --> \n<p align=\"center\">\n    <a href=\"https://github.com/coccoinomane/web3cli/pulse\" alt=\"Activity\"><img src=\"https://img.shields.io/github/commit-activity/m/badges/shields?color=009051\"/></a>\n    <img src=\"https://img.shields.io/github/last-commit/coccoinomane/web3cli?color=009051\"/>\n</p>\n<p align=\"center\">\n        <a href=\"https://www.alchemy.com/dapps/web3cli\"><img style=\"width:150px;height:33px\" src=\"https://static.alchemyapi.io/images/marketing/badge.png\"/></a>\n</p>\n\nInteract with blockchains and smart contracts using the command line: no coding needed!\n\n# Table of contents\n\n- [Features](#features)\n- [Install](#install)\n- [Simple examples](#simple-examples)\n- [Advanced examples](#advanced-examples)\n- [Smart Contract support](#smart-contract-support)\n    + [Read from a smart contract](#read-from-a-smart-contract)\n    + [Send a transaction to a smart contract](#send-a-transaction-to-a-smart-contract)\n- [Multi-chain support](#multi-chain-support)\n- [Use custom RPC](#use-custom-rpc)\n- [Add custom chains](#add-custom-chains)\n- [Address book](#address-book)\n- [Wallet management](#wallet-management)\n    + [Default signer](#default-signer)\n    + [Create new private keys](#create-new-private-keys)\n- [Documentation](#documentation)\n- [Contributing](#contributing)\n- [Acknowledgements](#acknowledgements)\n\n# Features\n\n- Interact with Ethereum and EVM-compatible chains via your terminal\n- Bypass sluggish and potentially compromised frontends\n- No configuration needed\n- Label addresses, tokens and contracts for ease of use\n- Swap with Uniswap, TraderJoe, PancakeSwap, etc\n- Support for the Compound V2 lending protocol and its forks (e.g. Eralend)\n- Transfer tokens via their ticker\n- Set Telegram alerts based on pending transactions, new blocks and contract events\n- Replay transactions just with the tx hash\n- Concatenate commands to build powerful scripts\n- Import signers via private key or keyfile\n- Thoroughly tested using the [Ape Framework](https://github.com/ApeWorX/ape)'s testing framework\n- [Windows compatible](https://github.com/coccoinomane/web3cli/wiki/%F0%9F%AA%9F-Run-web3cli-on-Windows)\n\nSoon:\n\n- React to pending transactions, new blocks and contract events\n- Set up scheduled buys and sells (DCA)\n- Automatically buy when slippage is low enough\n- Get notified on Telegram when a pair is liquid enough, or unbalanced\n- Analyze on-chain data for tax or sleuthing purposes\n- Claim and reinvest yield from DeFi protocols\n\n\n# Install\n\nMake sure you have at least Python 3.9 installed, then run:\n\n```bash\npip3 install -U web3cli\n```\n\nThe same command will also upgrade web3cli to the latest version.\n\n*Windows user?* [Here's a tutorial for you](https://github.com/coccoinomane/web3cli/wiki/%F0%9F%AA%9F-Run-web3cli-on-Windows)!\n\n## Install via pipx\n\nFan of isolated environments?  Install web3cli via [pipx](https://pypa.github.io/pipx/):\n\n```bash\npipx install web3cli\n```\n\nTo upgrade web3cli, run `pipx upgrade web3cli`.\n\n# Simple examples\n\n- Get list of available commands:\n   ```bash\n   w3 --help\n   ```\n  or visit the Wiki page [List of commands](https://github.com/coccoinomane/web3cli/wiki/%F0%9F%AB%A1-List-of-commands).\n\n- Get help for a given command:\n   ```bash\n   w3 balance --help\n   ```\n\n- Get the ETH balance of any address:\n   ```\n   w3 balance 0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae\n   ```\n\n- Save addresses with easy-to-rember tags:\n   ```\n   w3 address add unicef 0xa59b29d7dbc9794d1e7f45123c48b2b8d0a34636\n   ```\n   then use the tag in any command:\n   ```\n   w3 balance unicef\n   ```\n\n- Fetch blocks from the blockchain, in easy-to-read JSON format:\n   ```bash\n   w3 block latest\n   w3 block finalized\n   w3 block 6094305\n   ```\n\n- Fetch transactions & receipts from the blockchain:\n   ```bash\n   w3 tx get 0x3bbdcc2c7721521f7c767b7873ccb857f0816ac94e9f32c5601f4b15c87d1ef1\n   w3 tx rc 0x3bbdcc2c7721521f7c767b7873ccb857f0816ac94e9f32c5601f4b15c87d1ef1\n   ```\n\n- Extract single fields from blocks or transactions, using `jq` (more details [in the Wiki](https://github.com/coccoinomane/web3cli/wiki/%E2%86%AA%EF%B8%8F-Output-processing)):\n   ```bash\n   w3 block latest | jq -r '.baseFeePerGas'\n   ```\n\n- Sign messages:\n   ```bash\n   w3 sign 'Hello world!'\n   ```\n\n- Get Keccak256 hashes starting from a text or a hex-string:\n   ```bash\n   w3 keccak-text 'Hello world!'\n   w3 keccak-hex 'b495b1154ef1b2'\n   ```\n\n# Advanced examples\n\n- Send coins or tokens to any address:\n   ```\n   w3 send unicef 1 ETH      # send 1 ETH, ask for confirmation\n   w3 send unicef 1 ETH gwei # send 1 gwei, ask for confirmation\n   w3 send unicef 1 usdc     # send 1 USDC\n   ```\n\n- Swap tokens on a DEX:\n   ```\n   w3 swap uniswap_v2 1 usdc usdt     # swap 1 USDC for USDT on Uniswap\n   w3avax swap traderjoe 1 usdc wavax # swap 1 USDC for WAVAX on TraderJoe\n   ```\n\n- Stream blocks, transactions and contract events as they happen in realtime:\n   ```\n   w3 subscribe blocks   # stream blocks as they are mined\n   w3 subscribe pending  # stream pending transactions\n   w3 subscribe events   # stream all contract events\n   ```\n  Streaming requires a websocket connection: specify one with the `--rpc wss://...` flag.\n\n- Set a Telegram alert for when a specific event is emitted:\n   ```bash\n   # Get notified on Telegram when USDC is transferred\n   transfer=0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\n   w3 subscribe events --telegram --contracts usdc --topics $transfer\n   # Send a post notification when USDC is transferred\n   w3 subscribe events --post https://www.example.com/ --contracts usdc --topics $transfer\n   ```\n  Telegram alerts require setting up a Telegram bot, please find instructions [in the Wiki](https://github.com/coccoinomane/web3cli/wiki/%F0%9F%93%AD-Telegram-alerts).\n\n- Replay a given transactions on the blockchain:\n   ```bash\n   tx=`w3 send unicef 1 USDC --force` # send 1 USDC to Unicef\n   w3 replay $tx                      # re-send 1 USDC to Unicef\n   ```\n\n# Smart Contract support\n\nweb3cli comes preloaded with some popular smart contracts, including ERC20 tokens and Uniswap clones.\n\nSee the available contracts with `w3 contract list`:\n\n```bash\nw3 contract list               # contracts on Ethereum\nw3 contract list --chain bnb   # contracts on BNB chain\nw3 contract list --type erc20  # tokens on Ethereum\n```\n\nYou can also add custom contracts with `w3 contract add`:\n\n```bash\nw3 contract add weth 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 --type erc20\nw3 contract add sushi 0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F --type uniswap_v2\n```\n\nTo add or list new tokens, you can use the `w3 token` shorthand:\n\n```bash\nw3 token add weth 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\nw3 token list\nw3 token delete weth\n```\n\nA more complex example: check USDT total supply on Arbitrum 100,000 blocks ago:\n\n```bash\nw3arb token supply usdt --block $(($(w3arb bnum)-100000))\n```\n\nFor any given contract, see available functions and events with `w3 abi functions` and `w3 abi events`:\n\n```bash\nw3 abi fns weth           # functions on WETH token\nw3 abi evs uniswap_v2     # events on Uniswap V2\nw3 abi fns --abi abi.json # functions of an arbitrary ABI\n```\n\n### Read from a smart contract\n\nTo read from a smart contract, use `w3 call`. For example, to get the total\nsupply of the WETH token, run:\n\n```bash\nw3 call weth totalSupply\n```\n\nFunction arguments are parsed automatically, so you can call `balanceOf` with:\n\n```bash\nw3 call weth balanceOf 0xA59B29d7dbC9794d1e7f45123C48b2b8d0a34636\n```\n\nYou can also do more complex stuff like:\n\n```bash\n# get the amount of USDT you get for 100 USDC\nw3 call uniswap_v2 getAmountsOut 100e6 usdc,usdt | jq -r '.[1]' \n```\n\n### Send a transaction to a smart contract\n\nTo write to the blockchain, use `w3 transact`. For example, to transfer 1 ETH to \naddress, run:\n\n```bash\nw3 transact weth transfer <address> 1e18\n```\n\nTo swap 1 USDC for USDT on Uniswap, accepting no less than 0.9 USDT in return, run:\n\n```bash\nw3 transact usdc approve uniswap_v2 1e6\nw3 transact uniswap_v2 swapExactTokensForTokens 1e6 0.9e6 usdc,usdt <receiver address> 9e9\n```\n\n# Multi-chain support\n\nweb3cli comes with out-of-the-box support for many chains.  To see the list of available chains, [visit the Wiki](https://github.com/coccoinomane/web3cli/wiki/%E2%9B%93-Supported-chains) or run the command `w3 chain list`.\n\nPass the chain name using the flag `--chain` or the shorthand `-c`:\n\n```bash\nw3 balance 0x8894e0a0c962cb723c1976a4421c95949be2d4e3 --chain bnb  # bnb chain\nw3 balance 0x8894e0a0c962cb723c1976a4421c95949be2d4e3 --chain avax # avax chain\n```\n\nYou can also use one of the provided aliases, like `w3bnb`, `w3avax`, or `w3arb`:\n\n```bash\nw3bnb balance 0x8894e0a0c962cb723c1976a4421c95949be2d4e3  # bnb chain\nw3avax balance 0x8894e0a0c962cb723c1976a4421c95949be2d4e3 # avax chain\n```\n\nIf you are focussing on a specific chain, set it as the default:\n\n```bash\nw3 config set default_chain bnb\nw3 balance 0x8894e0a0c962cb723c1976a4421c95949be2d4e3             # bnb chain\nw3 balance 0x8894e0a0c962cb723c1976a4421c95949be2d4e3 --chain eth # eth chain\n```\n\n# Use custom RPC\n\nBy default, web3cli will connect to the blockchain using a pre-configured public node.  You can see the list of such nodes with the command `w3 rpc list`.\n\nTo use a custom mode, please specify the `--rpc` flag.  For example, to use Ankr's node to Ethereum:\n\n```bash\nw3 block latest --rpc https://rpc.ankr.com/eth\n```\n\nUsing a custom node is most useful in the following situations:\n\n1. You want to use a node from a node provider, e.g. Infura:\n   ```bash\n   w3 block --rpc https://eth-mainnet.g.alchemy.com/v2/{YOUR-API-KEY}\n   ```\n2. You want to use a private node:\n   ```bash\n   w3 block --rpc http://127.0.0.1:8545\n   w3 block --rpc ws://127.0.0.1:8546\n   ```\n3. You want to use a testnet chain:\n   ```bash\n   w3eth block --rpc https://rpc.ankr.com/eth_goerli\n   w3bnb block --rpc https://data-seed-prebsc-1-s1.binance.org:8545/\n   ```\n\n\n# Add custom chains\n\nAdd new chains with `w3 chain add`:\n\n```bash\nw3 chain add cronos 25 CRO --tx-type 2 --rpc https://evm.cronos.org\n```\n\nUse the custom chain with `--chain`:\n\n```bash\nw3 balance 0x7de9ab1e6a60ac7a70ce96d1d95a0dfcecf7bfb7 --chain cronos\n```\n\nList existing chains with `w3 chain list`, and delete them with `w3 chain delete`.\n\n\n# Address book\n\n`w3` can store tags just like you would do on etherscan.io or bscscan.com:\n\n```bash\nw3 address add ethereum_foundation 0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae\nw3 address add binance_hot_wallet 0x8894e0a0c962cb723c1976a4421c95949be2d4e3\n```\n\nYou can use these tags instead of the actual addresses:\n\n```bash\nw3 balance ethereum_foundation\nw3 balance binance_hot_wallet --chain bnb\n```\n\nTo see the list of saved addresses, run `w3 address list`, to delete an address use `w3 address delete`.\n\n# Wallet management\n\nCommands such as `w3 send` and `w3 swap` require that you specify who is going to sign the transactions.  You can specify the signer with the `--signer` or `-s` flag:\n\n```bash\nw3 <command> --signer my-signer\n```\n\nHere, `my_signer` can be any of these things:\n\n- The name or the address of a signer that you previously registered with `w3 signer add my_signer`.  Signers created in this way are encrypted with the app key and stored in the database.  At any time, you can see the list of registered users by running `w3 signer list`.\n- The path to a file that you previously created with `w3 keyfile create`.  A keyfile is a simple JSON file that contains your private key in password-encrypted form.  Feel free to use keyfiles generated by other tools, like geth, parity, brownie, etc.\n- The actual private key of the signer that you want to use.  This is unsafe, use it at your own risk!\n\nPlease note that when the `--signer` flag is not provided, and there is only one registered signer, then this will be used.\n\n\n### Default signer\n\nIf you plan to use the same signer for a while, make it the **default signer** with the command:\n\n```bash\nw3 config set default_signer my_signer\n```\n\nIn this way, you will not have to specify the `--signer` flag anymore.\n\n\n### Create new private keys\n\nYou can also create a brand new wallet on the go, without the need to provide a key, by using the `--create` flag:\n\n```bash\nw3 signer add my_wallet --create\n```\n\nThe resulting private key will be printed to screen.\n\n# Documentation\n\nCheck the [project's wiki on Github](https://github.com/coccoinomane/web3cli/wiki/). In particular:\n\n- [\ud83e\udee1 List of commands](https://github.com/coccoinomane/web3cli/wiki/%F0%9F%AB%A1-List-of-commands)\n- [\u26d3 All supported chains](https://github.com/coccoinomane/web3cli/wiki/%E2%9B%93-Supported-chains)\n- [\ud83d\udcdd Configuration](https://github.com/coccoinomane/web3cli/wiki/%F0%9F%93%9D-Configuration)\n- [\ud83e\ude9f Run web3cli on Windows](https://github.com/coccoinomane/web3cli/wiki/%F0%9F%AA%9F-Run-web3cli-on-Windows)\n- [\u21aa\ufe0f Output processing](https://github.com/coccoinomane/web3cli/wiki/%E2%86%AA%EF%B8%8F-Output-processing)\n\n# Contributing\n\nAll contributions are welcome! To start improving web3cli, please refer to our [__contribution guide__](./CONTRIBUTING.md).\n\n# Acknowledgements\n\nThank you very much to the communities behind [web3.py](https://github.com/ethereum/web3.py) and the [Ape Framework](https://github.com/ApeWorX/ape): web3cli would not exist without your efforts!\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Interact with blockchains and smart contracts using the command line",
    "version": "1.1.36",
    "project_urls": {
        "homepage": "https://github.com/coccoinomane/web3cli",
        "repository": "https://github.com/coccoinomane/web3cli"
    },
    "split_keywords": [
        "web3",
        " w3",
        " cli",
        " evm",
        " blockchain",
        " ethereum",
        " binance",
        " avalanche"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "88e19f6e210adbef5968abef5b7d17b6ed6daa3ff67b5a6616a86e1ad8e83636",
                "md5": "4a88a6c99ca42a0e2f04e520b7d0823c",
                "sha256": "5acccc2ec3759c02033b4faf28957c176f2d1708b281657eb410010c7d6aad60"
            },
            "downloads": -1,
            "filename": "web3cli-1.1.36-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4a88a6c99ca42a0e2f04e520b7d0823c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 3753621,
            "upload_time": "2024-12-02T17:02:00",
            "upload_time_iso_8601": "2024-12-02T17:02:00.329579Z",
            "url": "https://files.pythonhosted.org/packages/88/e1/9f6e210adbef5968abef5b7d17b6ed6daa3ff67b5a6616a86e1ad8e83636/web3cli-1.1.36-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "762b1751991e23b43d0ccc2345fe111b402bbea7d5b56152d88a95c197009f09",
                "md5": "d1bd1fc6e526579fa0a6620053390414",
                "sha256": "7e1dd78b1d086ea25f0498f88c4ef80662ea12fe6457a71395dc992ec3088385"
            },
            "downloads": -1,
            "filename": "web3cli-1.1.36.tar.gz",
            "has_sig": false,
            "md5_digest": "d1bd1fc6e526579fa0a6620053390414",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 2721438,
            "upload_time": "2024-12-02T17:02:11",
            "upload_time_iso_8601": "2024-12-02T17:02:11.216528Z",
            "url": "https://files.pythonhosted.org/packages/76/2b/1751991e23b43d0ccc2345fe111b402bbea7d5b56152d88a95c197009f09/web3cli-1.1.36.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-02 17:02:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "coccoinomane",
    "github_project": "web3cli",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "tox": true,
    "lcname": "web3cli"
}
        
Elapsed time: 0.57128s