Skip to content
This repository was archived by the owner on Mar 26, 2025. It is now read-only.
/ keylib-py Public archive

Library for elliptic curve (ECDSA) private keys, public keys, and bitcoin addresses.

License

Notifications You must be signed in to change notification settings

stacks-archive/keylib-py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Keylib

CircleCI PyPI PyPI Slack

Installation

$ pip install keylib

Usage

Private Keys

>>> from keylib import ECPrivateKey

New Private Keys

>>> private_key = ECPrivateKey()
>>> private_key.to_hex()
'c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a01'
>>> private_key.to_wif()
'L3p8oAcQTtuokSCRHQ7i4MhjWc9zornvpJLfmg62sYpLRJF9woSu'

Imported Private Keys

>>> imported_private_key = ECPrivateKey(private_key.to_hex())
>>> print private_key.to_wif() == imported_private_key.to_wif()
True

Public Keys

>>> from keylib import ECPublicKey

Public Keys from Private Keys

>>> public_key = private_key.public_key()
>>> public_key.to_hex()
'03019979ec442e61ace8d47c6a344d791cee12d4e7bbde05fa91a62c0cda51c834'

Imported Public Keys

>>> imported_public_key = ECPublicKey(public_key.to_hex())
>>> print public_key.to_hex() == imported_public_key.to_hex()
True

Addresses

>>> from keylib import public_key_to_address

Addresses from Public Key Objects

>>> public_key.address()
'12WDrxysCBDtVxaP1n4HHj8BLqqqfaqANd'

RIPEMD160 Hashes from Public Key Objects

>>> public_key.hash160()
'107eecc5868111ba06e6bd9309b2db90c555cb6e'

Addresses from Hex Public Keys

>>> public_key_to_address("030589ee559348bd6a7325994f9c8eff12bd5d73cc683142bd0dd1a17abc99b0dc")
'1KbUJ4x8epz6QqxkmZbTc4f79JbWWz6g37'

About

Library for elliptic curve (ECDSA) private keys, public keys, and bitcoin addresses.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages