How to create bitcoin wallet by PHP

6

4

I'm new to Bitcoin. I want to use PHP to create a bitcoin wallet on my own website. I came to here https://blockchain.info/api/create_wallet but I don't know how to apply it.

Would like to have good tutorials from some websites or videos.

GarlicBread

Posted 2014-02-02T07:03:09.713

Reputation: 85

Answers

3

I would highly discourage writing your own PHP Wallet App, in which without proper security, your wallet and your clients wallets might be compromised in the future.

But if you insist on creating an online wallet, I would highly recommend Blockchain's Online Wallet. You can access the source code here

The application is written in Javascript, which enables a second layer of security (all operations are done on the user's browser). I think you can use this through your PHP application, in which nearly all web apps use Javascript libraries.

Cheers,

-Besir

Besir Kurtulmus

Posted 2014-02-02T07:03:09.713

Reputation: 179

Great... but can you tell me how to implement this? And where is the HTML or PHP code in source code?coDe murDerer 2017-07-14T13:31:48.623

4

You can find your answer here

Snippet of code

Example from bitcointalk

    <?php
  #Below is full list of available characters.
  #"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
  $fp=fopen("/dev/urandom","r") or die;
  $available_chars="23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz";
  do{
    $minikey='S';
    for($i=0;$i<29;$i++){
      while(($c=ord(fgetc($fp)))>=strlen($available_chars));
      $minikey.=substr($available_chars,$c,1);
    }
    $check=hash('sha256',$minikey . '?') . "\n";
  }while(substr($check,0,2)!='00');
  fclose($fp);
  $priv=hash('sha256',$minikey);
  print "Minikey: $minikey\n";
  print "Privkey: $priv\n";
?>

You can find some useful information here

Marek

Posted 2014-02-02T07:03:09.713

Reputation: 819

1

. You can use Bitcoin-PHP Payment library - https://github.com/cryptoapi/Payment-Gateway

    <?
        require_once( "cryptobox.class.php" );

        $options = array( 
        "private_key" => "",        // private key from gourl.io
        "orderID"     => "your_product1_or_signuppage1_etc",
        "amountUSD"   => 2          // 2 USD
        );  

        // Initialise Payment Class
        $box1 = new Cryptobox ($options);

        // Display Payment Box or successful payment result   
        $paymentbox = $box1->display_cryptobox();

        // A. Process Received Payment
        if ($box1->is_paid()) 
        { 

            // Your code here to handle a successful cryptocoin payment
            // ...
        }  
        else $message .= "The payment has not been made yet";
    ?>
    <!DOCTYPE html>
    <html><head></head>
    <body>
    <?= $paymentbox ?>
    <?= $message ?>
    </body>
    </html>

webdev1

Posted 2014-02-02T07:03:09.713

Reputation: 11