Skip to content

[Feature Request] Modification of Mining Module #1969

@gzelda

Description

@gzelda

Is your feature request related to a problem? Please describe.

Right now the official code for a Stacks 2.0 node does not readily expose information/data/API that is both necessary and desired by STX Miners. This extensively limits the operations an individual miner can easily execute, as well as the ability for third parties to provide STX Mining solutions that make it easy for anyone to participate. The two biggest issues are described in detail below:

The operating mechanism of existing nodes is to read configuration information from the configuration file of .toml, such as whether to mine, miner address, etc. This method of statically reading files limits the operations related to mining. For example, starting and stopping mining are currently controlled by opening and closing the node program, and the node controller cannot change the behavior during the node operation. (For example, only normal node status at the beginning of the node, and then perform mining operation later).

Specifically, the two missing features that are of highest priority are:

    1. A Stacks node can start or stop mining at any time while it is running. When mining is stopped, the node is just running as a normal node, synchronizing network progress.
    1. The node can change the mining-related parameters (e.g. amount of BTC) at any time while it is running.

Describe the solution you'd like

Daemon Technologies has, up until now, been modifying the official Stacks Blockchain code in order to facilitate the above. These changes, however, are unofficial/not part of master, and therefore need to be redone every time Blockstack PBC changes the official code. Given that the changes we propose will be necessary, and large value add for any and all STX Miners, in addition to data that will be important for other products such as the Explorer, Daemon Technologies would like to propose working with Blockstack PBC to merge a solution to the issues described above to the master/official Stacks Blockchain code.

The initial solution Daemon Technologies is proposing to the issues above is as follows:
Since the pre-run check and runtime state changes of existing nodes are both in run_loop, the following points need to be adjusted at this stage:

    1. For the first issue, we are looking at Ethereum as a good example of how running a node and mining can interact. Refer to Geth, firstly initialize the miner-related component instance in run_loop module (for example, develop a package called miner responsible for mining-related processing), and then wait for the call of the miner instance related method (Here I want to design Miner-related RPC to achieve), then miner.start() miner.stop() and the method of configuring miner related parameters (miner btc private key) can be realized through RPC method.
    1. Regarding the issue of dynamically modifying the mining-related parameters (the amount of BTC), we cannot refer to other frameworks, because this is a unique mechanism of Blockstack, the time interval for stacks-blockchain to select a new leader (the same amount as the Bitcoin network block generation Level) is long enough for users to operate, so in this process we want to modify some member variables in the miner class, mentioned above, through the RPC method (the number of bitcoins burned at this stage is a fixed value, written in a variable called burn_fee_cap , Please see link for details, so that you can modify the number of burned BTC to participate in the next round of elections.

Describe alternatives you've considered

If Blockstack PBC is not willing to work with Daemon Technologies to merge these features to master at this stage(maybe because of time/energy/priority), Daemon plans to continue it's development, but with a delayed timeline. If these features are not offered in the official Stacks chain code, Daemon will need to take more time to develop and release the STX Mining bot. If these changes are merged to master and officially offered, we believe we can release a fully usable version of the mining bot by mainnet launch. If not, we anticipate the official release of the mining bot occuring 1-2 months post mainnet launch.

Additional context

Metadata

Metadata

Assignees

Labels

enhancementIterations on existing features or infrastructure.featureBrand new functionality. New pages, workflows, endpoints, etc.locked

Type

No type

Projects

Status

Status: 🆕 New

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions