oliverw / miningcore

Miningcore is a high-performance Mining Pool Software for Linux and Windows.
https://store.miningcore.pro
MIT License
725 stars 666 forks source link

[I] [btc1] [Bitcoin Job Manager] Waiting for daemons to come online ... #42

Closed chestnyh closed 6 years ago

chestnyh commented 6 years ago

When I start dotnet "dotnet MiningCore.dll -c config.json, I get massage [I] [btc1] [Bitcoin Job Manager] Waiting for daemons to come online ....

But daemon is working. http://joxi.ru/GrqGg7ztNOYBk2.

build/config.json has RPC password. And I have access by curl to RPC.

How can I solve this problem?

Thanks!!!

chestnyh commented 6 years ago

I found where trouble is... Blockchain wallet dont have "./bitcoin-cli getinfo" command. And it will be removed from litecoin wallet(in 0.16 version).

I got message "deprecation-warning": WARNING: getinfo is deprecated and will be fully removed in 0.16. Projects should transition to using getblockchaininfo, getnetworkinfo, and getwalletinfo before upgrading to 0.16 in console.

I am not C# developer. I dont know how to fix it correctly (((

Konstantin35 commented 6 years ago

Hi I think you can understand yourself what you are looking for here https://github.com/coinfoundry/miningcore/blob/master/src/MiningCore/Blockchain/Bitcoin/BitcoinConstants.cs#L97

chestnyh commented 6 years ago

Yes. Constant is here. But bitcoin wallet don't have such command. As a result we have warning. And I don't know how to fix mining core correctly, because I am not C# developer. Maybe can someone help?

oliverw commented 6 years ago

I'm going to fix this in the next couple days. Thanks for bringing this to my attention.

chestnyh commented 6 years ago

Thanks to you.

sblanchard commented 6 years ago

Also having the same issue with Monero and tested Dash. Don't know if it's related, but fails on the same method. What should I change the constant to to get it working? Running in Windows x64 environment.

sblanchard commented 6 years ago

Seems like I have a different issue but it's stuck in the same loop

            while(!await AreDaemonsHealthy())
            {
                logger.Info(() => $"[{LogCat}] Waiting for daemons to come online ...");

                await Task.Delay(TimeSpan.FromSeconds(10));
            }

Catching the exception which is normally ignored in the Method ExecuteCmdAllAsync of DaemonClient I get the error:

{System.Net.Http.WinHttpException (0x80072EFD): A connection with the server could not be established
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Threading.Tasks.RendezvousAwaitable`1.GetResult()
   at System.Net.Http.WinHttpHandler.<StartRequest>d__105.MoveNext()}"

So the ports aren't listening, but I've tried other ports so there isn't a conflict. Not sure what to try next yet.

oliverw commented 6 years ago

@sblanchard Sorry for replying late. Did you realize that Monero requires two daemons? One for the blockchain and one for the wallet? (Example)

sblanchard commented 6 years ago

Hi Oliver,

Yes, I'm using the demo config this is my daemon section

}, "daemons": [ { "host": "127.0.0.1", "port": 18081, "user": "user", "password": "pass" }, { "host": "127.0.0.1", "port": 18082, "user": "user", "password": "pass", "category": "wallet" } ],

sblanchard commented 6 years ago

I've done a build on another machine Windows (Server 2012) rather than Windows 10, used the exact example config and it's still doing the same thing.

oliverw commented 6 years ago

What happens if you run this:

curl -u user:pass --digest --data-binary '{"jsonrpc": "2.0", "id":"1", "method": "get_info", "params": [] }' -H 'content-type: application/json' -X POST http://127.0.0.1:18081/json_rpc
curl -u user:pass --digest --data-binary '{"jsonrpc": "2.0", "id":"1", "method": "getaddress", "params": [] }' -H 'content-type: application/json' -X POST http://127.0.0.1:18082/json_rpc

If you need curl for windows look here: https://curl.haxx.se/download.html

sblanchard commented 6 years ago
curl: (6) Could not resolve host: 2.0,
curl: (7) Failed to connect to id port 1: Timed out
curl: (52) Empty reply from server
curl: (6) Could not resolve host: get_info,
curl: (52) Empty reply from server
curl: (3) [globbing] bad range specification in column 2
curl: (3) [globbing] unmatched close brace/bracket in column 1
curl: (52) Empty reply from server
curl: (7) Failed to connect to 127.0.0.1 port 18081: Connection refused
oliverw commented 6 years ago

That doesn't look right. It shouldn't try to resolve "2.0" as a hostname. Probably a problem with the Windows Command Line. I develop on Windows 10 but do most of my troubleshooting inside Windows 10's WSL (Windows Subsystem for Linux - or Bash for Windows). Unfortunately you don't have that on Windows Server.

Try this:

curl -u user:pass --digest --data-binary "{'jsonrpc': '2.0', 'id':'1', 'method': 'get_info', 'params': [] }" -H "content-type: application/json" -X POST http://127.0.0.1:18081/json_rpc
curl -u user:pass --digest --data-binary "{'jsonrpc': '2.0', 'id':'1', 'method': 'getaddress', 'params': [] }" -H "content-type: application/json" -X POST http://127.0.0.1:18082/json_rpc
sblanchard commented 6 years ago

This is a more straightforward answer:

curl: (7) Failed to connect to 127.0.0.1 port 18081: Connection refused.

It's strange, I was going to ask about your dev environment and what the current checked in code does if you run it with an example config in debug in Win10. My dev pc which I tried it on first is Windows 10. I'm not sure what the sequence of events are supposed to be be as the code is a bit much to wrap my brain around at once, but the StartListeners method does not get called.

oliverw commented 6 years ago

The listeners are not supposed to get started until the pool made sure that he's got a daemon to talk to. Imagine the listeners would be started, miners connect and the pool had to respond with "sorry guys, I don't have anything to work for you" 😄

Anyway, if curl is unable to connect to the daemons, the pool won't be either. We first need to figure out why the daemons are not reachable. How to do run them?

sblanchard commented 6 years ago

The API on port 4000 is up and connecting, so it's not an issue across all ports with the assembly. hmm

oliverw commented 6 years ago

I think you are confusing something here.

As soon as the curl statements I've posted above return something you'll be in business.

sblanchard commented 6 years ago

Yeah just checking that it's not a general networking stack issue. I take it you can't replicate this issue on windows? Because I've managed to do it on two different machines with the current code on here?

oliverw commented 6 years ago

I usually have to juggle with a lot of different coin daemons. To make that bearable at all I normally run them inside docker containers. But just last weekend I had to test something that required monerod and monerowalletd to run directly on Windows which worked without problems.

oliverw commented 6 years ago

What's the output you get when running monerod?

sblanchard commented 6 years ago

Hmm. Ok I can connect to the daemons now with curl. Outputs { "error": { "code": -32700, "message": "Parse error" }, "id": 0, "jsonrpc": "" }

Both output: You are now synchronized with the network. You may now start monero-wallet-cli.

And on curl

2017-11-08 14:50:26.779 [RPC1]  ERROR   net.http        contrib/epee/include/storages/portable_storage_from_json.h:98   Wrong JSON character at: 'jsonrpc': '2.0', 'id':'1', 'method': 'get_info', 'params': [] }
2017-11-08 14:50:26.793 [RPC1]  ERROR   net.http        contrib/epee/include/storages/portable_storage_from_json.h:368  Failed to parse json, what: Wrong JSON character at: 'jsonrpc': '2.0', 'id':'1', 'method': 'get_info', 'params': [] }
sblanchard commented 6 years ago

If i put the wrong username/password in the config file then Minecore outputs

2017-11-08 14:55:04.1289] [E] [xmr1] [Monero Job Manager] Daemon reports invalid credentials]
sblanchard commented 6 years ago

Fails on Wallet server "Method not found"

oliverw commented 6 years ago

That's to be expected. Just put in the correct ones. Does the pool start now?

oliverw commented 6 years ago

Post the pool config with stripped out credentials.

sblanchard commented 6 years ago

It's the exact default config at the moment that I just recopied a few minutes ago.

{
    "logging": {
        "level": "trace",
        "enableConsoleLog": true,
        "enableConsoleColors": true,
        "logFile": "",
        "logBaseDirectory": "",
        "perPoolLogFile": false
    },
    "banning": {
        "manager": "integrated"
    },
    "notifications": {
        "enabled": false,
        "email": {
            "host": "smtp.example.com",
            "port": 587,
            "user": "",
            "password": "password",
            "fromAddress": "info@yourpool.org",
            "fromName": "support"
        },
        "admin": {
            "enabled": false,
            "emailAddress": "user@example.com",
            "notifyBlockFound": true
        }
    },
    "persistence": {
        "postgres": {
            "host": "127.0.0.1",
            "port": 5432,
            "user": "miningcore",
            "password": "",
            "database": "miningcore"
        }
    },
    "devDonation": 0.2,
    "paymentProcessing": {
        "enabled": true,
        "interval": 600,
        "shareRecoveryFile": "recovered-shares.txt"
    },
    "pools": [{
      "id": "xmr1",
      "enabled": true,
      "coin": {
        "type": "XMR"
      },
      "address": "",
      "rewardRecipients": [
        {
          "type": "op",
          "address": "",
          "percentage": 1
        }
      ],
      "blockRefreshInterval": 1000,
      "jobRebroadcastTimeout": 55,
      "clientConnectionTimeout": 600,
      "banning": {
        "enabled": true,
        "time": 600,
        "invalidPercent": 50,
        "checkThreshold": 50
      },
      "ports": {
        "3032": {
          "listenAddress": "127.0.0.1",
          "difficulty": 7500,
          "name": "CPU Mining",
          "varDiff": {
            "minDiff": 1000,
            "maxDiff": null,
            "targetTime": 15,
            "retargetTime": 90,
            "variancePercent": 30
          }
        },
        "3033": {
          "listenAddress": "127.0.0.1",
          "difficulty": 25000,
          "name": "GPU Mining",
          "varDiff": {
            "minDiff": 10000,
            "maxDiff": null,
            "targetTime": 15,
            "retargetTime": 90,
            "variancePercent": 30
          }
        },
        "3034": {
          "listenAddress": "127.0.0.1",
          "difficulty": 200000,
          "name": "High-End Multi GPU Mining",
          "varDiff": {
            "minDiff": 200000,
            "maxDiff": null,
            "targetTime": 15,
            "retargetTime": 120,
            "variancePercent": 30
          }
        }
      },
      "daemons": [
        {
          "host": "127.0.0.1",
          "port": 18081,
           "user": "user",
          "password": "pass"
       },
        {
          "host": "127.0.0.1",
          "port": 18082,
          "user": "user",
          "password": "pass",
          "category": "wallet"
        }
      ],
      "paymentProcessing": {
        "enabled": true,
        "minimumPayment": 0.25,
        "minimumPaymentToPaymentId": 1.0,
        "payoutScheme": "PPLNS",
        "payoutSchemeConfig": {
          "factor": 2.0
        }
      }
    }]
}
sblanchard commented 6 years ago

Am I missing a command line param for the second wallet instance of monerod because it doesn't recognize the json command? The first daemon instance is fine?

oliverw commented 6 years ago

The second daemon instance must be "monero-wallet-rpc", not "monerod". But how could you knew that if it isn't mentioned anywhere. We simply need much better docs.

sblanchard commented 6 years ago

Thanks for that, sorry for wasting your time on this.

oliverw commented 6 years ago

No I've wasted yours.

oliverw commented 6 years ago

@sblanchard Did you get it working?