I understand that bitcoin clients originally allowed users to run their own node and mine. This was back when mining was mainly GPU-based.
When was the mining functionality removed from Bitcoin Core?
Arguably, never: Bitcoin Core still has a rudimentary mining function built-in, as it is used for testing purposes (on testing networks where the difficulty is lower). CPU mining has however been entirely pointless since GPU mining became ubiquitous, around the end of 2010. Since then, features and optimizations related to CPU mining have been removed from, and moved out of, Bitcoin Core.
There have roughly 5 different ways to interact with the mining functionality:
setgenerate
RPC. This RPC was added on 2010 Feb 23, and removed on 2016 Mar 14.generate
and generatetoaddress
, which don't run in the background, but just run a relatively small number of POW operations, and return the constructed blocks through RPC. The purposes is testing, and using these on mainnet will almost certainly just fail to construct anything. The generate
RPC call was introduced on 2015 Apr 9, and while that specific RPC doesn't exist anymore, more recent incarnations of it like generatetoaddress
still exist in the codebase today.getwork
RPC protocol allows mining in an external process was introduced on 2010 Nov 23, and removed on 2014 Jun 21, as it was superseded by getblocktemplate
.getblocktemplate
(BIP22) RPC protocol was added on 2012 May 12, still exists in the codebase today, and is the primary way through which mining pools interact with the Bitcoin network.After 2010, various optimizations for faster CPU mining that existed in the codebase have also been gradually removed, as they were irrelevant for mining for test purposes, and added a maintenance burden.
The mainnet mining capability was removed in 0.13.0, The release note is dated 23 August 2016
https://bitcoin.org/en/release/v0.13.0#removal-of-internal-miner
Removal of internal miner
As CPU mining has been useless for a long time, the internal miner has been removed in this release, and replaced with a simpler implementation for the test framework.
The overall result of this is that
setgenerate
RPC call has been removed, as well as the-gen
and-genproclimit
command-line options.For testing, the
generate
call can still be used to mine a block, and a new RPC callgeneratetoaddress
has been added to mine to a specific address. This works with wallet disabled.