Simple PHP library that allows simple communication to the localhost nodeJS wallet service.
BTC: 1NPrfWgJfkANmd1jt88A141PjhiarT8d9U
- Requirements
- Blockchain.info account with nodeJS wallet service running
- Need a guide to setting up the nodeJS wallet service? http://btcthreads.com/how-to-setup-blockchain-wallet-service/
-
Download or clone the main project and extract files.
-
Include or require the
wallet-lib.php
filerequire_once("wallet-lib.php");
-
Initiate the login to your nodeJS wallet service
$bci = new blockchain("your_api_key", "your_wallet_id_guid", "your_password", "your_nodejs_wallet_service_port"); $login = $bci->login(); print_r($login);
- If your receive an error at this point, check your email. You may need to whitelist your nodeJS service with blockchain.info
- Start making calls
Check wallet balance
$balance = $bci->balance();
print_r($balance);
Create a new receiving address (label is optional)
$new = $bci->new_address("my_label");
print_r($new);
Basic send payment
$pmt = $bci->send("1J9ikqFuwrzPbczsDkquA9uVYeq6dEehsj", 100000);
print_r($pmt);
Advanced send payment with From, Custom Fee and Note options
$pmt = $bci->send("1J9ikqFuwrzPbczsDkquA9uVYeq6dEehsj", 100000, "1FromThisSpecifAddressab324", 10000, "Thanks for using mysite.com");
print_r($pmt);
Send Many
$array = array(
"1someAddress" => 20000,
"1someAddress2" => 150000,
"1someAddress3" => 314159
);
$send = $bci->send_many($array);
print_r($send);