1

I have installed Bitcoin Core on my laptop.

Now open bitcoin daemon and do following:

First i run getbestblockhash to get the last block hash on the Blockchain. We call this hash as BestBlockHash.

After that i run: getblock BestBlockHash 0

The daemon return huge continues hex string data, which is consist of block header and block body(which is the transactions data)

Now my question!

Is this exactly the input of the submitblock function? (which the miner who mine this block, entered this)

My purpose in asking this question is to know exactly what the input of the submitblock function looks like.

Thanks in advance,

2
  • 1
    I would suspect that this is the case, but if I wanted to verify this, I would call bitcoin-cli help submitblock. I assume that one should then see a help text that points towards BIP22.
    – Murch
    Mar 2, 2023 at 22:37
  • Tanks for your reply, yeawh actually i have tried all these ways, But I am still confused that what is the submitblock input parameters exactly.
    – Ali
    Mar 2, 2023 at 22:54

1 Answer 1

2

The input to submitblock is a full serialized block, encoded in hexadecimal.

Block serialization consists of:

  • The block header (80 bytes)
  • A CompactSize encoding of the number of transactions
  • The transactions, one by one, concatenated one after the other.
2
  • Sorry for my stupid question. But what do you mean by serialized block? Did you mean raw block in binary format? (What you actually mean encoded hexadecimal means that convert this binary data to hexadecimal)
    – Ali
    Mar 4, 2023 at 21:57
  • 1
    Yes, all of that. I think of transactions and blocks as abstract data structures (collections of information with amounts and scripts, not bytes). The protocol defines a specific way of converting these data structures to binary data, a process known as serialization (and deserialization). Mar 4, 2023 at 22:04

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.