Closed ap-m closed 10 years ago
You're very close; BIP32's specification says all public keys are in compressed format, meaning that's what is hashed. To create the WIF that indicates you want to use the compressed address, put '01' at the end! That's it; the WIF this yields is the right address as per brainwallet. BitcoinLib::private_key_to_WIF(BIP32::import($master[0])['key'].'01', '6f')."\n";
I'll add an argument to that function and mention it around the documentation to clear this up.
Now possible by specifying an argument: https://github.com/Bit-Wasp/bitcoin-lib-php/blob/20daa7a777aefd014e904d13b0f2c07525342800/src/BitcoinLib.php#L351
Hello,
I've been experimenting with getting the WIF encoding of a BIP32 extended private key, so I can import it into the bitcoind wallet using the "importprivkey" command (while using the Bitcoin testnet).
I simplified the existing test_bip32.php script, and had it emit the address and WIF of the master private key using BitcoinLib::private_key_to_WIF():
Running the script prints:
I then tried importing the private key using bitcoind's "importprivkey" command:
It appeared to complete okay, with somewhat of a delay due to the rescan.
Then I tried to dump that imported key using the "dumpprivkey" command, but it gave an error like below:
I'm new to Bitcoin and this library, so I'm not sure if this is a bug, or if it's just me generating the address or WIF incorrectly.
If this isn't a bug, would it be possible to provide some sample code showing how to get the address and WIF properly?
This was with commit 9eab00f2ff, under OS X 10.9.2, with bitcoind v0.9.99.0-b733288-beta (built from source).
Thanks!