Author

Topic: How can I get a public bitcoin address from a WIF (Wallet Import Format) (Read 863 times)

kjj
legendary
Activity: 1302
Merit: 1026
You need an ECDSA library for PHP.  There is one available, but it doesn't have the curve we use.  The constants are in the NIST guide.

Once you decode and verify the base58check encoding, you'll be left with 256 bits and an optional 8 bit flag.

The public key is made my multiplying he base point of the curve, g by the 256 bit private key.  The public key is a point, two 256 bit numbers.

If the optional flag was not found while decoding, the public key encoding is chr(4) . $x . $y.  If the flag was found, it is chr(2+($y%2)).$x.

From there, you hash the public key encoding, first with SHA256, and then with RIPEMD-160.  Run that through a base58check encoder, and you have the address.
newbie
Activity: 12
Merit: 0
As the subject says: How can I get a public bitcoin address from a WIF (Wallet Import Format)

I'm using PHP, if anyone could point me the right way, that would be great!
Jump to: