BitVault/money-tree — pull request #2 by mhanne (2014-05-09 15:21:02+00:00)
Title: preserve leading zeroes when exporting private key to hex/wif

otherwise keys starting with a zero would end up having a different address when imported somewhere else.

Tested against the Bitcoin::Key library in bitcoin-ruby and electrum's import feature.

Not sure if this is the best way to fix it, since #int_to_hex is also used for other things that might be <64 chars - but at least it doesn't break the tests.

PS: If there still is some way to create a valid signature for such a mistakenly-created address, I'd like to know about it since we still have money stuck there, but I don't have much hope on that.. It's not a very large amount at least.

PPS: Also thanks a lot for the library in the first place - I was really thrilled when I first saw it! :)