|
January 12, 2021, 04:05:41 PM |
|
You don't need it. Think about the future! If your coin will reach some level of adoption, then not everyone will be a miner. And then you will need to remove it again from your code. Assuming that not all users are mining is a good thing and should be kept as is. Unless you are trying to create a coin where always everyone will be able to mine it, no matter what. But that puts difficulty into question, so maybe I shouldn't dig deeper into details of such construction here.
So, if you want to solo mine, the easiest way is just creating a pool and attaching only your miner into it. Then, if you want to add more miners, you always can do it in a simple way (and you will do it anyway to test what will happen where there will be more than one miner in your network or if someone will try to make a pool on your coin). Using getblocktemplate, parsing it and producing blocks based on that is the way to go. If you are mining alone and built-in miner is sufficient, then generatetoaddress can be used (but you have to make sure that you are restarting it in case of new block coming in).
Usually, performance of the build-in miner is poor. Also, updating your client each time to only update built-in miner can be tedious. More than that: if you want to compare performance of many different mining algorithms, then you have to make many different versions instead of having just one full node and connecting all miners into it.
So yes, you can bring back generating into your client, but expect many problems with that setup.
|