How to find out CPU usage in the mining process?

+1 vote
Hello, i am now in a study/research about using multichain for IoT, and i need to know how to know the CPU usage ( maybe in percentage or anything) while mining process happened

because IoT device have a limit in resource and my focus is the relation of changing the value of mining-diversity with the CPU usage and mining time

Actually I have tried it using Python, by recording the usage of CPU using psutil library while always checking the confirmation field If the value is 0, it has not yet been mined (as explained in https://www.multichain.com/qa/11525/how-do-transactions-work-in-a-data-stream)

so if the value isn't 0, then it has been mined and the recording process will stop.

but i don't think that is the right way to do it, I would appreciate if there is a more appropriate way to do it

 

many thanks.
asked Oct 3 by dimasyr
edited Oct 3 by dimasyr

1 Answer

0 votes
 
Best answer

Assuming you have a permissioned blockchain and are using mining diversity rather than proof of work as a consensus mechanism, the mining CPU load will be very low. This is because there is no computational challenge in creating blocks, it's just a matter of the right signature from the right miner.

If you want to make mining load an absolute minimum, set pow-minimum-bits=1 in your blockchain parameters. This is the absolute minimum difficulty. And of course be sure to leave target-adjust-freq=-1 so that this difficulty never changes.

answered Oct 4 by MultiChain
selected Oct 9 by dimasyr
yes, it is true that i'm using permissioned blockchain with mining diversity instead of pow

so, if i want to use pow, what should i do? so there will be a computational challenge

and then, is " multichain pow" the same as that used by bitcoin? that is, a node (with mining permissions maybe) that has successfully solved the problem first who validated the block?

and maybe for the last, what should i do with "target-adjust-freq" so the difficulty of PoW will be change?

many thanks again
If you use MultiChain with proof-of-work, it is indeed the same scheme as bitcoin. FYI this means that a bitcoin miner can easily attack your network, if they want to, unless you also use mining permissions.

You can set target-adjust-freq to any time you want, in seconds, and that will be the approximate number of seconds after which the difficulty will adjust, each time. Approximate because it is actually changed every (target-adjust-freq/target-block-time) blocks.
Oh, i see

Ok, thanks for the very clear explanation :)
...