Please help me understand the logic behind mining a bitcoin from scratch. I want to create a bitcoin miner, it will not receive any blocks from any pools. All should be done inside the miner.
So, I have made some progress, I've coded with vb.net and successfully got a result of a hash (old example)
Prev. Block 00000000000000000A2940884E0C3BC96510CAD11912A527E9D15DF42F0E1D67
Merkle Root 2E99F445C007A9158207CC30CEBAD2B3D26C45FDAB2EBDF50D261335FC00D92C
Time 12/16/14 18:05:40
Block Hash 000000000000000015A8D88216918C8DE090268A5E7F53FEEF72CD111F7F27FF
So, suppose old example is a real one, so, I want to know where do I include my bitcoin wallet address if I want to get the block reward to my wallet address? Should I have hashed the wallet address with the above and hash with the wallet and come up with a hash which is less than the target? Or after getting a good hash, just send data to blockchain with the wallet address to receive the block reward? or should I create some other hash with my wallet address? what should I do to include my wallet address in this?
pseudo code would also be nice If you can provide for me to understand how to include my wallet address.
my pseudo code upto now
version -> convert to hex
Prev. Block -> convert to hex
Merkle Root -> convert to hex
Time -> get unix time and convert to hex
Bits -> convert to hex
Nonce -> convert to hex
Add hex values of all the above and then hash it with Double SHA256 to receive the hash value.
Check if the final hash value is less than the target
**step 4?** what should I do with the above hash? where should I include my wallet address?