namecoin / namecoin-core

Namecoin full node + wallet based on the current Bitcoin Core codebase.
https://www.namecoin.org/
MIT License
455 stars 147 forks source link

Why does the mining pool change its address every time it mines a block? Does anyone know where this code is? #538

Closed msy2008 closed 2 months ago

msy2008 commented 2 months ago

Please describe the feature you'd like to see added.

Why does the mining pool change its address every time it mines a block? Does anyone know where this code is? I want to fix the mining receiving address of the mining pool or change the address after every 100 blocks mined.

Is your feature related to a problem, if so please describe it.

No response

Describe the solution you'd like

No response

Describe any alternatives you've considered

No response

Please leave any additional context

No response

domob1812 commented 2 months ago

I don't know for sure why that is, but presumably since address reuse is discouraged. The code is around https://github.com/namecoin/namecoin-core/blob/0cc09748308d768f9268fb22511fefea1573a61d/src/wallet/rpc/auxpow.cpp#L181 if you want to take a look.

Note that there are also non-wallet RPCs createauxblock and submitauxblock, where you can explicitly pass in the address you want (and that work without a wallet loaded).

Otherwise I think this is not really a valid "issue", but more a support request. I do not think anything should change with that code.

msy2008 commented 2 months ago

Thank you very much for your reply If I want the address to be reused 100 times, how should I write the code?

domob1812 commented 2 months ago

The best way would be to use the non-wallet RPCs and handle that in your external script calling the RPC interface.

Otherwise, the linked file has a helper class ReservedKeysForMining at the top, which handles how new addresses are generated. It should be somewhat straight-forward to change that class to keep one address for 100 accepted blocks, or whatever else logic you want.

msy2008 commented 2 months ago

The address can be reused 100 times or 1000 times before it is changed to another address without the need for me to set it up separately. The existing version of the code only uses the address once by default. . . I want to know where the code is

domob1812 commented 2 months ago

Yes I understand that, I pointed the code out to you. Github issues are not a way to provide support unfortunately, so I'll close this now, but with my last post, you should be able to modify the code accordingly.