Fork Python bindings for sr25519 library
Project description
py-sr25519-bindings
Python bindings for sr25519 library: https://github.com/w3f/schnorrkel
Reference to https://github.com/LocalCoinSwap/kusama-reference-implementation/tree/improve-trading-tests/bindings and https://gitlab.com/kauriid/schnorrpy/ for the initial work
Documentation
https://docs.rs/py-sr25519-bindings
Installation
Install from PyPI
pip install py-sr25519-bindings
Compile for local development
pip install -r requirements.txt
maturin develop
Build wheelhouses
pip install -r requirements.txt
# Build local OS wheelhouse
maturin build
# Build manylinux1 wheelhouse
docker build . --tag polkasource/maturin
docker run --rm -i -v $(pwd):/io polkasource/maturin build
Usage
import bip39
import sr25519
message = b"test"
# Get private and public key from seed
seed = bip39.bip39_to_mini_secret('daughter song common combine misery cotton audit morning stuff weasel flee field','')
public_key, private_key = sr25519.pair_from_seed(bytes(seed))
# Generate signature
signature = sr25519.sign(
(public_key, private_key),
message
)
print('Signature', signature.hex())
# Verify message with signature
if sr25519.verify(signature, message, public_key):
print('Verified')
License
https://github.com/polkascan/py-sr25519-bindings/blob/master/LICENSE
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Close
Hashes for py_sr25519_bindings_fork-0.2.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1cd2f036e7e90c364d86cd867d12da4dfe163d52b33a4537e1cb9e12ef6b8eb |
|
MD5 | 1bb8567dfca95add9930035df74a7a2d |
|
BLAKE2b-256 | beb51808695a1ba275cb54f489cb62c9d3c672d5b89dd40d6cdca77b77ca4fb4 |
Close
Hashes for py_sr25519_bindings_fork-0.2.2-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbbaebdf359cec18b6519481e9e563c78b46e93cc62609a1c1fb1cbc4ed6cea4 |
|
MD5 | e152d678962bec6a35b829f553a6c454 |
|
BLAKE2b-256 | 39799641a2637753284185a8a4f28da03d3cf9feae97ba298abcbf92e0c19a8c |
Close
Hashes for py_sr25519_bindings_fork-0.2.2-cp38-cp38-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8adea6d7a5eac119b6a746b836f5eae4e324bddb64c29292488c70b8e80fe03c |
|
MD5 | 8475970a308f602043f7aae288b1589c |
|
BLAKE2b-256 | 39b75641bdec9289857875980251cd68bca1b1bf6d82429f23d372c38bb49ca4 |
Close
Hashes for py_sr25519_bindings_fork-0.2.2-cp36-cp36m-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0ff410a5320a296f3fbcf5bade31f0bd1518fc5b713f0b92e57d78a78503a2d |
|
MD5 | 39cfef2b8302a9e42e973f029cdd73ef |
|
BLAKE2b-256 | be4ee8c913b169ed5556f0e488e9989274867b20a3e1b36e7d5ed6331a1f91fa |