Coder Social home page Coder Social logo

mlegore / pybitcoin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stacks-network/pybitcoin

0.0 2.0 0.0 3.18 MB

Bitcoin python library (private + public keys, addresses, transactions, RPC, etc.)

License: MIT License

Python 99.91% Shell 0.09%

pybitcoin's Introduction

pybitcoin

Latest Version Downloads License

Python library with tools for Bitcoin and other cryptocurrencies.

Usage

Private Keys

>>> from pybitcoin import BitcoinPrivateKey
>>> priv = BitcoinPrivateKey()
>>> priv.to_hex()
'91149ee24f1ee9a6f42c3dd64c2287781c8c57a6e8e929c80976e586d5322a3d'
>>> priv.to_wif()
'5JvBUBPzU42Y7BHD7thTnySXQXMk8XEJGGQGcyBw7CCkw8RAH7m'
>>> priv2 = BitcoinPrivateKey('91149ee24f1ee9a6f42c3dd64c2287781c8c57a6e8e929c80976e586d5322a3d')
>>> print priv.to_wif() == priv2.to_wif()
True

Public Keys

>>> pub = priv.public_key()
>>> pub.to_hex()
'042c6b7e6da7633c8f226891cc7fa8e5ec84f8eacc792a46786efc869a408d29539a5e6f8de3f71c0014e8ea71691c7b41f45c083a074fef7ab5c321753ba2b3fe'
>>> pub2 = BitcoinPublicKey(pub.to_hex())
>>> print pub.to_hex() == pub2.to_hex()
True

Addresses

>>> pub.address()
'13mtgVARiB1HiRyCHnKTi6rEwyje5TYKBW'
>>> pub.hash160()
'1e6db1e09b5e307847e5734864a79ea0113d0083'

Brainwallet-based Private Keys

>>> priv = BitcoinPrivateKey.from_passphrase()
>>> priv.passphrase()
'shepherd mais pack rate enamel horace diva filesize maximum really roar mall'
>>> priv.to_hex()
'91149ee24f1ee9a6f42c3dd64c2287781c8c57a6e8e929c80976e586d5322a3d'
>>> priv2 = BitcoinPrivateKey.from_passphrase(priv2.passphrase())
>>> print priv.to_hex() == priv2.to_hex()
True

Altcoins

>>> class NamecoinPrivateKey(BitcoinPrivateKey):
>>>     _pubkeyhash_version_byte = 52
>>> namecoin_priv = NamecoinPrivateKey(priv.to_hex())
>>> namecoin_priv.to_wif()
'73zteEjenBCK7qVtG2yRPeco2TP5w93qBW5sJkxYoGYvbWwAbXv'
>>> namecoin_pub = namecoin_priv.public_key()
>>> namecoin_pub.address()
'MyMFt8fQdZ6rEyDhZbe2vd19gD8gzagr7Z'

Supported currencies

Litecoin, Namecoin, Peercoin, Primecoin, Testnet, Worldcoin, Megacoin, Feathercoin, Terracoin, Novacoin, Dogecoin, Anoncoin, Protoshares, Ixcoin, Memorycoin, Infinitecoin, Cryptogenic Bullion, Quarkcoin, Netcoin, Earthcoin, Reddcoin, (insert your favorite cryptocurrency here)

Developers

Q: Can I contribute to pybitcoin?

A: Of course! Any and all are encouraged to contribute. Just fork a copy of the repo and get started on something that you think would improve the current offering.

Q: What should I work on?

A: That's up to you! For a quick project, consider adding support for a new cryptocurrency (should only require two lines of code, not including the unit tests).

Meanwhile, for something a bit more ambitious, check the issues section for outstanding feature requests.

Notice

pybitcoin is still in beta. Developers using pybitcoin are encouraged to inspect the code for themselves and perform their own tests. We are committed to ensuring that this library behaves exactly as it is supposed to under all conditions, and have plans to ramp up our testing efforts going forward.

pybitcoin's People

Watchers

 avatar  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.