cryptean / bitcoinlib

Bitcoin Core RPC compatible, battle-tested .NET library and RPC wrapper for Bitcoin and Altcoins
MIT License
403 stars 206 forks source link

Various 'Wallet' RPC Calls Require URL with '/wallet/<wallet-name>' appended #122

Open apleroy opened 2 years ago

apleroy commented 2 years ago

I'm new to Bitcoin/Blockchain so please forgive me if I'm missing something obvious here...

And thank you so much for your fantastic C#/.NET library and samples.

I am going through the sample program in the DemoClient and am having trouble with many of the RPC commands that are categorized as Wallet RPC methods.

For example, calling CoinService.GetBalance(); throws an error like outlined here: https://stackoverflow.com/questions/64324893/wallet-file-not-specified-must-request-wallet-rpc-through-wallet-filename-ur

I can replicate this using Postman locally getting the same error message: "Wallet file not specified (must request wallet RPC through /wallet/<filename> uri-path)."

To work around and fix this, I made some local changes to update the RpcConnector > MakeRequest() method to add the appended url. So the final call looks something like this (I'm using RegTest and Bitcoin Core v22.0):

POST MyRpcUserName:MyRpcPw@localhost:18332/wallet/RegTestWallet2
Body: {"jsonrpc":"1.0","id":"rpc","method":"getbalance", "params":[]}

This same pattern applies for Wallet methods such as: getbalance gettransaction listreceivedbyaddress

I'm hoping to confirm that this is a known issue or perhaps a change in Bitcoin Core that requires updates on the client library? Happy to help add a PR for some extension methods if this is helpful. Thanks again

leandrobattochio commented 1 year ago

Seems like this lib is dead? Not worth using it ?