# Python blockchain libraries

Python blockchain libraries read chain data, build and sign transactions, and call smart contracts from Python code. Signing happens locally with a private key before a client sends the transaction to a node over JSON-RPC. These libraries let wallets, trading bots, and AI agents act on Ethereum, Solana, and Bitcoin.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [eth-utils](#eth-utils) | 8.2M | 337 | Mar 2026 | MIT |
| [eth-abi](#eth-abi) | 7.7M | 256 | Aug 2026 | MIT |
| [eth-keys](#eth-keys) | 6.4M | 177 | Aug 2026 | MIT |
| [eth-account](#eth-account) | 6.3M | 314 | Aug 2026 | MIT |
| [web3](#web-py) | 5.5M | 5.5K | Aug 2026 | MIT |
| [Solders](#solders) | 1.7M | 450 | Aug 2026 | Unresolved |
| [Solana.py](#solana-py) | 853.1K | 1.4K | Nov 2026 | MIT |
| [python-bitcoinlib](#python-bitcoinlib) | 568.9K | 1.9K | Jun 2023 | LGPL-3.0-or-later |

Downloads: PyPI, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[eth-utils](#eth-utils) has the most monthly downloads in this comparison, at 8.2M.

## Capabilities

| Library | RPC client | Local signing |
| --- | --- | --- |
| [eth-utils](#eth-utils) | No | No |
| [eth-abi](#eth-abi) | No | No |
| [eth-keys](#eth-keys) | No | Yes |
| [eth-account](#eth-account) | No | Yes |
| [web3](#web-py) | Yes | Yes |
| [Solders](#solders) | No | Yes |
| [Solana.py](#solana-py) | Yes | Via plugin |
| [python-bitcoinlib](#python-bitcoinlib) | Yes | Yes |

## Libraries

### eth-utils

[GitHub](https://github.com/ethereum/eth-utils) · [PyPI](https://pypi.org/project/eth-utils) · [Docs](https://eth-utils.readthedocs.io/en/stable/)

Provides common utility functions for Python code that works with Ethereum.

- Downloads / mo: 8.2M
- Stars: 337
- Last release: 6.0.0
- License: MIT
- Capabilities: [From the eth-utils docs](https://eth-utils.readthedocs.io/en/stable/)

```sh
python -m pip install eth-utils
```

**ApeWorX/eth-tester** (377 stars)

[ApeWorX/eth-tester](https://github.com/ApeWorX/eth-tester) 

```python
@to_tuple
def normalize_filter_params(from_block, to_block, address, topics):
    yield from_block
    yield to_block

    if address is None:
        yield address
    elif is_address(address):
        yield to_canonical_address(address)
    elif is_list_like(address):
        yield tuple(to_canonical_address(item) for item in address)
    else:
        raise TypeError(f"Address is not in a recognized format: {address}")

    if topics is None:
        yield topics
    elif is_valid_topic_array(topics):
        yield tuple(
            normalize_topic_list(item) if is_list_like(item) else normalize_topic(item)
            for item in topics
        )
    else:
        raise TypeError(f"Topics are not in a recognized format: {address}")

```

[eth_tester/normalization/inbound.py](https://github.com/ApeWorX/eth-tester/blob/87e7e69646d3520c47718301d964be14e1068f30/eth_tester/normalization/inbound.py#L49-L71) · [More projects using eth-utils →](https://dashboard.exa.ai/playground/search?q=eth-utils%20GitHub%20projects)

**Quickstart**

```python
from eth_utils import to_checksum_address

address = to_checksum_address('0xd3cda913deb6f67967b99d67acdfa1712c293601')

```

From [utilities.html](https://eth-utils.readthedocs.io/en/stable/utilities.html)

### eth-abi

[GitHub](https://github.com/ApeWorX/eth-abi) · [PyPI](https://pypi.org/project/eth-abi) · [Docs](https://eth-abi.readthedocs.io/en/stable/)

Encodes and decodes Ethereum ABI data.

- Downloads / mo: 7.7M
- Stars: 256
- Last release: 6.0.0
- License: MIT
- Capabilities: [From the eth-abi docs](https://eth-abi.readthedocs.io/en/stable/)

```sh
python -m pip install eth-abi
```

**ApeWorX/ape** (1.1K stars)

[ApeWorX/ape](https://github.com/ApeWorX/ape) 

```python
def encode_calldata(self, abi: ConstructorABI | MethodABI, *args) -> HexBytes:
    if not abi.inputs:
        return HexBytes("")

    parser = StructParser(abi)
    arguments = parser.encode_input(args)
    input_types = [i.canonical_type for i in abi.inputs]
    python_types = tuple(self._python_type_for_abi_type(i) for i in abi.inputs)
    converted_args = self.conversion_manager.convert(arguments, python_types)
    encoded_calldata = encode(input_types, converted_args)
    return HexBytes(encoded_calldata)

```

[src/ape_ethereum/ecosystem.py](https://github.com/ApeWorX/ape/blob/7916f167a1cbdf9355ea2bcab70d3eba3c9317c7/src/ape_ethereum/ecosystem.py#L742-L752) · [More projects using eth-abi →](https://dashboard.exa.ai/playground/search?q=eth-abi%20GitHub%20projects)

**Quickstart**

```python
from eth_abi import encode

encoded = encode(['uint256'], [12345])

```

From [encoding.html](https://eth-abi.readthedocs.io/en/stable/encoding.html)

### eth-keys

[GitHub](https://github.com/ApeWorX/eth-keys) · [PyPI](https://pypi.org/project/eth-keys)

Provides a common API for Ethereum key operations.

- Downloads / mo: 6.4M
- Stars: 177
- Last release: 0.8.0
- License: MIT
- Capabilities: [From the eth-keys docs](https://github.com/ApeWorX/eth-keys)

```sh
python -m pip install eth-keys
```

**ethereum/py-evm** (2.3K stars)

[ethereum/py-evm](https://github.com/ethereum/py-evm) 

```python
def ecrecover(computation: ComputationAPI) -> ComputationAPI:
    computation.consume_gas(constants.GAS_ECRECOVER, reason="ECRecover Precompile")
    data = computation.msg.data_as_bytes
    raw_message_hash = data[:32]
    message_hash = pad32r(raw_message_hash)

    v_bytes = pad32r(data[32:64])
    v = big_endian_to_int(v_bytes)

    r_bytes = pad32r(data[64:96])
    r = big_endian_to_int(r_bytes)

    s_bytes = pad32r(data[96:128])
    s = big_endian_to_int(s_bytes)

    try:
        validate_lt_secpk1n(r, title="ECRecover: R")
        validate_lt_secpk1n(s, title="ECRecover: S")
        validate_lte(v, 28, title="ECRecover: V")
        validate_gte(v, 27, title="ECRecover: V")
    except ValidationError:
        return computation

    canonical_v = v - 27

    try:
        signature = keys.Signature(vrs=(canonical_v, r, s))
        public_key = signature.recover_public_key_from_msg_hash(message_hash)
    except BadSignature:
        return computation

    address = public_key.to_canonical_address()
    padded_address = pad32(address)

    computation.output = padded_address
    return computation

```

[eth/precompiles/ecrecover.py](https://github.com/ethereum/py-evm/blob/ffce74fa3c5d95682cdd5d84de82c80d60a56172/eth/precompiles/ecrecover.py#L29-L64) · [More projects using eth-keys →](https://dashboard.exa.ai/playground/search?q=eth-keys%20GitHub%20projects)

**Quickstart**

```python
from eth_keys import keys

private_key = keys.PrivateKey(b'\x01' * 32)
signature = private_key.sign_msg(b'a message')

```

From [README.md](https://github.com/ApeWorX/eth-keys/blob/main/README.md)

### eth-account

[GitHub](https://github.com/ApeWorX/eth-account) · [PyPI](https://pypi.org/project/eth-account) · [Docs](https://eth-account.readthedocs.io/en/latest/)

Signs Ethereum transactions and messages using local private keys.

- Downloads / mo: 6.3M
- Stars: 314
- Last release: 0.14.0
- License: MIT
- Capabilities: [From the eth-account docs](https://eth-account.readthedocs.io/en/latest/)

**Strengths**

- **Works without a node connection.** Create accounts and sign locally before choosing a broadcaster.
- **Signs structured Ethereum messages.** Use sign_typed_data for structured message signatures.

**Watch out for**

- **Typed-data signing remains unaudited.** The typed-data implementation has not undergone an external audit.
- **Raw hashes need trusted origins.** Prefer sign_message over signing a hash supplied by someone else.

```sh
python -m pip install eth-account
```

**Quickstart**

```python
from eth_account import Account

account = Account.create()

```

From [eth_account.html](https://eth-account.readthedocs.io/en/latest/eth_account.html) · [Find projects using eth-account →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20eth-account%20for%20blockchain%20RPC%2C%20message%20signing%2C%20contract%20reads%20and%20transaction%20integration&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

### web3

[GitHub](https://github.com/ApeWorX/web3.py) · [PyPI](https://pypi.org/project/web3) · [Docs](https://web3py.readthedocs.io/en/stable/)

Reads Ethereum blockchain data and interacts with smart contracts.

- Downloads / mo: 5.5M
- Stars: 5.5K
- Last release: 8.0.0
- License: MIT
- Capabilities: [From the web3 docs](https://web3py.readthedocs.io/en/stable/)

**Strengths**

- **Reads and calls smart contracts.** Use one client for blocks, transactions, and contract interactions.
- **Offers multiple connection transports.** Choose HTTP, IPC, or WebSocket connections to the node.

**Watch out for**

- **Live reads need a node.** Configure a provider connection before querying live Ethereum state.
- **Test provider needs extra dependencies.** Install the tester extra for the local Ethereum test provider.

```sh
pip install "web3[tester]"
```

**Quickstart**

```python
from web3 import Web3, EthereumTesterProvider

w3 = Web3(EthereumTesterProvider())
block = w3.eth.get_block('latest')

```

From [quickstart.html](https://web3py.readthedocs.io/en/stable/quickstart.html) · [Find projects using web3 →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20web3%20for%20blockchain%20RPC%2C%20message%20signing%2C%20contract%20reads%20and%20transaction%20integration&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

### Solders

[GitHub](https://github.com/kevinheavey/solders) · [PyPI](https://pypi.org/project/solders) · [Docs](https://kevinheavey.github.io/solders/)

Provides Solana keypairs, transaction types, and RPC message codecs.

- Downloads / mo: 1.7M
- Stars: 450
- Last release: 0.29.0
- License: Unresolved
- Capabilities: [From the Solders docs](https://kevinheavey.github.io/solders/)

**Strengths**

- **Builds typed RPC messages.** Serialize RPC requests to JSON and parse typed responses.
- **Supports partial transaction signing.** Collect signatures without sharing each signer’s private key.

**Watch out for**

- **RPC networking needs solana-py.** Use solana-py to send requests to an RPC server.
- **Token clients live elsewhere.** Use solana-py for SPL Token and Memo clients.

```sh
pip install solders
```

**michaelhly/solana-py** (1.4K stars)

[michaelhly/solana-py](https://github.com/michaelhly/solana-py) 

```python
async def main():
    rpc = AsyncClient("https://api.devnet.solana.com")

    sender = Keypair()
    recipient = Keypair()

    LAMPORTS_PER_SOL = 1_000_000_000
    transfer_amount = LAMPORTS_PER_SOL // 100  # 0.01 SOL

    async with rpc:
        # Get latest blockhash
        latest_blockhash = await rpc.get_latest_blockhash()

        # Create transfer instruction
        transfer_instruction = transfer(
            TransferParams(from_pubkey=sender.pubkey(), to_pubkey=recipient.pubkey(), lamports=transfer_amount)
        )

        # Create message
        message = MessageV0.try_compile(
            payer=sender.pubkey(),
            instructions=[transfer_instruction],
            address_lookup_table_accounts=[],
            recent_blockhash=latest_blockhash.value.blockhash,
        )

        # Create and sign transaction
        transaction = VersionedTransaction(message, [sender])

        print(f"Sender: {sender.pubkey()}")
        print(f"Recipient: {recipient.pubkey()}")
        print(f"Transfer Amount: {transfer_amount / LAMPORTS_PER_SOL} SOL")
        print(f"Transaction created successfully")

```

[docs/cookbook/transaction-operations/send-sol.md](https://github.com/michaelhly/solana-py/blob/88a3d4dbef69e70515de6e59f06f9d18f5dd0dfc/docs/cookbook/transaction-operations/send-sol.md#L21-L53) · [More projects using Solders →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20solders%20for%20blockchain%20RPC%2C%20message%20signing%2C%20contract%20reads%20and%20transaction%20integration&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
from solders.keypair import Keypair

keypair = Keypair()
public_key = keypair.pubkey()

```

From [transactions.html](https://kevinheavey.github.io/solders/tutorials/keypairs.html)

### Solana.py

[GitHub](https://github.com/michaelhly/solana-py) · [PyPI](https://pypi.org/project/solana) · [Docs](https://michaelhly.com/solana-py/)

Connects Python applications to Solana RPC and token programs.

- Downloads / mo: 853.1K
- Stars: 1.4K
- Last release: 0.42.0
- License: MIT
- Capabilities: [From the Solana.py docs](https://michaelhly.com/solana-py/)

**Strengths**

- **Provides an asynchronous RPC client.** Use AsyncClient with a context manager for connection cleanup.
- **Manages subscription handles.** Use returned handles to unsubscribe from the original connection.

**Watch out for**

- **Core types live in solders.** Import keypairs and transaction types from the solders package.
- **Signature subscriptions are one-shot.** Unsubscribing after their notification raises ValueError.

```sh
pip install solana
```

**Quickstart**

```python
import asyncio
from solana.rpc.async_api import AsyncClient

async def main():
    async with AsyncClient('https://api.devnet.solana.com') as client:
        return await client.is_connected()

asyncio.run(main())

```

From [README.md](https://github.com/michaelhly/solana-py/blob/master/README.md) · [Find projects using Solana.py →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20solana%20for%20blockchain%20RPC%2C%20message%20signing%2C%20contract%20reads%20and%20transaction%20integration&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

### python-bitcoinlib

[GitHub](https://github.com/petertodd/python-bitcoinlib) · [PyPI](https://pypi.org/project/python-bitcoinlib) · [Docs](https://python-bitcoinlib.readthedocs.io/en/latest/)

Provides general tools for the Bitcoin protocol.

- Downloads / mo: 568.9K
- Stars: 1.9K
- Last release: 0.12.2
- License: LGPL-3.0-or-later
- Capabilities: [From the python-bitcoinlib docs](https://python-bitcoinlib.readthedocs.io/en/latest/)

```sh
pip install python-bitcoinlib
```

**Quickstart**

```python
from bitcoin.core import CMutableTransaction

transaction = CMutableTransaction()
wire = transaction.serialize()

```

From [__init__.py](https://github.com/petertodd/python-bitcoinlib/blob/master/bitcoin/core/__init__.py) · [Find projects using python-bitcoinlib →](https://dashboard.exa.ai/playground/search?q=python-bitcoinlib%20GitHub%20projects)

## FAQ

### Which Python blockchain library should I use?

[web3](#web-py) suits Ethereum apps that read chain data and call contracts. [Solana.py](#solana-py) with [Solders](#solders) suits Solana apps. [eth-account](#eth-account) suits code that only signs transactions and messages.

### What is Solders?

[Solders](#solders) provides Solana keypairs, transaction types, and RPC message codecs written in Rust with Python bindings. [Solana.py](#solana-py) uses it for its core types.

### What is web3?

[web3](#web-py) is the Python library for Ethereum. It reads blocks and balances, sends transactions, and calls smart contracts through a node's JSON-RPC API.

### What is python-bitcoinlib?

[python-bitcoinlib](#python-bitcoinlib) provides Bitcoin protocol data structures, scripts, and serialization in Python.

## How this page was built

Data checked Nov 20, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Best Python blockchain libraries web3 eth-account solana solders code examples",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
