Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RPCs for external RandomX mining #997

Merged
merged 1 commit into from
Apr 21, 2022

Conversation

us77ipis
Copy link
Contributor

Problem

  • No external RandomX mining possible.
  • Mining multiple algorithms at the same time is currently not possible.
  • The algorithm getblocktemplate RPC uses for its blocks depends on the value the user selects for mining in the GUI of the wallet / in the config.

Root Cause

Not implemented yet.

Solution

The solution was to:

  1. Add an algo parameter to the getblocktemplate RPC which overrides any mining algorithm specified in the config / GUI.
  2. Add a new RPC rxrpcsb for submitting randomx blocks, analogous to pprpcsb.
    This makes it possible to mine at the same time progpow, randomx and sha256d externally, independently of what you may additionally mine using the wallet.

Bounty PR

?

Bounty Payment Address

sv1qqpjsrc60t60jhaywj5krmwla52ska70twc7wun6qnee65guxhvtxegpqwhuxypra4jn3pq86s24ryltcw6g2ss4573hyqac9u4g23m9mvxpyqqqwny49k

Unit Testing Results

Tested by mining at the same time progpow blocks with t-rex miner and randomx blocks with xmrig, where both found at least one block.

@codeofalltrades codeofalltrades added Component: RPC Related to the console commands themselves. Component: Miner Both PoW and PoS block creation Tag: Waiting For Code Review Waiting for code review from a core developer Algo: RandomX Bounty: Assigned This issue is being worked on by someone that will earn a bounty reward. labels Apr 17, 2022
@WetOne
Copy link
Collaborator

WetOne commented Apr 17, 2022

utACK 9974e54

Copy link
Collaborator

@codeofalltrades codeofalltrades left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 9974e54
NIT - Please remove commented out code.

@@ -901,7 +751,7 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
result.pushKV("proofoffullnodehash", pblock->hashPoFN.GetHex());
result.pushKV("mining_disabled", (!CheckConsecutivePoW(*pblock , pindexPrev))? true : false );

if (pblock->IsProgPow()) {
if constexpr (nPoWType == CBlockHeader::PROGPOW_BLOCK) { // if (pblock->IsProgPow()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented code.

@@ -919,10 +769,214 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
lastheader = pblock->GetProgPowHeaderHash().GetHex();
}
}
if constexpr (nPoWType == CBlockHeader::RANDOMX_BLOCK) { // if (pblock->IsRandomX()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented code.

@codeofalltrades codeofalltrades merged commit 7c8bee1 into Veil-Project:master Apr 21, 2022
@us77ipis
Copy link
Contributor Author

Now you merged it with the commented code still there?

@codeofalltrades
Copy link
Collaborator

Yes, I wanted to get it merged. I need to update the copyrights before the release. I will clean this up then if it hasn't been already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Algo: RandomX Bounty: Assigned This issue is being worked on by someone that will earn a bounty reward. Component: Miner Both PoW and PoS block creation Component: RPC Related to the console commands themselves. Tag: Waiting For Code Review Waiting for code review from a core developer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants