aionnetwork / aion_miner

aion miner
57 stars 25 forks source link

Solo pool release only listens on IPv6, not IPv4 #32

Open ghost opened 6 years ago

ghost commented 6 years ago

My pool is running (only listening on IPv6 and computer has IPv6 disabled) Miner cannot connect

./aionminer -t 4 -l 127.0.0.1:3333 -d 0
            Equihash<210,9> CPU&GPU Miner for AION v0.2.1
            Base on NiceHash equihash miner.
Setting log level to 0
Using SSE2: YES
Using AVX: YES
Using AVX2: YES
stratum | Starting miner
miner#1 | Starting thread #1 (CPU-TROMP-SSE2) 
stratum | Connecting to stratum server 127.0.0.1:3333
miner#3 | Starting thread #3 (CPU-TROMP-SSE2) 
miner#0 | Starting thread #0 (CPU-TROMP-SSE2) 
miner#2 | Starting thread #2 (CPU-TROMP-SSE2) 
stratum | Connected!
stratum | Sending: {"id":1,"method":"mining.subscribe","params":["nheqminer/0.2.1", null,"127.0.0.1","3333"]}

stratum | read_until: Connection reset by peer
stratum | Reconnecting in 3 seconds...
stratum | Connecting to stratum server 127.0.0.1:3333
stratum | Connected!
stratum | Sending: {"id":1,"method":"mining.subscribe","params":["nheqminer/0.2.1", null,"127.0.0.1","3333"]}

(etc infinite loop) The pool is only listening on ipv6. This is all the stuff listening on 3333 (only IPv6)

tcp6       0      0 :::3333                 :::*                    LISTEN      985/node

But I've disabled IPv6 on my computer.

The README says to check config/config.xml but there is no config.xml file anywhere in the solo pool dir (I have searched) my config.json looks like this

{
    "logLevel": "debug",

    "logColors": true,

    "__cliPort": "blocknotify messages are sent to NOMP through this",
    "cliPort": 17117,

    "clustering": {
        "enabled": false,
        "forks": "auto"
    },

    "__defaultPoolConfigs": "pool config file will inherit these default values if they are not set",
    "defaultPoolConfigs": {

        "__blockRefreshInterval": "Poll RPC daemons for new blocks every this many milliseconds.",
        "blockRefreshInterval": 1000,

        "__jobRebroadcastTimeout": "If no new blocks are available for this many seconds update and rebroadcast job.",
        "jobRebroadcastTimeout": 55,

        "__connectionTimeout": "Disconnect workers that haven't submitted shares for this many seconds.",
        "connectionTimeout": 600,

        "__emitInvalidBlockHashes": "(For MPOS mode) Store the block hashes for shares that aren't block candidates.",
        "emitInvalidBlockHashes": false,

        "__validateWorkerUsername": "This option will only authenticate miners using an address or mining key.",
        "validateWorkerUsername": true,

        "_tcpProxyProtocol": "",
        "tcpProxyProtocol": false,

        "_hasSubmitMethod": "",
        "hasSubmitMethod": true,

        "banning": {
            "enabled": true,
            "time": 600,
            "invalidPercent": 50,
            "checkThreshold": 500,
            "purgeInterval": 300
        },
        "redis": {
            "host": "127.0.0.1",
            "port": 6379
        }
    },
    "website": {
        "enabled": true,
        "host": "0.0.0.0",
        "port": 8080,
        "stratumHost": "localhost",
        "stats": {
            "updateInterval": 60,
            "historicalRetention": 43200,
            "hashrateWindow": 300
        },
        "adminCenter": {
            "enabled": false,
            "password": "password"
        }
    },
    "redis": {
        "host": "127.0.0.1",
        "port": 6379
    },
    "switching": {
        "switch0": {
            "enabled": true,
            "algorithm": "equihash",
            "ports": {
                "3333": {
                    "diff": 10,
                    "varDiff": {
                        "minDiff": 16,
                        "maxDiff": 512,
                        "targetTime": 15,
                        "retargetTime": 90,
                        "variancePercent": 30
                    }
                }
            }
        }
    },
    "profitSwitch": {
        "enabled": false,
        "updateInterval": 600,
        "depth": 0.90,
        "usePoloniex": true,
        "useCryptsy": true,
        "useMintpal": true,
        "useBittrex": true
    }
}

