denpamusic / php-bitcoinrpc

Fully unit-tested Bitcoin JSON-RPC client based on GuzzleHttp.
MIT License
282 stars 100 forks source link

bitcoin.conf options #48

Closed defense-org closed 5 years ago

defense-org commented 5 years ago

hi, i'm not able to connect to my node (prune),maybe i haven't my .conf whith right options: prune=550 rpcuser=xxxxxxxxxxxxx rpcpassword=xxxxxxxxxxxxxxx maxconnections=24 server=1 testnet=0 rpcconnect=127.0.0.1 daemon=1 Do i need to change anything? Thanks

denpamusic commented 5 years ago

Hi, from the first glance, everything looks ok. Are your node and php-bitcoinrpc running on the same machine? If so, does bitcoin-cli work?

defense-org commented 5 years ago

hi, hello, thanks for your interest, yes, all on the same vps, but I forgot to tell you that the node is still synchronizing ... anyway, if I do bitcoin-cli getnewaddress from the client thr address is printed, if I try from my .php page does not return anything...

denpamusic commented 5 years ago

How are you trying to get it? Maybe you're forgetting to issue get() on response, and ending up with BitcoindResponse object instead of actual address as string. Your code should look like this:

require 'vendor/autoload.php';

use Denpa\Bitcoin\Client as BitcoinClient;

$bitcoind = new BitcoinClient('http://rpcuser:rpcpassword@localhost:8332/');

$address= $bitcoind->getNewAddress();

echo 'Adress: ' . $address->get();

Also are there any errors in php error log?

defense-org commented 5 years ago

my code is different after connection part but now it works...i haven't changed anything from yesterday, the node is at 492000 blocks now...could it be that the node is closer to synchronization than yesterday? Thank you for your help now and for all the work you have done for this project

denpamusic commented 5 years ago

You're welcome!

Maybe it was timeout issue, syncing nodes are quite slow with their responses to API requests. Which is actually good point, since there's no way to control timeout in current version and I really should add one.

Anyway, glad that it works for you now!

I've finally got some time to work on this project, so look forward to the version 2.2.0. One big thing that it'll feature is support for request batches as described in specification. This will allow for sending multiple commands in one request, which is a lot faster compared to doing it one by one.

For example this will be possible:

// this will be send to core as single request
[$address1, $address2] = $bitcoind->send('getnewaddress', 'getnewaddress');
defense-org commented 5 years ago

wow nice, I am very excited that there will be a development of the current version ... I'm sorry not being able to support you in this hard work !!! in these days I will try to make transactions on the testnet and then switch to main to create a automation in payment services! thank you teacher!!!