Author

Topic: Bitcoin Core Multi-wallet HTTP RPC request problem in v16 (Read 235 times)

newbie
Activity: 2
Merit: 0
Awesome, that worked, just sent you a tip, thank you so much.
staff
Activity: 3458
Merit: 6793
Just writing some code
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.
newbie
Activity: 2
Merit: 0
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
legendary
Activity: 1946
Merit: 1427
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.

newbie
Activity: 2
Merit: 0
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.
Jump to: