Bitcoin Forum
June 29, 2024, 08:00:17 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Ready Made Php Script Required for Private Key to Public Key Conversation  (Read 488 times)
WAHXTIPL (OP)
Newbie
*
Offline Offline

Activity: 30
Merit: 0


View Profile WWW
January 06, 2016, 06:41:33 PM
 #1

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
Mitchell
Copper Member
Legendary
*
Offline Offline

Activity: 3962
Merit: 2207


Verified awesomeness ✔


View Profile WWW
January 06, 2016, 07:23:36 PM
 #2

http://stackoverflow.com/a/20846701

.
Duelbits
            ▄████▄▄
          ▄█████████▄
        ▄█████████████▄
     ▄██████████████████▄
   ▄████▄▄▄█████████▄▄▄███▄
 ▄████▐▀▄▄▀▌████▐▀▄▄▀▌██

 ██████▀▀▀▀███████▀▀▀▀█████

▐████████████■▄▄▄■██████████▀
▐██████████████████████████▀
██████████████████████████▀
▀███████████████████████▀
  ▀███████████████████▀
    ▀███████████████▀
.
         ▄ ▄▄▀▀▀▀▄▄
         ▄▀▀▄      █
         █   ▀▄     █
       ▄█▄     ▀▄   █
      ▄▀ ▀▄      ▀█▀
    ▄▀     ▀█▄▄▄▀▀ ▀
  ▄▀  ▄▀  ▄▀

Live Games

   ▄▄▀▀▀▀▀▀▀▄▄
 ▄▀ ▄▄▀▀▀▀▀▄▄ ▀▄
▄▀ █ ▄  █  ▄ █ ▀▄
█ █   ▀   ▀   █ █  ▄▄▄
█ ▀▀▀▀▀▀▀▀▀▀▀▀▀ █ █   █
█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█  █▄█
█ ▀▀█  ▀▀█  ▀▀█ █  █▄█

Slots
.
        ▄▀▀▀▀▀▀▀▀▀▀▀▀▀▄
        █         ▄▄  █
▄▀▀▀▀▀▀▀▀▀▀▀▀▀▄       █
█  ▄▄         █       █
█             █       █
█   ▄▀▀▄▀▀▄   █       █
█   ▀▄   ▄▀   █       █

Blackjack
|█▀▀▀▀▀█▄▄▄
       ▀████▄▄
         ██████▄
▄▄▄▄▄▄▄▄█▀    ▀▀█
████████▄        █
█████████▄        █
██████████▄     ▄██
█████████▀▀▀█▄▄████
▀▀███▀▀       ████
   █          ███
   █          █▀
▄█████▄▄▄ ▄▄▀▀
███████▀▀▀
.
                 NEW!                  
SPORTS BETTING 
|||
[ Đ ][ Ł ]
AVAILABLE NOW

Advertisements are not endorsed by me.
WAHXTIPL (OP)
Newbie
*
Offline Offline

Activity: 30
Merit: 0


View Profile WWW
January 13, 2016, 01:20:52 PM
 #3


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.
Nixtren
Member
**
Offline Offline

Activity: 78
Merit: 10


View Profile WWW
January 13, 2016, 02:11:06 PM
 #4

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:
<?php
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.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!