Sunday, September 22, 2024

transactions – Learn how to ship bitcoins with out the bitcoin consumer in PHP

You will want to hook up with a bitcoin node in a technique or one other to broardcast to the newtork. There are a variety of php and bitcoin open supply repos that may do that, take a look right here https://github.com/search?q=bitcoind+php&ref=cmdform

Another choice if you do not need to run the bitcoin consumer regionally is to hook up with an api to broadcast your transaction.

An instance I discovered for php connecting to blockchain.data is as follows

<?php

$guid="GUID_HERE";
$firstpassword="PASSWORD_HERE";
$secondpassword="PASSWORD_HERE";
$amounta = "10000000";
$amountb = "400000";
$addressa = "1A8JiWcwvpY7tAopUkSnGuEYHmzGYfZPiq";
$addressb = "1ExD2je6UNxL5oSu6iPUhn9Ta7UrN8bjBy";
$recipients = urlencode('{
              "'.$addressa.'": '.$amounta.',
              "'.$addressb.'": '.$amountb.'
           }');

$json_url = "http://blockchain.data/service provider/$guid/sendmany?password=$firstpassword&second_password=$secondpassword&recipients=$recipients";

$json_data = file_get_contents($json_url);

$json_feed = json_decode($json_data);

$message = $json_feed->message;
$txid = $json_feed->tx_hash;

?>

Hope this helps

UPDATE: To run requests to the blockchain.data API you’ll want to observe the setup directions right here https://www.blockchain.com/api/blockchain_wallet_api

NOTE To make use of this API, you will have to run small native service which be chargeable for managing your Blockchain Pockets. Your utility interacts with this service regionally through HTTP API calls. Click on right here for full setup directions on GitHub.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles