A set of utility functions for Bitcoin.
You can generate private and derive corresponding public keys, addresses, and in different formats (compressed, uncompressed, WIF).
You can encrypt your keys in an universal scheme described in bip-038.
You can also use the functions from utils.py if you want to do other things (like base58check encoding, WIF encoding, pseudo-random generation, common Bitcoin hashing functions).
Still in development, more functions to come.
>>> import bitcoineasy.bitcoineasy as bitcoin
>>> bitcoin.get_keypair()
('L1o65mEUSCgopZUd6hndxqMSvkfvihXV7XmnYoAKt6hWimBXXt6t', '18fyV1xFCXaHXxdjbUnVDBLqFyVnFgrzm1')
>>> bitcoin.encrypt('L1o65mEUSCgopZUd6hndxqMSvkfvihXV7XmnYoAKt6hWimBXXt6t', 'foobar')
'6PYSL5VV8uTFCnCynVdSctyQzm6X2AEJZXG4XQvMu9Bngns2xMeb77JyXH'
You can install bitcoin-easy directly from Pypi using pip :
pip install bitcoin-easy
To use it from source, you need to install dependencies (see below for more details about dependencies) :
git clone https://github.com/darosior/bitcoineasy/ && cd bitcoin-easy
python3 -m venv venv
. venv/bin/activate
pip install py_ecc pycrypto scrypt requests
Generate a keypair (default is compressed public key and WIF encoded private key) :
kp = get_keypair()
If you want unencoded private key (diplayed as hex) and uncompressed public key :
kp = get_keypair(compressed=False, wif=False)
You can base58 or base58check encode raw bytes with :
base58_encode(data)
base58check_encode(data)
You can also check example.py which is a showcase of some functionalities provided by bitcoin-easy.
- P2SH
- A better way to handle 0x00 prefix with base58check_decode()
Not finished yet, any remark or feature request are welcome