Make a testnet payment in php with block.io
Choose Testnest -> Bitcoin (Testnet)
Click on Show API Keys and get the Bitcoin key
Clone this project, go in the project directory
cd block-io-exercice
Edit index.phpand add your Bitcoin api key
$apiKey = 'xxxx-xxxx-xxxx-xxxx';
and your pin password
$pin = 'xxxxxx';
Execute
php index.phpThen you should see the balance of the 2N6rmc2rcsFnPQHPskzVRGQ9XyHbEmyPudX address
You can verify on http://tbtc.blockr.io/address/info/2N6rmc2rcsFnPQHPskzVRGQ9XyHbEmyPudX (it's not block.io, but blockr.io services)
You might need to install some packages
apt-get update && apt-get -y install php5-curl php5-mcryptMake payments with the block.io PHP API Use the
withdraw_from_addresses()
function to make payments. Details are on the block.io PHP API documentation: https://www.block.io/api/simple/phpNote: You are identified in block.io with your API key, so you don't need to use any private key on the
'from_addresses' => 'ADDRESS1,ADDRESS2,...'
, just your block.io public key.You can make a test payment on 2N6rmc2rcsFnPQHPskzVRGQ9XyHbEmyPudX
For your test, you can have free testnet bitcoins on https://testnet.manu.backend.hamburg/faucet You can use
get_my_addresses()
to automaticaly select the address with enough bitcoin.Example:
$totalAmount = 0.001; $blockAddresses = $block_io->get_my_addresses(); foreach($blockAddresses->data->addresses as $address) { if ($address->available_balance > $totalAmount) { $paymentAddress = $address->address; break; } }