Remove the builtin CPU miner #466

pull muggenhor wants to merge 3 commits into bitcoin:master from muggenhor:remove-cpu-miner changing 7 files +9 −303
  1. muggenhor commented at 9:01 AM on August 12, 2011: contributor

    Considering that CPU mining is hardly worth the time anymore, especially when solo mining, the internal CPU miner has become next to worthless. As such, remove it to reduce the amount of code that can contain bugs.

    If you still want to solo mine using your CPU you can use the RPC "getwork" interface with Jeff Garzik's RPC CPU miner: https://github.com/jgarzik/cpuminer

    Signed-off-by: Giel van Schijndel me@mortis.eu

  2. muggenhor commented at 9:04 AM on August 12, 2011: contributor

    PS Currently I only turn the RPC calls "getgenerate" and "setgenerate" into no-ops, should they maybe be removed instead?

  3. sipa commented at 9:07 AM on August 12, 2011: member

    There was a large discussion some time ago about this, split between people wanting to remove all mining code, and people who wanted to keep as much as possible. Eventually a middle ground was chosen: remove the SSE-optimized and assembly code, but keep a simple miner as reference. Maybe this should be reconsidered, but i suppose it will require some discussion first. I'm in favor of removing myself.

  4. muggenhor commented at 9:38 AM on August 12, 2011: contributor

    If a reference implementation is the goal then IMO it should be implemented as a seperate program using the RPC "getwork" interface.

    I would argue that Jeff Garzik's RPC CPU miner (the one I mentioned before) is good enough to serve as a reference implementation. Heck the code's a lot cleaner than what's currently inside bitcoin itself.

    Furthermore a good reference implementation would IMO contain only the bare essentials to illustrate the algorithm, and those expressed as simply as possible. Which would be something like a Python script containing only the "getwork" call to get work, a loop over all nonces to search for the correct one, followed by a "getwork" call when the target's matched.

    Such an implementation however, would perform so poorly that no one would use it, and as a result it wouldn't be tested, making it likely to have bugs. Which is roughly the same for the builtin miner; i.e. only people who don't know or care what they're doing still use it.

  5. davout commented at 11:10 AM on August 12, 2011: none

    +1 for removing the built-in miner, there are a couple of example implementations in the wild already.

  6. gavinandresen commented at 4:11 PM on August 12, 2011: contributor

    I'd be ok with a version of this patch that completely removes the mining code but adds a reference miner (in contrib/ ). Either Jeff's or a pure-Python-no-dependencies one.

    Also: setgenerate's help text should be changed like you changed getgenerate and both methods should be marked deprecated.

  7. sipa commented at 4:13 PM on August 12, 2011: member

    Agree with Gavin.

  8. muggenhor commented at 8:11 PM on August 12, 2011: contributor

    I properly marked both RPC functions as deprecated in their help text.

    As for adding a reference miner, I don't think adding Jeff's to this repo is the way to go, at the most it should be moved to the github 'bitcoin' project. That being said, I can probably whip up a pessimistic (i.e. no single readability compromise for performance) Python miner for contrib/ (probably by the end of next week).

  9. alexwaters commented at 12:30 PM on August 29, 2011: contributor

    "PS Currently I only turn the RPC calls "getgenerate" and "setgenerate" into no-ops, should they maybe be removed instead?"

    +1 to them being removed - and +1 for NOT including a reference miner.

  10. jgarzik commented at 4:24 PM on August 31, 2011: contributor

    A reference python miner has long existed: https://github.com/jgarzik/pyminer

  11. jgarzik commented at 4:29 PM on August 31, 2011: contributor

    I went ahead and added my python miner to bitcoin/contrib/pyminer/

  12. jgarzik commented at 4:31 PM on August 31, 2011: contributor

    IMO, let's go ahead and remove the *generate RPCs.

    Rationale:

    • I doubt this will create serious breakage
    • Anybody who mines does not use this anyway
    • It occasionally creates confusion for newbie pool server operators ("setgenerate is false, does that mean getwork is turned off?")
  13. TheBlueMatt commented at 6:48 PM on August 31, 2011: member

    I agree, no-ops just confuse everyone. Also, is there anyone left who is actually against removing all of this?

  14. jgarzik commented at 9:16 PM on August 31, 2011: contributor

    I would personally -prefer- that the Satoshi Reference Miner remain, but if everyone else wants to remove it, it sounds like I'm outvoted...

  15. TheBlueMatt commented at 10:35 PM on August 31, 2011: member

    you can still get the satoshi reference miner - its in git history ;)

  16. muggenhor commented at 12:34 PM on September 4, 2011: contributor

    I've rebased the branch against master to make it easy to merge in.

  17. laanwj commented at 1:16 AM on October 1, 2011: member

    This would also mean that we can get rid of some ugly platform-specific functions in util.h/cpp which will be no longer used:

    • SetThreadPriority
    • AffinityBugWorkaround

    And some general functions only used by the miner:

    • alignup
  18. Remove the builtin CPU miner
    Considering that CPU mining is hardly worth the time anymore, especially
    when solo mining, the internal CPU miner has become next to worthless.
    As such, remove it to reduce the amount of code that can contain bugs.
    
    If you still want to solo mine using your CPU you can use the RPC
    "getwork" interface with Jeff Garzik's RPC CPU miner:
    https://github.com/jgarzik/cpuminer
    
    Signed-off-by: Giel van Schijndel <me@mortis.eu>
    12c9ee06ea
  19. Deprecate [sg]etgenerate
    Signed-off-by: Giel van Schijndel <me@mortis.eu>
    7b720ac176
  20. Remove now unused functions alignup and AffinityBugWorkaround
    Signed-off-by: Giel van Schijndel <me@mortis.eu>
    e58d58fabc
  21. gavinandresen commented at 2:43 PM on October 5, 2011: contributor

    I use the built-in miner quite a lot to test with testnet-in-a-box. I think we should leave it in for now.

  22. gavinandresen closed this on Oct 5, 2011

  23. TheBlueMatt commented at 3:04 PM on October 5, 2011: member

    I still disagree with leaving it in, you can just as easily mine with cpuminer on testnet-in-a-box (in fact, it would be faster) and the codebase is just generally such a mess, removing unused and unnecessary features like satoshi miner should happen ASAP.

  24. zathras-crypto referenced this in commit 5e396c0ab0 on May 9, 2017
  25. lateminer referenced this in commit 665c91d093 on Oct 16, 2019
  26. DrahtBot locked this on Sep 8, 2021

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: 2026-04-22 06:16 UTC

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