Title: [PHP] How to get the address from a private key? Post by: alex1s on April 07, 2015, 11:03:50 AM How can I calculate the public address if I only have the private key with PHP only?
For example I have 5K2YUVmWfxbmvsNxCsfvArXdGXm7d5DC9pn4yD75k2UaSYgkXTh and want 1HKqKTMpBTZZ8H5zcqYEWYBaaWELrDEXeE Does anyone have a working PHP code without using bitcoind or any other API/tools? Title: Re: [PHP] How to get the address from a private key? Post by: defcon23 on April 07, 2015, 11:13:02 AM How can I calculate the public address if I only have the private key with PHP only? just import the private key into your wallet , and you've got the public key.For example I have 5K2YUVmWfxbmvsNxCsfvArXdGXm7d5DC9pn4yD75k2UaSYgkXTh and want 1HKqKTMpBTZZ8H5zcqYEWYBaaWELrDEXeE Does anyone have a working PHP code without using bitcoind or any other API/tools? Title: Re: [PHP] How to get the address from a private key? Post by: cr1776 on April 07, 2015, 11:20:39 AM It really depends on what you are asking, but this may be useful:
https://bitcointalk.org/index.php?topic=1008030.0 Title: Re: [PHP] How to get the address from a private key? Post by: abyrnes81 on April 07, 2015, 11:21:32 AM How can I calculate the public address if I only have the private key with PHP only? For example I have 5K2YUVmWfxbmvsNxCsfvArXdGXm7d5DC9pn4yD75k2UaSYgkXTh and want 1HKqKTMpBTZZ8H5zcqYEWYBaaWELrDEXeE Does anyone have a working PHP code without using bitcoind or any other API/tools? Maybe try this source on gitHub: https://github.com/RobKohr/PHP-Bitcoin-Address-Creator or http://gobittest.appspot.com/Address Title: Re: [PHP] How to get the address from a private key? Post by: coinableS on April 07, 2015, 01:04:20 PM A lot will depend on what PHP extensions you have installed on your server. If you're on shared hosting (like many are) your hosting provider controls what version of PHP is ran and which extensions. Echo out phpinfo(); to see what you have installed. Ones that I have seen you'll need bcrypt, bmath, and an ECC library as well. So I usually just end up using a 3rd party API to do key generation.
Maybe give this one a try, it doesn't have many requirements. https://github.com/BitcoinPHP/BitcoinECDSA.php Title: Re: [PHP] How to get the address from a private key? Post by: Amph on April 07, 2015, 01:55:02 PM wiki is your friend here
https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses also, for more in depth knowledge about ecdsa creation http://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm Title: Re: [PHP] How to get the address from a private key? Post by: frogCorporation on April 07, 2015, 04:05:41 PM Hello, alex1s,
We had almost the same issue and we used the following answer on stackoverflow http://stackoverflow.com/questions/19233053/hashing-from-a-public-key-to-a-bitcoin-address-in-php However we do not know its behaviour in a case of multiple senders. For example if you need to retrieve the addresses of those, who sent you some coins, f.ex using walletnotify. Title: Re: [PHP] How to get the address from a private key? Post by: Bitcoin_BOy$ on April 10, 2015, 03:28:44 PM Well you can use a ready PHP library to do this , I didn't ever saw how it work and how Bitcoin address are hashed !
You can check this library and you will probably understand how it work and make your own ` easy code ` . https://github.com/Bit-Wasp/bitcoin-lib-php Kind Of Respect , Bitcoin Boy . Title: Re: [PHP] How to get the address from a private key? Post by: dabura667 on April 10, 2015, 04:29:01 PM How can I calculate the public address if I only have the private key with PHP only? For example I have 5K2YUVmWfxbmvsNxCsfvArXdGXm7d5DC9pn4yD75k2UaSYgkXTh and want 1HKqKTMpBTZZ8H5zcqYEWYBaaWELrDEXeE Does anyone have a working PHP code without using bitcoind or any other API/tools? 5K2YUVmWfxbmvsNxCsfvArXdGXm7d5DC9pn4yD75k2UaSYgkXTh vvvvvvvvvvvvv https://github.com/Bit-Wasp/bitcoin-lib-php/blob/master/src/BitcoinLib.php#L568 vvvvvvvvvvvvv https://github.com/Bit-Wasp/bitcoin-lib-php/blob/master/src/BitcoinLib.php#L430 vvvvvvvvvvvvv https://github.com/Bit-Wasp/bitcoin-lib-php/blob/master/src/BitcoinLib.php#L389 vvvvvvvvvvvvv 1HKqKTMpBTZZ8H5zcqYEWYBaaWELrDEXeE Title: Re: [PHP] How to get the address from a private key? Post by: NyeFe on April 12, 2015, 02:28:00 PM This is a lengthy instruction on the process:
http://bitcoin.stackexchange.com/questions/25024/how-do-you-get-a-bitcoin-public-key-from-a-private-key-this-is-a-new-question But it works accordingly. |