6

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.

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

  • Great... but can you tell me how to implement this? And where is the HTML or PHP code in source code? – coDe murDerer Jul 14 '17 at 13:31
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

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>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.