So i created a block.io account and playing around with bitcoin address generation, as well QR codes.

My source code for generating a new bitcoin address is that one:

$block_io_apikey = "xxxx-xxxx-xxxx-xxxx";   // bitcoin API key (testnet)
$block_io_version = 2;                      // API version
$block_io_pin = "xxxxxxxxxx";
$block_io = new BlockIo($block_io_apikey, $block_io_pin, $block_io_version);
$obj = $block_io->get_new_address();
// $obj->data->address;   // the bitcoin address for paying to (my BTC)

My code for generating QR code is that one:

$width  = $height = 250;
$error  = "L"; // handle up to 30% data loss, or "L" (7%), "M" (15%), "Q" (25%)
$border = 1;
$btc_address = "1ArmoryXcfq7TnCSuZa9fQjRYwJ4bkRKfv";   
                     // sample, 
                     // from $block_io->get_new_address()->data->address
$btc_amount  = 0.0001;
$url    = urlencode("bitcoin:$btc_address?amount=$btc_amount");
$filename = sprintf("./payment/block_io/qrcodes_cache/block-io-$btc_address.png");
if (!file_exists($filename)) {
   $qr = webpage_grab( array("url"=>"http://chart.googleapis.com/chart?chs={$width}x{$height}&cht=qr&chld=$error|$border&chl=$url") );
   $imgIn  = imagecreatefromstring($qr);
   $imgOut = imagecreate($width, $height);
   imagecopy($imgOut, $imgIn, 0,0, 0,0, $width,$height);
   imagepng($imgOut, $filename, 9);
echo "<img src=\"$filename\" width=\"$width\" height=\"$height\" alt=\"Scan my QR !\" />";

which generates a QR code using the Google API. I end up with a QR code image that a mobile can scan through an app, paying my newly generated bitcoin address.

My questions are:

1. How to pay into a particular bitcoin address just generated using the above code, using say, the bitcoin testnet? but without mobile?? Just block.io api code.

2. How to scan that QR code (either testnet or real) using a mobile?

3. Can i use, say, blockchain.com application to scan bitcoin addresses (and QR codes by Google API) generated by block.io? or apps does matter between sites?

4. My tablet has an old Android OS (4.4.2 kitkat) and does not support Blockchain.app. If i am allowed to use another app for my block.io QR scanning needs, which one would be?

Sorry for the boatload of questions, just started up.

Your Answer

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

Browse other questions tagged or ask your own question.