Author

Topic: Question about finding a block (Read 207 times)

sr. member
Activity: 629
Merit: 258
January 01, 2019, 11:58:48 PM
#6
Thank you to all who replied.  Smiley
hero member
Activity: 1194
Merit: 573
OGRaccoon
December 31, 2018, 10:44:18 AM
#5
This might be of some use to you it's a Mining Simulation.

http://yogh.io/#mine:last

https://github.com/yogh-io/bitcoin-transaction-explorer

You have your basic Block headers

Code:
Block headers
Version: 536870912
Prev block: 0000000000000000002B4317ED9B09E5D629E9763E727E895E296418D69F2C70
Merkle root: AA5FB4AFB0154D2BDD3315E074F219351FDF13908F1C515E07BE12124A3D3760
Timestamp December 31, 2018, 14:07:48 +0000
Bits: 17371EF4
Nonce: 21

Raw headers in hex
Code:
00000020702C9FD61864295E897E723E76E929D6E5099BED17432B000000000000000000AA5FB4AFB0154D2BDD3315E074F219351FDF13908F1C515E07BE12124A3D3760B4222A5CF41E371715000000

Coinbase transaction
Code:
01000000010000000000000000000000000000000000000000000000000000000000000000FFFFFFFF0487654321FFFFFFFF0100F90295000000001976A914DC863734A218BFE83EF770EE9D41A27F824A6E5688AC00000000

Computed block hash
Code:
CB78229F85ABD927B71954CB65905F5AC9F12DBC512D2FE9CD6C7580AA814C62000000000000000000371EF4FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

Now lets say we move the Nonce to 22

The new computed value for Block Hash would become
Code:
77F6BF7C376A4346BD28FFAB917E2B1327B8CFD77F70B986A6421FC06A21CF56

Now lets break down the Raw header in Hex

Code:

00000020702C9FD61864295E897E723E76E929D6E5099BED17432B000000000000000000AA5FB4AFB0154D2BDD3315E074F219351FDF13908F1C515E07BE12124A3D3760B4222A5CF41E371715000000

00000020 = Block Version Number

702C9FD61864295E897E723E76E929D6E5099BED17432B000000000000000000 = Previous Block Hash

AA5FB4AFB0154D2BDD3315E074F219351FDF13908F1C515E07BE12124A3D3760 = Merkel Root

B4222A5C = Time Stamp

F41E3717 = Bits Value Diff target

15000000 = Nonce

Each time the hash changes until the block hash is equal to or below this number in order to be valid.

000000000000000000371EF4FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF














legendary
Activity: 2324
Merit: 6006
bitcoindata.science
December 31, 2018, 05:44:17 AM
#4
Not sure i understand this but would be grateful if someone could help.

This is what I understand.

1.Finding a block means guessing a number.


Kind of, but not exactly.

Miners do not find a block.
To create a new block, they need to solve a cryptographic algorithm called Proof of Work.

PoW can only be solved by finding a number that when combined with block data and hashed generates another number that is smaller to the target (determined by PoW).

When a miner finds that number, a new block is created , not found.
legendary
Activity: 1583
Merit: 1276
Heisenberg Design Services
December 31, 2018, 01:52:37 AM
#3
1.Finding a block means guessing a number.
Yes, true. In order for a miner to find a block he needs to do a trial and error method by inputting various nounce values and the resulting hash should be less than the current target. If the hash is higher than the target, he need to change the nounce and try again until he reaches the desired hash. Once he has found the hash he found the block.

2.That number involves showing that the transaction involves the right keys and then ..putting it through some meth equation?  Is that right?
No. The transactions are struck in the mempool. These transactions are already validated by a bitcoin node and added to the pool of unconfirmed transactions. Once the miner finds a block, he picks up these transactions from the mempool (probably the tx with fees) and adds them to the block he is gonna mine. Along with a list of transactions included in the block, he adds a block header he has computed and a coinbase transaction which is the first transaction of any block that pays the miner.

What I wonder is ...is the miner constantly guessing numbers based on whatever transaction he intends to add to his block?
And so the transaction variable of the guessing is constantly changing?
I guess you have misread everything about how mining works and how transactions are validated! Miners constantly try to find a block by using up different nounce values. There is nothing to do with transactions and blocks.

So the miner is moment by moment is solving for a different pool of transactions?
Whoa, NO! Please read Mining and Consensus : Mastering Bitcoin to get a complete insight of how Mining works.

EDIT : Oops, achow already answered... Typing in mobile is one of the hardest jobs  Tongue
staff
Activity: 3374
Merit: 6530
Just writing some code
December 31, 2018, 01:35:35 AM
#2
Not sure i understand this but would be grateful if someone could help.

This is what I understand.

1.Finding a block means guessing a number.
Kind of.

2.That number involves showing that the transaction involves the right keys and then ..putting it through some meth equation?  Is that right?
No. Miners do not prove that transactions are correct, that's not their job. The process of mining has nothing to do with showing transactions are correct or have correct keys. However a miner will want to still verify transactions are valid (their proof of correctness is contained within the transaction and is produced by their creators, not the miner) so that the block they produce is also valid. A valid block has more than just a valid proof of work, it's contents must also be valid.

What miners do is try to find a block which hashes to less than a target value (you can view this as the hash beginning with some number of 0's). The way that they do this is to increment a value called a nonce. It is just a number which is part of the data that is hashed. So miners are trying to guess a nonce which results in a block hash that has some number of zeroes in front of it. It's a bit more complicated than that, but that's a basic understanding of what miners do to "solve a math problem" (it's not really a math problem).
sr. member
Activity: 629
Merit: 258
December 31, 2018, 12:45:27 AM
#1
Not sure i understand this but would be grateful if someone could help.

This is what I understand.

1.Finding a block means guessing a number.
2.That number involves showing that the transaction involves the right keys and then ..putting it through some meth equation?  Is that right?

What I wonder is ...is the miner constantly guessing numbers based on whatever transaction he intends to add to his block?

And so the transaction variable of the guessing is constantly changing?

So the miner is moment by moment is solving for a different pool of transactions?

Jump to: