Python bindings for librustzcash: address parsing, ZIP-321 URIs, and key derivation
Project description
pyzcash
Python bindings for librustzcash. Built with PyO3.
Wraps zcash_address, zip321, and zcash_keys into four Python functions. All crypto runs in Rust.
Install
pip install maturin
git clone https://github.com/craigraw/pyzcash && cd pyzcash
maturin develop
Needs a Rust toolchain. Pre-built wheels coming eventually.
Usage
import pyzcash
# Parse any Zcash address (full checksum validation, not prefix matching)
info = pyzcash.parse_address("tmEZhbWHTpdKMw5it8YDspUXSMGQyFwovpU")
info.address_type # "p2pkh"
info.network # "test"
info.is_shielded # False
# Parse a ZIP-321 payment URI
payments = pyzcash.parse_payment_uri("zcash:tmEZhbWHTpdKMw5it8YDspUXSMGQyFwovpU?amount=42.5")
payments[0].amount_zatoshis # 4250000000
payments[0].amount_zec # 42.5
# Generate a ZIP-321 payment URI
pyzcash.create_payment_uri("tmEZhbWHTpdKMw5it8YDspUXSMGQyFwovpU", 4_250_000_000)
# "zcash:tmEZhbWHTpdKMw5it8YDspUXSMGQyFwovpU?amount=42.5"
# Derive a unified address from a seed
import os
result = pyzcash.derive_address(os.urandom(32), network="main", account=0)
result.unified_address # "u1..."
What it wraps
| Function | Crate | Does |
|---|---|---|
parse_address() |
zcash_address |
Validate + classify addresses |
parse_payment_uri() |
zip321 |
Parse ZIP-321 URIs |
create_payment_uri() |
zip321 |
Generate ZIP-321 URIs |
derive_address() |
zcash_keys |
Seed to unified address (Orchard + Sapling) |
No reimplemented crypto. Checksums, key derivation, encoding are all handled by the Rust libraries.
Status
Alpha. Four functions that work. Next steps:
- Transaction building
- Wallet scanning via
zcash_client_backend - Viewing key import/export
- Pre-built wheels so you don't need Rust installed
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyzcash-0.1.0a1.tar.gz.
File metadata
- Download URL: pyzcash-0.1.0a1.tar.gz
- Upload date:
- Size: 16.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b38b8d8f20fe0aba5c6b23d73471afd0bb059285754a55165386e595cec3067
|
|
| MD5 |
1dbd65e9caa3277e6503e9a5ca12eaf5
|
|
| BLAKE2b-256 |
3bf6282a2c51a5151bf96aff8569e92b36b4f4fc282d2f3a2e7abc088601ca07
|
File details
Details for the file pyzcash-0.1.0a1-cp314-cp314-macosx_11_0_arm64.whl.
File metadata
- Download URL: pyzcash-0.1.0a1-cp314-cp314-macosx_11_0_arm64.whl
- Upload date:
- Size: 463.4 kB
- Tags: CPython 3.14, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04a4c92211358bdc6c8b3431592d6fba1def0b3942e0c9c424f54cc7d1a92cd9
|
|
| MD5 |
7ffd8e41ecfd6b0cd37851c62c3770ff
|
|
| BLAKE2b-256 |
37e406706fe78eab0a20fbb5c0e404f06701d3a8748146c1c0f5b7d0c627822a
|