I see the 3333 port there, but I don't see anywhere to change the host that it listens on, because I want to make it listen on IPv4.

I tried to post this on discord #beta_testnet but the bot removed my permission to write messages because it thought this is spam. First it said I must make it shorter than 2000 chars, but then it kept rejecting it just saying "spam" so I kept shortening it and retrying it. After about 2-3 retries it auto banned me. Can you please unban me?

When I look at the source of cliListener I see it's listening on 127.0.0.1, which should make it listen on IPv4... https://github.com/aionnetwork/aion_miner/blob/master/aion_solo_pool/libs/cliListener.js#L38

ghost commented 6 years ago

I forked aion_solo_pool and fixed poolWorker.js so that it listens on IPv4. https://github.com/lope/aion_miner/commit/3531f9cbebeb218f3a1d9eeb44465bc928df9c87

But now the solo pool crashes.

TypeError: Cannot read property 'handleNewClient' of undefined
    at Server.<anonymous> (/foo/aion/solo pool/libs/poolWorker.js:279:66)
    at emitOne (events.js:116:13)
    at Server.emit (events.js:211:7)
    at Object.onconnection (net.js:1561:8)
    at onconnection (internal/cluster/child.js:168:12)
    at Worker.onmessage (internal/cluster/child.js:43:7)
    at process.onInternalMessage (internal/cluster/utils.js:42:8)
    at emitTwo (events.js:131:20)
    at process.emit (events.js:214:7)
    at emit (internal/child_process.js:772:12)
aion-Ross commented 6 years ago

Do you have the aion kernel running with the stratum API open in the config file? When the pool isnt able to connect to the kernel you will usually see those type of errors.

ghost commented 6 years ago

Hi Ross,

Thanks for your reply. I wasn't sure about the order of things, but now I've got the kernel running and it's busy syncing. After that I'll try connect the pool to it and then the miner. If I want to CPU mine on the same machine as where the kernel is, should I use the internal miner, or the CPU miner? Once I've got the pool running, I'll try running a miner on another computer and will connect it to my pool.

aion-Ross commented 6 years ago

You could probably use either the internal miner or the CPU miner, they have pretty similar performance. I might lean towards the CPU miner though, the kernel can get pretty busy when processing transactions, running externally you might be able to reduce the load a bit.

If you plan on connecting a miner on another machine you will probably need to revert your change on the pool. If you bind the listening port to 127.0.0.1 outside computers will not be able to connect. The pool should be listening on ipv4 by default but if it still gives you trouble you could try binding to 0.0.0.0; that should allow outside connections.

ghost commented 6 years ago

Thanks Ross, you superstar!

On Fri, 20 Apr 2018, 04:47 aion-Ross, notifications@github.com wrote:

You could probably use either the internal miner or the CPU miner, they have pretty similar performance. I might lean towards the CPU miner though, the kernel can get pretty busy when processing transactions, running externally you might be able to reduce the load a bit.

If you plan on connecting a miner on another machine you will probably need to revert your change on the pool. If you bind the listening port to 127.0.0.1 outside computers will not be able to connect. The pool should be listening on ipv4 by default but if it still gives you trouble you could try binding to 0.0.0.0; that should allow outside connections.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/aionnetwork/aion_miner/issues/32#issuecomment-382952691, or mute the thread https://github.com/notifications/unsubscribe-auth/ACxTy-LfZ1G5S3GpZrURu10ynisBQJCGks5tqUxSgaJpZM4Tctxd .