<p>To get started I'd recommend you familiarize yourself with the JSON-RPC API that is built-in with bitcoin-core (<a href="https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)" rel="nofollow noreferrer">https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)</a>).</p>
<p>Once you have installed bitcoin you need to configure it. You do this by creating a <code>bitcoin.conf</code> file and setting our options inside of it.</p>
<p>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.</p>
<pre><code>rpcuser=someusername
rpcpassword=somepassword
daemon=1
</code></pre>
<p>Save your text file as bitcoin.conf in your /bitcoin directory. You may need to do <code>sudo apt-get update</code> first. Bitcoin will be installed in ~/.bitcoin</p>
<p>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.</p>
<pre><code>bitcoind
</code></pre>
<p>Give it a few minutes to start syncing but you can verify the status of your node by typing</p>
<pre><code>bitcoin-cli getblockchaininfo
</code></pre>
<p>Now you need to wait for the syncing to finish.</p>
<p>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 (<a href="https://github.com/aceat64/EasyBitcoin-PHP" rel="nofollow noreferrer">https://github.com/aceat64/EasyBitcoin-PHP</a>)</p>
<p>The easybitcoin library makes cURL requests to bitcoind's JSON-RPC 8332 port.</p>
<p>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.</p>
<p>Now you can start making calls to your bitcoind server through PHP, for example to get the balance of your node...</p>
<pre><code>&lt;?php
require(&quot;easybitcoin.php&quot;);
$bitcoin = new Bitcoin(&quot;someusername&quot;, &quot;somepassword&quot;);
$balance = $bitcoin-&gt;getbalance();
print_r($balance);
?&gt;
</code></pre>
<p>You can also create new addresses, by changing <code>getbalance()</code> in the above example to <code>getnewaddress();</code>. If you want to add a label for this new address just include it in the parenthesis.</p>
<pre><code>$info = $bitcoin-&gt;getnewaddress(&quot;Nakamoto&quot;);
</code></pre>
<p>You will see a brand new bitcoin address that has been added to your node and can start accepting transactions.</p>

CC BY-SA 4.0
2020-12-14T16:40:38.213Z
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
CC BY-SA 4.0
2020-12-15T01:58:25.867Z
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
CC BY-SA 4.0
2020-12-15T16:36:53.697Z
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
CC BY-SA 4.0
2020-12-16T03:40:55.567Z
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
CC BY-SA 4.0
2020-12-14T04:05:03.953Z
2020-12-14T04:05:03.953Z
m1xolyd1an
<p>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).</p>
<p>My question is, Can i use blockchain api with php?, Is mandatory install the module of blockchain?.</p>
<p>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?.</p>

<api><php>
How start make a application with php
Aisakk
# How start make a application with php

(Asked by: username_0 on 2020-12-13)

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?.

**Tags:** api, php


---

## 1 answers

### Answer by username_1 on 2020-12-14. Score: 1 | Accepted answer

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.

```
rpcuser=someusername
rpcpassword=somepassword
daemon=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.

```
bitcoind

```

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...

```
<?php
require("easybitcoin.php");
$bitcoin = new Bitcoin("someusername", "somepassword");
$balance = $bitcoin->getbalance();
print_r($balance);
?>

```

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.

> **Comments:**
> **username_0**: 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?.  
> **username_1**: 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.  
> **username_0**: 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?  
> **username_1**: 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.  

---

