Bitcoin Forum
May 08, 2024, 01:50:40 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Help! to connect Bitcoin Core  (Read 341 times)
Nshan0102 (OP)
Jr. Member
*
Offline Offline

Activity: 98
Merit: 3


View Profile WWW
August 16, 2019, 10:33:02 AM
Merited by OmegaStarScream (1), ABCbits (1), o_e_l_e_o (1)
 #1

Hi there!
I'm searching in the google for more than one week and no result.

I have a Bitcoin Core Wallet in some Hosting ( for example it is:  123.321.256.632 )
There is an laravel programmed project in other hosting ( for example it is:  127.0.0.12 ) which is going to make payment processes.
I have installed Fully unit-tested Bitcoin JSON-RPC client based on GuzzleHttp. ( here is the link to github: https://github.com/denpamusic/php-bitcoinrpc);

In the Bitcoin server I have
1. started bitcoin-qt,
2. set config file ( rpc ) in both places (C:\Users\MyUserName\AppData\Roaming\Bitcoin\bitcoin.conf) and (D:\BlockChain\bitcoin.conf)
    # Generated by https://jlopp.github.io/bitcoin-core-config-generator/

   # This config should be placed in following path:
   # %UserProfile%\AppData\Roaming\Bitcoin\bitcoin.conf

   # [network]
   # Listen for incoming connections on non-default port.
   port=8333

   # [rpc]
   # Listen for JSON-RPC connections on this port
   rpcport=8332

   # [Sections]
   # Most options automatically apply to mainnet, testnet, and regtest networks.
   # If you want to confine an option to just one network, you should add it in the relevant section.  
   # EXCEPTIONS: The options addnode, connect, port, bind, rpcport, rpcbind and wallet
   # only apply to mainnet unless they appear in the appropriate section below.

   # Options only for mainnet
   [main]

   # Options only for testnet
   [test]

   # Options only for regtest
   [regtest]


   server=1

   rpcuser=Admin
   rpcpassword=passWordAdmin
   rpcallowip=123.321.256.632
   rpcconnect=127.0.0.1

Then I want to connect to my Bitcoin Core from my laravel project and it says cURL error 52: Empty reply from server (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
Here is my code to connect with Bitcoin Core

public function btcReplenish(Request $request){

        $bitCoinD = new BitcoinClient([
            'host'          => self::RDC_HOST,
            'port'          => 8333,
            'user'          => self::RDC_USER,
            'password'      => self::RDC_PASS,
        ]);

        $balance = $bitCoinD->wallet('wallet.dat')->getbalance();
        echo $balance->get();        
        die;
    }

Please help me if there is someone who knows how to do that!
1715176240
Hero Member
*
Offline Offline

Posts: 1715176240

View Profile Personal Message (Offline)

Ignore
1715176240
Reply with quote  #2

1715176240
Report to moderator
1715176240
Hero Member
*
Offline Offline

Posts: 1715176240

View Profile Personal Message (Offline)

Ignore
1715176240
Reply with quote  #2

1715176240
Report to moderator
1715176240
Hero Member
*
Offline Offline

Posts: 1715176240

View Profile Personal Message (Offline)

Ignore
1715176240
Reply with quote  #2

1715176240
Report to moderator
I HATE TABLES I HATE TABLES I HA(╯°□°)╯︵ ┻━┻ TABLES I HATE TABLES I HATE TABLES
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
o_solo_miner
Legendary
*
Offline Offline

Activity: 2452
Merit: 1476


-> morgen, ist heute, schon gestern <-


View Profile
August 16, 2019, 02:08:46 PM
Merited by ABCbits (1), o_e_l_e_o (1)
 #2

If you where using core 0.18.1 you should add also this in your bitcoin.conf:

rpcallowip=xxx.xxx.xxx.0/24 (your local Network)
rpcbind=IP of the PC wich is running core /bitcoin-qt

with that it should work.

Consider using rpcauth in the future.

from the creator of CGMiner http://solo.ckpool.org for Solominers
paused: passthrough for solo.ckpool.org => stratum+tcp://rfpool.org:3334
Nshan0102 (OP)
Jr. Member
*
Offline Offline

Activity: 98
Merit: 3


View Profile WWW
August 16, 2019, 02:38:34 PM
 #3

rpcallowip=xxx.xxx.xxx.0/24 (your local Network)
rpcbind=IP of the PC wich is running core /bitcoin-qt

isn't the rpcallowip the same as rpcbind?
o_solo_miner
Legendary
*
Offline Offline

Activity: 2452
Merit: 1476


-> morgen, ist heute, schon gestern <-


View Profile
August 16, 2019, 02:43:39 PM
 #4

no, with core 18.0.0 it changes, so you must use rpcbind.
You can read the core change log for rpcbind.

The same applied to 'Solo Miner', as the miner can't get work from bitcoind if the rpcbind is not set.

from the creator of CGMiner http://solo.ckpool.org for Solominers
paused: passthrough for solo.ckpool.org => stratum+tcp://rfpool.org:3334
Nshan0102 (OP)
Jr. Member
*
Offline Offline

Activity: 98
Merit: 3


View Profile WWW
August 16, 2019, 02:52:18 PM
 #5

no, with core 18.0.0 it changes, so you must use rpcbind.
You can read the core change log for rpcbind.

The same applied to 'Solo Miner', as the miner can't get work from bitcoind if the rpcbind is not set.

Is it neccessary to run bitcoind deamon, or it is ok if the bitcoin-qt is running?
o_solo_miner
Legendary
*
Offline Offline

Activity: 2452
Merit: 1476


-> morgen, ist heute, schon gestern <-


View Profile
August 16, 2019, 03:00:09 PM
 #6

bitcoin-qt is fine, the same conf used for qt.
Bitcoin-qt is basicly the gui for bitcoind, so thats why it is the same.

from the creator of CGMiner http://solo.ckpool.org for Solominers
paused: passthrough for solo.ckpool.org => stratum+tcp://rfpool.org:3334
Nshan0102 (OP)
Jr. Member
*
Offline Offline

Activity: 98
Merit: 3


View Profile WWW
August 16, 2019, 03:42:18 PM
 #7

bitcoin-qt is fine, the same conf used for qt.
Bitcoin-qt is basicly the gui for bitcoind, so thats why it is the same.
Thank you very much I will try and let you know if it's the solution!
Nshan0102 (OP)
Jr. Member
*
Offline Offline

Activity: 98
Merit: 3


View Profile WWW
August 16, 2019, 04:51:29 PM
 #8

I have inserted that sattings to my bitcoin.conf, but still can't connect to it  Undecided Undecided Undecided
o_solo_miner
Legendary
*
Offline Offline

Activity: 2452
Merit: 1476


-> morgen, ist heute, schon gestern <-


View Profile
August 16, 2019, 04:56:58 PM
 #9

first problem is solved, bitcoin-qt, leave it as it is now.

for your second problem:

bitcoin.conf
Code:
 # [rpc]
   # Listen for JSON-RPC connections on this port
   rpcport=8332


your app credentials
Code:
public function btcReplenish(Request $request){
        $bitCoinD = new BitcoinClient([
            'host'          => self::RDC_HOST,
           [i] 'port'          => 8333,[/i]
            'user'          => self::RDC_USER,
            'password'      => self::RDC_PASS,
        ]);

did you try to use the bitcoin-qt rpc-port:
       'port'          => 8332,

from the creator of CGMiner http://solo.ckpool.org for Solominers
paused: passthrough for solo.ckpool.org => stratum+tcp://rfpool.org:3334
Nshan0102 (OP)
Jr. Member
*
Offline Offline

Activity: 98
Merit: 3


View Profile WWW
August 17, 2019, 06:27:41 AM
 #10

did you try to use the bitcoin-qt rpc-port:
       'port'          => 8332,
Yep! I have tried but the 8332 port is closed and the response is

cURL error 7: Failed to connect to 123.321.256.632 port 8332: Timed out (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
Nshan0102 (OP)
Jr. Member
*
Offline Offline

Activity: 98
Merit: 3


View Profile WWW
August 17, 2019, 02:41:43 PM
 #11

today I have searched very long to discover if my bitcoin.conf settings are wrong, and I found some mistakes there.
After some fixes I could run commands from my Bitcoin server's command line and it works.

Now the problem is that I still can't use my rpc.

I'm sorry for this, but I just want to know if it's required to install some server like ( Apache, nginx... ) in the Bitcoin server side?
Because I'm new in this kind of stuff and have to learn many things.
o_solo_miner
Legendary
*
Offline Offline

Activity: 2452
Merit: 1476


-> morgen, ist heute, schon gestern <-


View Profile
August 18, 2019, 09:02:48 AM
Last edit: August 18, 2019, 09:32:06 AM by o_solo_miner
Merited by Nshan0102 (1)
 #12

for bitcoin core: simple answer is no, you don't need it.
But you need the rpc port to be exposed to the outside world to be able to comunicate with it over the internet.
If there is a wallet on the bincoin-qt/bitcoind this is a very bad idea!
Instead, if you want to connect two servers in a different location over the internet, then you have to use a vpn as best. You can use openvpn on both sides of the servers.

for your JSON-RPC client based on GuzzleHttp you need PHP.
But I would not recoment to use that, did you read that:
https://github.com/denpamusic/php-bitcoinrpc/issues/44

Please provide the bitcoin.conf so that others can also learn from what you found.

Did you try to test the rpc over shh localy (on the server itself)  to ensure this works?

It is essential that you have read and understand this:
https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)

from the creator of CGMiner http://solo.ckpool.org for Solominers
paused: passthrough for solo.ckpool.org => stratum+tcp://rfpool.org:3334
Nshan0102 (OP)
Jr. Member
*
Offline Offline

Activity: 98
Merit: 3


View Profile WWW
August 19, 2019, 10:17:16 AM
 #13

Please provide the bitcoin.conf so that others can also learn from what you found.

Now my bitcoin.conf looks likes this.
Code:
# Generated by https://jlopp.github.io/bitcoin-core-config-generator/

# This config should be placed in following path:
# %UserProfile%\AppData\Roaming\Bitcoin\bitcoin.conf

server=1

# [network]
# Listen for incoming connections on non-default port.
port=8333

# [rpc]
# Listen for JSON-RPC connections on this port
rpcuser=Administrator
rpcpassword=somepassword
rpcallowip=111.222.0.0/16
rpcport=8332

Did you try to test the rpc over shh localy (on the server itself)  to ensure this works?
Yes and it works.
But I can't access it from other server.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!