I wanted to make a graphic again so I can better illustrate it but this forum doesn't allow me to.
I'll list down what I undestand to be the exact steps, based on what all your replies in the thread tell me...
Step 1 - activate mining hardware
Step 2 - start mining software
Step 3 - software connects to port 8332 or any available port; listen for active nodes
Step 4 - connect to active node
Step 5 - download new updated blockchain ledger
Step 6 - fetch miner's wallet
Step 7 - add reward to miner's wallet
Step 8 - Get the 1MB head of the blockchain ledger
Step 9 - Begin mining
Step 10 - Is hash below target?
> if no, return to step 9
> if yes, go to step 11
Step 11 - broadcast the new block
Step 12 - Do you wish to continue mining?
> if no, return to step 8
> if yes, go to step 13
If there are any mistakes, just tell me...
By the way, I'm puzzled as to where the following lines go to in the steps I listed (from mocacinno's reply):
Building an utxo set and filling your mempool with unconfirmed transactions
=>
Receive a new block, update your utxo db and mempool
=>
Select the top 1Mb (not countig witness data) transactions from your mempool and create a block. Add the coinbase transaction funding your own address with the current block reward + fees from the selected transactions (fee = sum of the value of all the inputs minus the sum of the value of all the outputs)
=>
create the block header (including the hash of the previous's block header, the root of the merkle tree of all tx's selected in the previous step, the nonce and some extra data)
=>
Iterate over the nonce untill you find a block header whose sha256d hash is under the current target OR untill a new valid block is received by your node (if you receive a new valid block, go back to the second step of this list)
A secondary loop should continue receiving broadcasted transactions to keep filling your mempool