WalletConnect (Python)
A Python client for WalletConnect v2 (now Reown), so Python tools (e.g. Ape account plugins) can pair with mobile wallets and relay signing requests to them.
Status
- Target: WalletConnect v2 / Reown Sign API (default relay
wss://relay.walletconnect.org,irnJSON-RPC, X25519 + ChaCha20-Poly1305 envelopes, a project ID from the WalletConnect Dashboard). - WalletConnect v1 is dead. The v1 bridge servers were shut down, and this library will never
implement the v1 protocol.
The
0.1.0a0release on PyPI is an empty pre-v2 skeleton and should not be used.
Progress is tracked in #1.
Dependencies
- Python 3 version 3.10 or greater.
Installation
via pip
Once a release is available, you can install it via pip:
pip install walletconnect
via source
You can clone the repository and install for development:
git clone https://github.com/ApeWorX/walletconnect-py.git
cd walletconnect-py
uv sync --group dev
uv run prek install
Quick Usage
Terminal → mobile wallet (manual demo)
- Create a free project on the WalletConnect Dashboard and copy the project ID. Existing project IDs from Reown Cloud / the Reown Dashboard keep working.
- Install from this repo (with the optional QR extra):
git clone https://github.com/ApeWorX/walletconnect-py.git
cd walletconnect-py
uv sync --extra qr --group test
export WALLETCONNECT_PROJECT_ID=your_32_char_project_id
uv run --extra qr python examples/terminal_connect.py
Or with pip from a checkout:
pip install -e ".[qr]"
export WALLETCONNECT_PROJECT_ID=your_32_char_project_id
python examples/terminal_connect.py
Scan the QR with MetaMask / Rainbow / etc., approve the session, then approve personal_sign on the phone.
Async Cyclopts variant (uses SignClient instead of SyncSignClient):
uv sync --extra cli
export WALLETCONNECT_PROJECT_ID=your_32_char_project_id
uv run --extra cli python examples/async_cli.py
# or: uv run --with 'cyclopts>=3,<6' --extra qr python examples/async_cli.py
HTTP service variant (FastAPI: pair over POST /pair, sign via POST /sessions/{topic}/sign):
uv run --group examples --extra qr uvicorn examples.fastapi_app.app:app # demo page at http://localhost:8000/
MCP server variant (an AI assistant pairs a wallet and requests signatures; you approve on your phone):
uv run --group examples --extra qr python -m examples.mcp_server # stdio; see docs/userguides/mcp.md
The production MCP integration is planned as a feature of the ape-walletconnect plugin.
from walletconnect.qr import print_qr
from walletconnect.sign import SyncSignClient
from walletconnect.types import Metadata
client = SyncSignClient(
project_id="...", # or set WALLETCONNECT_PROJECT_ID
# Shown in the wallet; many wallets display the url's host prominently.
metadata=Metadata(name="My Script", url="https://example.com"),
)
session = client.connect(chains=(1,), on_uri=print_qr)
sig = client.personal_sign("hello", session.eip155_accounts[0].split(":")[-1])
client.close()
The client is stateless: it never writes to disk. To keep sessions across restarts, save
client.export_state().model_dump_json() wherever you like (file, database, S3) and pass it back
with SyncSignClient(state=ClientState.model_validate_json(blob)). The state contains secret
keys, so store it securely. See the connecting guide.
For sessions that stay open for weeks, the client emits events (client.on("session_delete", ...)),
can extend sessions before they expire (auto_extend=True), and can check whether the wallet is
online (is_reachable()). See Long-running sessions.
Lower-level helpers still work without a relay connection:
from walletconnect import PairingURI
from walletconnect.qr import print_qr # requires `pip install "walletconnect[qr]"`
uri = PairingURI.generate()
print_qr(uri)
print_qr draws for a dark terminal background by default; pass invert=False for light
backgrounds. Live relay tests skip unless WALLETCONNECT_PROJECT_ID is set.
For an automated interoperability check against the official JS Sign client (wallet peer), see e2e-js/.
Development
See CONTRIBUTING.md. Comments, questions, criticisms and pull requests are welcomed.
License
This project is licensed under the Apache 2.0.
Metadata
Release files for walletconnect 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| walletconnect-0.1.0.tar.gz | 131.2 kB | With provenance | Details for walletconnect-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| walletconnect-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for walletconnect-0.1.0-py3-none-any.whl |
Total release size: 207.8 kB
Release files / walletconnect-0.1.0.tar.gz
| Download URL | walletconnect-0.1.0.tar.gz |
|---|---|
| Size | 131.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9bf598484d8d522aaa2ac4931df7fac6c7fca5e4d28c990dbfadfded7ac7a298
|
|
BLAKE2b-256 checksum How to use checksums |
04c775347ec3c3fa89f1ce718c04e29830d8047a5eed6c7f17da612d9c7ddf9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logRelease files / walletconnect-0.1.0-py3-none-any.whl
| Download URL | walletconnect-0.1.0-py3-none-any.whl |
|---|---|
| Size | 76.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
69b33180269fae50300d3c5b3ae252edb3c884a60fd2e06eadacb1f5ee6dc358
|
|
BLAKE2b-256 checksum How to use checksums |
9f501f787ba8ae7c91ad30ee8edecf9d06ed7099d314ba698d299889420d0e6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logSecurity for walletconnect 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for walletconnect-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.