Author

Topic: Ready Made Php Script Required for Private Key to Public Key Conversation (Read 488 times)

member
Activity: 78
Merit: 10
A while ago I quickly coded an hacky solution (actually, the work is done by BitcoinLib) to perform the private key (WIF) to Bitcoin Address conversion:

Code:
require 'vendor/autoload.php'// Composer ftw!

//use BitcoinPHP\BitcoinECDSA\BitcoinECDSA;
use BitWasp\BitcoinLib\BitcoinLib;

//$bitcoinECDSA = new BitcoinECDSA();
$bitcoinlib = new BitcoinLib();

//$bitcoinECDSA->setPrivateKey($private);
//$bitcoin_addr = $bitcoinECDSA->getAddress();
$bitcoin_addr $bitcoinlib->private_key_to_address($private);

Now you just have to download the BitcoinECDSA and BitcoinLib PHP libraries and figure out how to load them*:
https://github.com/BitcoinPHP/BitcoinECDSA.php
https://github.com/Bit-Wasp/bitcoin-lib-php/blob/master/src/BitcoinLib.php

*I recommend you to use Composer, but since you're not really a programmer I'm not sure if it's worth.

One of the libraries didn't work properly with my PHP version (5.6/7), that's why I have two libraries in my script even though I only use one of them.
newbie
Activity: 30
Merit: 0

Sir, this is not helping us.

Let's assume my wif key is 5ssdrhytfddzagbjbvhDghbRfg and my Bitcoin address is 3sdhjufcb

How you are converting it from wif key to address. We don't want to generate any new private key. We just want to convert same private key inside wallet to address without using core.

E.g. $PrivateKey = hash ("sha256", $publickey, flase);

Please make this simple. I am hardware supplier and they are just under 18 students. Very difficult for us to understand and do it.
copper member
Activity: 3948
Merit: 2201
Verified awesomeness ✔
newbie
Activity: 30
Merit: 0
Hi All,

I am looking for ready made script (Just Copy Paste) which will allow me convert any given private key to Bitcoin address. I got selected for India's Blockchain hacking marathon of IIT. Does not have time to study ESCDA. If any one has ready made script for converting Private Key to Public Key (Address). Please post it in forum. This will be quick and handy tool for us to prove that reversed hashing is not possible.

Thanks in advance
Jump to: