Bitcoin Forum
April 28, 2024, 06:01:52 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Yet Another Python BIP32 implementation  (Read 1493 times)
sbuss (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile WWW
March 05, 2014, 07:07:00 AM
Last edit: March 05, 2014, 07:20:12 AM by sbuss
 #1

I have implemented BIP32 in python over the past four weeks or so in a library I'm calling bitmerchant.

https://github.com/sbuss/bitmerchant

Please note that this is not on PyPI yet because, even though the tests are passing, I wanted to get some eyes on it to check for any obvious cryptobugs I overlooked. I'm using the python-ecdsa library (https://pypi.python.org/pypi/ecdsa) for EC keys and pyCrypto.random (a hardened prng in place of python's insecure random library) in the one place I generate a random 512 bit key.

My goal is to implement commonly needed methods for merchants that want to accept bitcoin or some altcoin without depending on outside services to host their wallet, all while providing good security by default.

BIP32 was the first feature I tackled because a merchant only needs a single public master key to start accepting coins immediately into user-specific wallets. I wrote this because I wanted to do this exact thing in a side project without relying on outside services but wasn't happy with the available libraries (due to code quality, lack of tests, or complexity).

I tried to make the documentation easy to follow for people unfamiliar with bitcoin. I drew attention to the various security concerns that new users (and even experienced users) may not be aware of (in particular the ability to recover a master private key given a master public key and one of its private children). There's a lot of prose in the readme, but it's supplemented quite well with code samples. My code is full of docstrings, hopefully has a sane structure, and goes through pyflakes/pep8 to ensure a consistent style.

This library is tested via TravisCI on python 2.6, 2.7, and 3.3. It currently has 96% test coverage and includes test vectors from the bitcoin source.

Many thanks to https://github.com/wink/money-tree for its great documentation that helped clear up some vague parts of the BIP32 spec.
1714327312
Hero Member
*
Offline Offline

Posts: 1714327312

View Profile Personal Message (Offline)

Ignore
1714327312
Reply with quote  #2

1714327312
Report to moderator
1714327312
Hero Member
*
Offline Offline

Posts: 1714327312

View Profile Personal Message (Offline)

Ignore
1714327312
Reply with quote  #2

1714327312
Report to moderator
BitcoinCleanup.com: Learn why Bitcoin isn't bad for the environment
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714327312
Hero Member
*
Offline Offline

Posts: 1714327312

View Profile Personal Message (Offline)

Ignore
1714327312
Reply with quote  #2

1714327312
Report to moderator
sbuss (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile WWW
March 06, 2014, 09:19:54 AM
 #2

I've decided to go ahead and put it up on PyPI, as I'm reasonably sure it's working correctly given the number of tests: https://pypi.python.org/pypi/bitmerchant

If anybody runs into problems please open a ticket at https://github.com/sbuss/bitmerchant/issues
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!