CGminer can’t connect over RPC on 0.20.0 #19182

issue Relaxo143 openend this issue on June 5, 2020
  1. Relaxo143 commented at 9:26 pm on June 5, 2020: none
    After upgrading to 0.20.0 cgminer throws the following error: Pool 0 JSON failed to decode GBT I’m assuming there are some additional rpc settings for the .conf file which I need to specify as of 0.20.0, but I don’t know which. I downgraded to 0.19.1 and it’s working fine. Any help would be appreciated. `
  2. maflcko commented at 0:05 am on June 6, 2020: member
    Could be related to e42c959c1dccf91d1e4bb20a502a3e4590ad279b
  3. maflcko commented at 0:11 am on June 6, 2020: member
    nvm 0328dcdcfcb56dc8918697716d7686be048ad0b3 is in 0.19, so that shouldn’t be the problem. ping @luke-jr
  4. jnewbery commented at 2:39 pm on July 27, 2020: contributor
    There’s a message in bitcoin talk that this is due to the coinbaseaux flags field being removed: https://bitcointalk.org/index.php?topic=5253096.msg54839526#msg54839526
  5. jnewbery commented at 2:49 pm on July 27, 2020: contributor

    I’m not very familiar with ckpool but it looks like that’s the problem: https://bitbucket.org/ckolivas/ckpool/src/b8f66852483542326de8c5705a3e36242347ad12/src/bitcoin.c#lines-147

    If I’m right, that’s a bug in ckpool. It shouldn’t be failing on absence of the coinbaseaux flag, since that’s not a required field in the gbt response: https://github.com/bitcoin/bips/blob/master/bip-0022.mediawiki#block-template-request. @jameshilliard does that look right to you?

  6. luke-jr commented at 3:32 pm on July 27, 2020: member
    Agree with @jnewbery’s assessment.
  7. Beeskee commented at 7:57 am on October 30, 2020: none
    This happens with solo mining too. Also happens on 20.1
  8. asbourlotos commented at 10:35 pm on December 29, 2020: none
    I’m new to solo mining but I’m noticing the same after full node sync and cgminer config. Anyone find a workaround to the GBT decode issue?
  9. luke-jr commented at 10:38 pm on December 29, 2020: member
    If you need a workaround, you should be able to use BFGMiner as a stratum proxy for cgminer.
  10. Relaxo143 commented at 0:14 am on December 30, 2020: none

    If you need a workaround, you should be able to use BFGMiner as a stratum proxy for cgminer.

    Could you provide more detailed instructions?

  11. luke-jr commented at 0:35 am on December 30, 2020: member

    bfgminer --stratum-port 3334

    To validate your setup on testnet, also pass -o 'localhost:18332/#getcbaddr' -O rpcuser:rpcpass

  12. sipa commented at 0:37 am on December 30, 2020: member
    Any reason we can’t just include "coinbaseaux" : {"flags" : ""} in our GBT response?
  13. luke-jr commented at 0:52 am on December 30, 2020: member
    @sipa that would probably work, but seems ugly just to deal with third-party unmaintained and broken code… Core doesn’t even try to remain reasonably compatible with Knots, so why unreasonably for cgminer?
  14. sipa commented at 0:53 am on December 30, 2020: member
    If it’s unmaintained then I withdraw my suggestion.
  15. Relaxo143 commented at 1:37 am on December 30, 2020: none
    We definitely need a maintained alternative for desktop miners. Even if usb asics do not make any profit, it’s still a good learning experience and people use them.
  16. Relaxo143 commented at 1:39 am on December 30, 2020: none

    bfgminer --stratum-port 3334

    To validate your setup on testnet, also pass -o 'localhost:18332/#getcbaddr' -O rpcuser:rpcpass

    Ok that’s for bfg. What do I do with cgminer after that?

  17. luke-jr commented at 1:47 am on December 30, 2020: member

    Point it at localhost:3334

    (But if it’s a USB stick miner, you can probably just use BFGMiner by itself…)

  18. jameshilliard commented at 2:59 am on December 30, 2020: contributor

    @jameshilliard does that look right to you?

    Yeah, looks right.

    We definitely need a maintained alternative for desktop miners.

    Last I checked Con Kolivas seemed open to transferring the cgminer project if a suitable organization was interested in maintaining cgminer.

  19. asbourlotos commented at 9:48 pm on December 30, 2020: none
    I just dropped BTC core 0.19 (latest before 0.20) on top of the new files to revert installation and keep block info and now it’s working. Solo mining on valid address :) with cgminer and no stratum port. Not that I’ll ever solve a block but maybe I’ll start learning the space and make/update a miner?
  20. Beeskee commented at 7:04 am on January 18, 2021: none
    I’ve tried using bfgminer but it reports the pool is down or invalid, using the same server settings that I use for cgminer. I’ll keep checking into this, I was using cgminer since it was updated for my device. If anyone has any suggestions, I’d appreciate them.
  21. luke-jr commented at 3:10 pm on January 18, 2021: member
    Did you include #getcbaddr in the URI?
  22. Beeskee commented at 3:17 pm on January 18, 2021: none

    Yes, I tried it both with and without.

    bfgminer -o ‘http://127.0.0.1:8332/#getcbaddr’ -u User -p Password –generate-to 394zcJWJfDwQPYxJ18u5fWaJkVwx76D8KP –stratum-port 3334

  23. luke-jr commented at 3:23 pm on January 18, 2021: member

    Add -T -D -P to see protocol dumps, might give a clue as to what’s going on

    Is the node synced?

  24. Beeskee commented at 3:33 pm on January 18, 2021: none

    Yes the node is synced.

    I see multiple errors in that log:

    [2021-01-18 08:30:22] Stratum connect failed with TLS to pool 0: gnutls_handshake() failed: An unexpected TLS packet was received.

    [2021-01-18 08:30:22] JSON decode failed(1): ‘[’ or ‘{’ expected near ‘HTTP’

    [2021-01-18 08:30:22] Pool 0: gnutls_handshake() failed: An unexpected TLS packet was received.

    [2021-01-18 08:30:22] Pool 0: RECV: HTTP/1.1 400 Bad Request [2021-01-18 08:30:22] JSON decode failed(1): ‘[’ or ‘{’ expected near ‘HTTP’

    [2021-01-18 08:30:22] FAILED to retrieve work from pool 0 http://127.0.0.1:8332/#getcbaddr [2021-01-18 08:30:22] Pool 0 slow/down or URL or credentials invalid [2021-01-18 08:30:22] No servers were found that could be used to get work from.

  25. asbourlotos commented at 4:11 pm on January 18, 2021: none
    @Beeskee Im not sure if this would have helped bfgminer but try downgrading your Bitcoin core to v0.19.1 and configuring cgminer again. I’ve been solo mining on 8 newpac miners @500MHz (907.5GH/s avg) for a couple weeks now with only one reboot for core disconnect. Two more incoming :) I know odds are crap but I told myself to build a 1TH unit and leave it for the lotto! Good luck!
  26. Beeskee commented at 4:13 pm on January 18, 2021: none
    Yes, I downgraded Bitcoin in the meantime to continue using cgminer directly, but I don’t like the idea of being stuck on a prior version with no way to upgrade.
  27. asbourlotos commented at 4:15 pm on January 18, 2021: none
    Gotcha. I thought about this as well. If you do get bfgminer working on newest core ver. Reach out to me. I might want to follow along.
  28. luke-jr commented at 4:18 pm on January 18, 2021: member
    bitcoin-cli getblocktemplate '{"rules":["segwit"]}'
  29. Zwilla commented at 7:50 am on January 19, 2021: none

    after starting ckpool, on fresh install of bitcoind and ready synced with txindex=1 I got this lines on bitcoind, and ckpool tries and tries this :

    [2021-01-19 08:47:53.442] CRITICAL: No bitcoinds active! [2021-01-19 08:47:55.446] JSON failed to decode GBT 0000000000000000000048840346957d513da4037b325689baa97f5acecabd90 0000000000000000000da8a10000000000000000000000000000000000000000 536870912 1611042475 170da8a1 (null) with errno 11: Resource temporarily unavailable [2021-01-19 08:47:58.711] JSON failed to decode GBT 0000000000000000000048840346957d513da4037b325689baa97f5acecabd90 0000000000000000000da8a10000000000000000000000000000000000000000 536870912 1611042478 170da8a1 (null) with errno 11: Resource temporarily unavailable [2021-01-19 08:47:58.716] CRITICAL: No bitcoinds active! [2021-01-19 08:48:00.523] JSON failed to decode GBT 0000000000000000000048840346957d513da4037b325689baa97f5acecabd90 0000000000000000000da8a10000000000000000000000000000000000000000 536870912 1611042480 170da8a1 (null) with errno 11: Resource temporarily unavailable [2021-01-19 08:48:04.022] JSON failed to decode GBT 0000000000000000000048840346957d513da4037b325689baa97f5acecabd90 0000000000000000000da8a10000000000000000000000000000000000000000 536870912 1611042483 170da8a1 (null) with errno 11: Resource temporarily unavailable [2021-01-19 08:48:04.026] CRITICAL: No bitcoinds active!

    BITCOIND 2021-01-19T07:43:40Z CreateNewBlock(): block weight: 3992781 txs: 3647 fees: 107078831 sigops 21180 2021-01-19T07:43:46Z CreateNewBlock(): block weight: 3992635 txs: 3647 fees: 107107389 sigops 21165 2021-01-19T07:43:52Z CreateNewBlock(): block weight: 3992582 txs: 3634 fees: 107157062 sigops 21149 2021-01-19T07:43:58Z CreateNewBlock(): block weight: 3992810 txs: 3635 fees: 107215306 sigops 21139 2021-01-19T07:44:05Z CreateNewBlock(): block weight: 3992685 txs: 3641 fees: 107256027 sigops 21091 2021-01-19T07:44:14Z CreateNewBlock(): block weight: 3992486 txs: 3650 fees: 107379829 sigops 20965 2021-01-19T07:44:19Z CreateNewBlock(): block weight: 3992559 txs: 3651 fees: 107393032 sigops 20973 2021-01-19T07:44:25Z CreateNewBlock(): block weight: 3992485 txs: 3648 fees: 107537358 sigops 20948 2021-01-19T07:44:35Z CreateNewBlock(): block weight: 3992815 txs: 3646 fees: 107587114 sigops 20957 2021-01-19T07:44:45Z CreateNewBlock(): block weight: 3992548 txs: 3634 fees: 107653973 sigops 20996 2021-01-19T07:44:51Z CreateNewBlock(): block weight: 3992658 txs: 3631 fees: 107734503 sigops 21002 2021-01-19T07:45:00Z CreateNewBlock(): block weight: 3992667 txs: 3633 fees: 107768766 sigops 20999 2021-01-19T07:45:07Z CreateNewBlock(): block weight: 3992750 txs: 3636 fees: 107792206 sigops 20988

  30. mshalabi1990 commented at 8:09 am on January 19, 2021: none
    Did your lotto work
  31. asbourlotos commented at 3:17 pm on January 19, 2021: none
    @mshalabi1990 I haven’t found a block yet (though I wouldn’t tell anyone if I did ;) ) but my highest share has been 537m. That’s a long way from 20.6t.
  32. Joz3d commented at 8:28 am on February 27, 2021: none
    Sucks. I also solo mine with newpacs and cg. Finally was upgrading node from 19.1 to 21.0 tonight and wasted last 2h troubleshooting this. Downgrading…
  33. luke-jr commented at 4:01 pm on February 27, 2021: member
    @Joz3d Why downgrade the node rather than upgrade the miner?
  34. Joz3d commented at 5:56 am on February 28, 2021: none
    @luke-jr Downgraded to previous version bitcoind as the quickest solution to get up and running again. You’re right, the miner needs to be upgraded but getting author to update that/forking if need-be is an unexpected effort. Oh well, will work on it.
  35. shinjukumiku commented at 0:22 am on January 17, 2022: none

    @Zwilla Check attached patch.

     0From 915d0c399a450a1af024acfc9e8e4f86e20eaa94 Mon Sep 17 00:00:00 2001
     1From: Miku <miku@example.com>
     2Date: Sun, 16 Jan 2022 08:14:10 +0000
     3Subject: [PATCH] Fix handling GBT with no flags in coinbaseaux
     4
     5bitcoind >=0.20.0's GBT reply no longer includes a flags string
     6in the coinbaseaux object. It was an empty string in 0.19.1.
     7
     80.19.1: "coinbaseaux":{"flags":""}
     922.0  : "coinbaseaux":{}
    10
    11If flags is not in coinbaseaux of the GBT response, we
    12allocate an empty string for flags to prevent segfault.
    13flags needs to be dynamically allocated because it will be freed.
    14
    15A more robust future fix is to remove dependence on the coinbaseaux
    16object in the GBT response as it isn't required per BIP 0022.
    17
    18Fix has been verified to find several testnet blocks with bitcoind 22.0,
    19the latest version as of writing.
    20---
    21 src/bitcoin.c | 9 ++++++++-
    22 1 file changed, 8 insertions(+), 1 deletion(-)
    23
    24diff --git a/src/bitcoin.c b/src/bitcoin.c
    25index b114fd06..88ed1bb1 100644
    26--- a/src/bitcoin.c
    27+++ b/src/bitcoin.c
    28@@ -147,7 +147,14 @@ bool gen_gbtbase(connsock_t *cs, gbtbase_t *gbt)
    29 	coinbase_aux = json_object_get(res_val, "coinbaseaux");
    30 	flags = json_string_value(json_object_get(coinbase_aux, "flags"));
    31 
    32-	if (unlikely(!previousblockhash || !target || !version || !curtime || !bits || !coinbase_aux || !flags)) {
    33+	/* bitcoind >= 0.20.0 GBT respose coinbaseaux has no flags */
    34+	/* 2022-01-16 [#19182](/bitcoin-bitcoin/19182/) */
    35+	if(!flags) {
    36+		/* LOGDEBUG("No flags in coinbaseaux of GBT JSON"); */
    37+		flags = calloc(1, 1);
    38+	}
    39+
    40+	if (unlikely(!previousblockhash || !target || !version || !curtime || !bits || !coinbase_aux)) {
    41 		LOGERR("JSON failed to decode GBT %s %s %d %d %s %s", previousblockhash, target, version, curtime, bits, flags);
    42 		goto out;
    43 	}
    44-- 
    452.20.1
    
  36. cmmodtools commented at 11:49 am on June 16, 2022: none
  37. maflcko added the label Upstream on Jun 16, 2022
  38. maflcko added the label Mining on Jun 16, 2022
  39. maflcko commented at 12:14 pm on June 16, 2022: member

    Can this be closed, given that this is an upstream issue?

    Let me know if it should be reopened.

  40. maflcko closed this on Jun 16, 2022

  41. koga73 commented at 4:53 am on February 28, 2023: none
    @Zwilla I ran into the same issue with ckpool v0.9.5 + bitcoind v22.0.0. I was able to get ckpool working by commenting out references to “coinbase_aux” in ckpool src/bitcoin.c as well as setting the “flags” variable to an empty string.
  42. bitcoin locked this on Feb 28, 2024

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-21 09:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me