Bitcoin Forum
May 02, 2024, 12:10:04 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bitcoin Core Multi-wallet HTTP RPC request problem in v16  (Read 223 times)
bdev92837 (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
August 25, 2018, 01:43:06 PM
 #1

I created multi-wallets in bitcoin core using bitcoin.conf, I can interact with my wallets using this directly in Ubuntu

bitcoin-cli -rpcwallet=wallet1.dat getbalance

but when I try using the http endpoint using easybitcoin.php and this syntax from the web browser, I get the error

Requested wallet does not exist or is not loaded

$bitcoin = new Bitcoin("userhidden","passhiddden", '127.0.0.1:8332/wallet/wallet1.dat/');

I have tried removing the backslash for the URL, but I get the same error.
The block chain is the main innovation of Bitcoin. It is the first distributed timestamping system.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714608604
Hero Member
*
Offline Offline

Posts: 1714608604

View Profile Personal Message (Offline)

Ignore
1714608604
Reply with quote  #2

1714608604
Report to moderator
1714608604
Hero Member
*
Offline Offline

Posts: 1714608604

View Profile Personal Message (Offline)

Ignore
1714608604
Reply with quote  #2

1714608604
Report to moderator
AdolfinWolf
Legendary
*
Offline Offline

Activity: 1946
Merit: 1427


View Profile
August 25, 2018, 03:01:18 PM
 #2

The README.md of https://github.com/aceat64/EasyBitcoin-PHP states the following;


Code:
$bitcoin = new Bitcoin('username','password','localhost','8332');

I don't really understand why you included the /wallet.dat/, changed the '' into "", and put both the IP and port in one syntax. I'm not an expert, but that might be wrong.

Try changing

Code:
$bitcoin = new Bitcoin("userhidden","passhiddden", '127.0.0.1:8332/wallet/wallet1.dat/');

To

Code:
$bitcoin = new Bitcoin('userhidden','passhidden','127.0.0.1','8332');

And see if that changes anything.


bdev92837 (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
August 25, 2018, 04:03:41 PM
 #3

The '' or "" does not matter when calling the function, the thing is this if for multi wallets, you have to specify the different wallet name which is being called as rpcwallet when I do it with bitcoin-cli from the command prompt it works, but the http end point is not working.

You can see the reference to how this works here, I created 30 different wallets on the server, i.e, wallet1.dat, wallet2.dat...wallet30.dat, you have to call the name of the wallet you are referring to, basically I can get it work in bitcoin-cli, but not with the http

https://bitcoin.org/en/release/v0.15.0.1#multi-wallet-support
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3374
Merit: 6571


Just writing some code


View Profile WWW
August 26, 2018, 09:34:22 PM
 #4

I believe you are just using EasyBitcoin incorrectly.

The constructor for a Bitcoin object is

Code:
__construct($username, $password, $host = 'localhost', $port = 8332, $url = null)
So you are setting $host to be the URL you want to use. However when EasyBitcoin sends the RPC call, it will use the URL of {$this->host}:{$this->port}/{$this->url}. So the real URL that you are using is 127.0.0.1:8332/wallet/wallet1.dat/:8333 which is not the wallet your bitcoind has loaded.

Rather you should be doing
Code:
$bitcoin = new Bitcoin("userhidden","passhiddden", '127.0.0.1', '8332', 'wallet/wallet1.dat/');

You can check the endpoints that are actually being called by starting bitcoind with -debug=rpc and then looking at the debug log. The endpoints that are being called should be logged and you can see the difference between the URLs from bitcoin-cli and the URLs from EasyBitcoin.

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!