GithubHelp home page GithubHelp logo

bone117 / keylib-py Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stacks-network/keylib-py

0.0 0.0 0.0 24 KB

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

License: MIT License

Python 100.00%

keylib-py's Introduction

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'

keylib-py's People

Contributors

shea256 avatar jcnelson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.