Bitcoin Forum
November 11, 2024, 04:39:54 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: What in header can be changed  (Read 511 times)
coinscashout (OP)
Jr. Member
*
Offline Offline

Activity: 45
Merit: 4


View Profile
June 23, 2016, 12:08:22 PM
 #1

I've tried doing research on this and found bits and bobs but would like someone to give me a definitive answer please. Is this correct:

Version          - Can't be changed

Prev. Block     - Can't be changed * please see below

Merkle Root    - Can be changed according to amount of transactions and their hashes (I've seen trees of people trying to illustrate on how to
                      calculate this but fail to understand. Is it as simple as = hash(hash(Tx 1) + hash(Tx 2)) please see below **

Time             - Can be changed. 2 hours max + greater than median of past 11 blocks

Bits               - Not sure. Is this only adjusted every 2016 blocks and I have to keep to this value eg 3/21/13 8:09:35, 436434426

Nonce            - Can be changed. This is incremented + 1 to find correct nonce for block

* what determines that a certain set of transactions are allocated to a certain previous block (ie does this have to do with the coinbase transaction? What if there are 2 coinbase transaction in this)

T 1 = 7f3f451eb12a38d09f0d1c9064187bff0a6066f3b6cd01ee1f658110a2830b89 =   
        afc04b2992fe6cdd6024a0c5acb895f46c5fb9056e43ad8505e3e98e94b67dc7

T 2 = e82c735b579d93a07b64692e497487e25c59c944270ee473b0a7e36a0e0ec1e2 =
        0f01f48aff2d2c65787bb12f2d380555f5fa1c4106caa65b0b35aa5f651f805f

concatenate + hash = cd3ed269c34d6408fe96c4a70ba002962c9cf442e0cc194dc11c5795b3375446   Is this correct?

Thanks all
achow101
Staff
Legendary
*
Offline Offline

Activity: 3542
Merit: 6886


Just writing some code


View Profile WWW
June 23, 2016, 12:18:45 PM
 #2

I've tried doing research on this and found bits and bobs but would like someone to give me a definitive answer please. Is this correct:

Version          - Can't be changed

Prev. Block     - Can't be changed * please see below

Merkle Root    - Can be changed according to amount of transactions and their hashes (I've seen trees of people trying to illustrate on how to
                      calculate this but fail to understand. Is it as simple as = hash(hash(Tx 1) + hash(Tx 2)) please see below **

Time             - Can be changed. 2 hours max + greater than median of past 11 blocks

Bits               - Not sure. Is this only adjusted every 2016 blocks and I have to keep to this value eg 3/21/13 8:09:35, 436434426

Nonce            - Can be changed. This is incremented + 1 to find correct nonce for block
Yes that is correct. The bits can only change every 2016 blocks at the difficulty retarget.

The coinbase transaction can also have an extranonce which miners use to change the coinbase and thus the merkle root.

* what determines that a certain set of transactions are allocated to a certain previous block (ie does this have to do with the coinbase transaction? What if there are 2 coinbase transaction in this)
This doesn't entirely make sense.

A transaction can only be included in a block once. The miner must have analysed the full blockhain and determined what transactions are already included. Then the next block will be filled with transactions that have not been included. It has nothing to do with the coinbase.

There can only be one coinbase transaction and it just be the first transaction in a block.


T 1 = 7f3f451eb12a38d09f0d1c9064187bff0a6066f3b6cd01ee1f658110a2830b89 =   
        afc04b2992fe6cdd6024a0c5acb895f46c5fb9056e43ad8505e3e98e94b67dc7

T 2 = e82c735b579d93a07b64692e497487e25c59c944270ee473b0a7e36a0e0ec1e2 =
        0f01f48aff2d2c65787bb12f2d380555f5fa1c4106caa65b0b35aa5f651f805f

concatenate + hash = cd3ed269c34d6408fe96c4a70ba002962c9cf442e0cc194dc11c5795b3375446   Is this correct?

Thanks all
What are these hashes of?

coinscashout (OP)
Jr. Member
*
Offline Offline

Activity: 45
Merit: 4


View Profile
June 23, 2016, 12:35:26 PM
 #3

Thanks for the quick reply.

Quote
The coinbase transaction can also have an extranonce which miners use to change the coinbase and thus the merkle root.

This extranonce, is it a random number or is it defined by something else. All this time I thought extranonce meant nonce and once this has been exhausted we move onto updating the timestamp to current time and re-trying. Another thing was once 2 hours have maxed out on the time-stamp what happens then (or is it that once, 2 hours have gone then time-stamp is updated to current time)

Quote
This doesn't entirely make sense.

What I'm trying to ask is basically if we have 2 previous blocks A & B, what determines a certain transaction is allocated to previous block A and not previous block B.

Quote
What are these hashes of?

These are random Transaction I got from online to illustrate of how I think a merkle root is calculated. I have done - hash Transaction1 then hash Transaction2 then concatenate then hash again. Is this correct?
achow101
Staff
Legendary
*
Offline Offline

Activity: 3542
Merit: 6886


Just writing some code


View Profile WWW
June 23, 2016, 12:43:18 PM
 #4

Thanks for the quick reply.

Quote
The coinbase transaction can also have an extranonce which miners use to change the coinbase and thus the merkle root.

This extranonce, is it a random number or is it defined by something else. All this time I thought extranonce meant nonce and once this has been exhausted we move onto updating the timestamp to current time and re-trying. Another thing was once 2 hours have maxed out on the time-stamp what happens then (or is it that once, 2 hours have gone then time-stamp is updated to current time)
The extranonce is part of the coinbase scriptsig, where the miner can insert any data that they want. Usually the first for bytes of the scriptsig is used for the extranonce. It works in the exact same way as the nonce. Typically miners go through the set of nonces for each extranonce.

Quote
This doesn't entirely make sense.

What I'm trying to ask is basically if we have 2 previous blocks A & B, what determines a certain transaction is allocated to previous block A and not previous block B.
Nothing determines that. Transactions are not allocated to blocks. They are chosen from the mempool by the miner. Any transaction in the mempool is eligible to be included into any block. Once it is included, the transaction is removed from the mempool.


Quote
What are these hashes of?

These are random Transaction I got from online to illustrate of how I think a merkle root is calculated. I have done - hash Transaction1 then hash Transaction2 then concatenate then hash again. Is this correct?
That is correct. When constructing the merkle root, it is important that the initial hashes are in the same order that the transactions appear in the block.

coinscashout (OP)
Jr. Member
*
Offline Offline

Activity: 45
Merit: 4


View Profile
June 23, 2016, 01:48:44 PM
 #5

Thanks a lot, really helpful.

One last question. Is a extranonce calculated as such:

Hash(Coinbase)+Hash(Extranonce) Then added to Merkle root as such Hash(Transaction total), concatenate to Coinbases hash and then re-hashed?

Is there any way to manipulate the first part of a merkle root (using extranonce within coinbase) eg

ca6f05ee8d7db3038bef35ae795a2fd2431f8c278dae61820974a872bc1878f7
achow101
Staff
Legendary
*
Offline Offline

Activity: 3542
Merit: 6886


Just writing some code


View Profile WWW
June 23, 2016, 03:12:08 PM
 #6

Thanks a lot, really helpful.

One last question. Is a extranonce calculated as such:

Hash(Coinbase)+Hash(Extranonce) Then added to Merkle root as such Hash(Transaction total), concatenate to Coinbases hash and then re-hashed?

Is there any way to manipulate the first part of a merkle root (using extranonce within coinbase) eg

ca6f05ee8d7db3038bef35ae795a2fd2431f8c278dae61820974a872bc1878f7

No and no. The extranonce is just changing the data inside of a coinbase transaction. This changes the coinbase hash and thus the merkle root. The merkle root can only be manipulated by changing the transaction data.

coinscashout (OP)
Jr. Member
*
Offline Offline

Activity: 45
Merit: 4


View Profile
June 24, 2016, 09:38:41 AM
 #7

Thanks knightdk  Smiley
odolvlobo
Legendary
*
Offline Offline

Activity: 4494
Merit: 3412



View Profile
June 24, 2016, 03:50:46 PM
 #8

Have you read these?

https://en.bitcoin.it/wiki/Protocol_documentation
https://en.bitcoin.it/wiki/Block_hashing_algorithm
https://bitcoin.org/en/developer-reference#block-headers

Join an anti-signature campaign: Click ignore on the members of signature campaigns.
PGP Fingerprint: 6B6BC26599EC24EF7E29A405EAF050539D0B2925 Signing address: 13GAVJo8YaAuenj6keiEykwxWUZ7jMoSLt
coinscashout (OP)
Jr. Member
*
Offline Offline

Activity: 45
Merit: 4


View Profile
June 24, 2016, 04:25:13 PM
 #9

Quote
ave you read these?

yes, the last one is even in my favourites bar. But like I said I wanted to double-check and sometimes it is hard for someone like me to read and comprehend such technical info compared to asking a direct question on a forum like this which has a section for beginners with helpful members who are willing to help.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!