Search code examples
asp.net-core-webapibitcoinlib

Getting BitcoinLib Error = "One or more required parameters, as defined in CoinParameters, were not found in the configuration file!"


I'm using BitcoinLib in my ASP.NET Core (v2) Web Api project. However, whenever I try to instantiate the service:

        var bitcoinService = new BitcoinLib.Services.Coins.Bitcoin
                .BitcoinService(appSettings.BitcoinSettings.ServerUrl,
                                appSettings.BitcoinSettings.Username,
                                appSettings.BitcoinSettings.Password,
                                appSettings.BitcoinSettings.WalletPassword);

I get the error:

One or more required parameters, as defined in CoinParameters, were not found in the configuration file!

I verified that the values that are being passed in are not null and correct, I've even added the settings to my web.config:

<configuration>
  <appSettings>
    <add key="RpcRequestTimeoutInSeconds" value="60" />

    <add key="Bitcoin_DaemonUrl" value="http://localhost:18332" />
    <add key="Bitcoin_DaemonUrl_Testnet" value="http://localhost:18332" />
    <add key="Bitcoin_WalletPassword" value="X" />
    <add key="Bitcoin_RpcUsername" value="X" />
    <add key="Bitcoin_RpcPassword" value="X" />
  </appSettings>
...

Nothing works... do I need to fork this thing and remove that IgnoreConfigFiles check or am I doing something wrong here?


Solution

  • The exception showing was a misdirection... the actual problem was with rpcRequestTimeoutInSeconds. The library needs to have an overload like this:

    BitcoinService(string daemonUrl, string rpcUsername, string rpcPassword, string walletPassword, short rpcRequestTimeoutInSeconds)
    

    It looks like the NuGet package is missing it? As I can see it in the code...

    More info here: https://github.com/GeorgeKimionis/BitcoinLib/issues/42

    I did create a .NET Core compatible one here: https://github.com/SaganMarketing/BitcoinLib

    You can get a package here: https://www.myget.org/feed/saganmarketing/package/nuget/BitcoinLib