1

According to this site, in the coinbase input part, What is the coinbase script and where did it come from?

It is said that this is a arbitrary data, but I don't know how this string is generated?

Just below this section, in the example, the following string is reported: 062f503253482f0472d35454085fffedf2400000f90f54696d652026204865616c74682021

Thanks for any advice,

Best regards,

1

1 Answer 1

3

The miner chooses it, freely.

They can use it as an additional nonce (when the nonce is the block header overflows, the miner needs to switch to different transactions in the block to modify it further; the coinbase is an obvious place to make non-impactful, cheap, changes), or use it to publish messages.

In addition, BIP34 (active as a consensus rule since 2012) requires the coinbase scriptSig to start with the height of the block, in a particular encoding.

6
  • @ Pieter wuille. Thank you for answering me so quickly. When a new block is mined, miners can change the Merkel root, Nonce and time parameters to be able to mine the block. In order to change the Merkel root, we need to increase or decrease the transactions. You mean that in addition to these, the miner also has a long string at his disposal on coinbase, with which he can also change the Merkel root?
    – Ali
    Commented Mar 2, 2023 at 22:14
  • 2
    (it's named after Ralph Merkle, not Angela Merkel). Yes, it's yet another way to introduce variation to the block header, if timestamp and nonce don't suffice. Any change to the transaction set works (through the Merkle root), but having this otherwise ignored (apart from BIP34) field in the coinbase transaction is a convenient way of changing the Merkle root. Commented Mar 2, 2023 at 22:19
  • Thank you again for your reply. I think it is very strange that there are 72 hex digits (in other words, 36 bytes) freely in the Coinbase transaction and there is no law for it. This alone makes a (16^72 = 10^87) variation on block header. Is it possible to remove this part altogether or reduce its length?
    – Ali
    Commented Mar 2, 2023 at 22:44
  • 2
    The consensus rules only require it to be between 2 and 100 bytes (I have no idea why this rule exists, but it does), and that it has to start with a push of the height in little-endian encoding (BIP34). Commented Mar 2, 2023 at 22:51
  • 1
    Some speculation on coinbase input script limits in another question Commented Mar 3, 2023 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.