I'm new with bitcoin, and I would like create a application that have wallets and transactions, but I dont know how start, I was reading the api blockchain.info and is interested use the module that they facilitate you. But this modules is with nodejs, and I want make my application with php (laravel).

My question is, Can i use blockchain api with php?, Is mandatory install the module of blockchain?.

I have bitcoin-core installed, but nevertheless I have not used any of the 3 commands such as bitcoind, bitcoin-cli and bitcoint-qt, I would also like to know what it is for?, if this is combined with blockchain-wallet-service?, or How I can star using bitcoin-core to start with php?.


To get started I'd recommend you familiarize yourself with the JSON-RPC API that is built-in with bitcoin-core (https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)).

Once you have installed bitcoin you need to configure it. You do this by creating a bitcoin.conf file and setting our options inside of it.

Create a new file in your text editor and make sure you have a RPC username/password and activate the daemon by setting it to 1.


Save your text file as bitcoin.conf in your /bitcoin directory. You may need to do sudo apt-get update first. Bitcoin will be installed in ~/.bitcoin

You should now be able to execute bitcoind and let it sync with the network. Navigate to your bitcoin directory and type in bitcoind in your shell.


Give it a few minutes to start syncing but you can verify the status of your node by typing

bitcoin-cli getblockchaininfo

Now you need to wait for the syncing to finish.

If you check the bitcoin wiki JSON-RPC page you will see references for many different languages. The library recommended for PHP is the EasyBitcoinPHPLibarary. The easiest way to get the library is to visit the GitHub page (https://github.com/aceat64/EasyBitcoin-PHP)

The easybitcoin library makes cURL requests to bitcoind's JSON-RPC 8332 port.

Copy the contents of the easybitcoin.php and save it as a new php file called easybitcoin.php. Make sure you place this file in your web server directory as you will need to require(); it in you PHP code.

Now you can start making calls to your bitcoind server through PHP, for example to get the balance of your node...

$bitcoin = new Bitcoin("someusername", "somepassword");
$balance = $bitcoin->getbalance();

You can also create new addresses, by changing getbalance() in the above example to getnewaddress();. If you want to add a label for this new address just include it in the parenthesis.

$info = $bitcoin->getnewaddress("Nakamoto");

You will see a brand new bitcoin address that has been added to your node and can start accepting transactions.

  • Thanks to answer my question, i have other quest, when i download bitcoin-core i need install to 6gb or 300 gb in my desktop? or I need only the commands bitcoin-cli, bitcont-qt and bitcoind?, and if i need create my app i need install bitcoin in my server or in my local, to call the api?. – Aisakk Dec 14 '20 at 16:40
  • Typically home computers and routers are not set up to be accessed by the web. Your question asked how make an application with PHPusing bitcoin-core which implies you are working on a web server. In such case you will need to install and run bitcoin on a web server. bitcoin-cli, bitcoin-qt and bitcoind are all included with a bitcoin installation. The size varies, but you can elect to run a prune node which closer to 6GB than 300GB. – m1xolyd1an Dec 15 '20 at 1:58
  • so do I have to download the full bitcore package to work? Or can I work directly with bitcoind, bitcoin-cli to develop, without the need to download the rest? – Aisakk Dec 15 '20 at 16:36
  • A pruned node downloads everything in order to validate properly, but it purges old blocks after validation so that the disk space used is limited. – m1xolyd1an Dec 16 '20 at 3:40

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.