Python interface to the Jubjub elliptic curve used in Zcash Protocol
Project description
pyjubjub
Python bindings to rust code that implements the Jubjub elliptic curve and RedDSA, a Schnorr-based signature scheme that supports key re-randomization, which is defined in the Zcash Protocol. RedDSA on the Jubjub curve is known as RedJubjub.
RedJubjub on the Jubjub elliptic curve plays the same role as ed25519 on the elliptic curve Curve25519.
Details
There are various Rust implementations of Jubjub, we use what is inside the version of librustzcash used by the Hush full node, which is an older version of librustzcash used in the zcashd Zcash full node. The current version of zcashd librustzcash has many changes to support Halo2/Orchard that we do not need for Jubjub. We do not use the jubjub crate from Zebra, the Zcash full node written in Rust.
The file src/lib.rs in this repo is https://git.hush.is/hush/librustzcash/src/branch/master/sapling-crypto/src/redjubjub.rs with python bindings provided by pyo3 from https://github.com/PyO3/pyo3
In theory this code is compatible with the Sapling zaddrs which use the Jubjub elliptic curve in the following cryptocoins: Hush, DragonX, Zcash, Ycash, Pirate and probably others. Testing is needed to verify this.
Compiling
Currently this code has only been tested with rust 1.63.0 .
Setup python environment:
virtualenv venv
source venv/bin/activate
Install maturin via pip install maturin
After changing code, compile Rust and Python module:
maturin develop -r
The -r builds a release optimized version. You can leave it off if you want,
but the current tests are ~50X slower without it.
Example Use
This code is still HIGHLY EXPERIMENTAL and UNTESTED. Don't say we didn't warn you.
import pyjubjub
privkey = pyjubjub.new_privkey()
pubkey = pyjubjub.get_pubkey(privkey)
Tests
To run tests:
python test.py
Installing
This is not yet available on PyPI
Requirements
pyjubjub requires Python 3.8 or higher
License
GPLv3
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 pyjubjub-0.0.1.tar.gz.
File metadata
- Download URL: pyjubjub-0.0.1.tar.gz
- Upload date:
- Size: 563.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7b1061aef68eb19864550c0164518bd6657ae03b8878cce386371bfd19374e2
|
|
| MD5 |
32c70f91ad458952ec0e937ee7d0a0a3
|
|
| BLAKE2b-256 |
1f12af2cce8a41a8a98567f394e8286ab3a5c20aa8da438f6f49bfe5a28feb8a
|
File details
Details for the file pyjubjub-0.0.1-cp311-cp311-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: pyjubjub-0.0.1-cp311-cp311-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 235.5 kB
- Tags: CPython 3.11, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df6c2769051240b865a400fab251b7403a47f67bd7666d24dffc28dc75c61aa4
|
|
| MD5 |
f2f6b9b0700323558c30fc937c05b29a
|
|
| BLAKE2b-256 |
8c4879c254544451486f82eaa5a328b963fd17cfd442e7e770fac67771f6c78a
|