If I understand correctly block consists of:

  • block header,
  • transactions counter,
  • list of signed transactions.

Each signed transaction consists of transaction itself and appended signature.

Each transaction consists of:

  • transaction version no,
  • number of inputs,
  • inputs themselves,
  • number of outputs,
  • outputs themselves and
  • locktime.

Each input consists of:

  • Reference to its outputing transaction
  • index of output in that transaction
  • scriptSig

Each output consists of:

  • output value
  • scriptPubKey

Is this structure correct?

  • Where did you get 81 bytes from?
    – Claris
    Commented Nov 10, 2017 at 21:22
  • Found that figure on several places for example here: bitexperts.com/Question/Detail/3333/…, although 80 is more commonly shown. But here en.bitcoin.it/wiki/Block I find now there is more to the structure.
    – croraf
    Commented Nov 11, 2017 at 10:17
  • It’s 80 bytes, not 81. They’re calling the number of transactions part of the header (and assuming its one byte), which it’s not.
    – Claris
    Commented Nov 11, 2017 at 10:19
  • 2
    Right. It’s just part of the way it’s encoded though, that varint for the number of transactions isn’t included in any hash. It means you don’t know the size of the block until you’ve parsed every single transaction too.
    – Claris
    Commented Nov 11, 2017 at 10:22
  • 1
    Don't you know the size from the block size field chat.stackexchange.com/rooms/68577/…
    – croraf
    Commented Nov 11, 2017 at 10:33

1 Answer 1


I'd like to partially answer your question on the tx structure: in general you are right, here some more detail, and yes, you can have several TX_INs and TX_OUTs:

  TX_IN[0] OutPoint hash
  TX_IN[0] OutPoint index
  TX_IN[0] Script Length
  TX_IN[0] Script Sig
  TX_IN[0] Sequence      

  TX_OUT[0] Value/Amount in Satoshi
  TX_OUT[0] PK_Script Length
  TX_OUT[0] pk_script     

So in general the VERSION field at the very beginning and the LOCKTIME at the end is an additional piece. For sure you find further details in the developper section of bitcoin.org, and in Andreas' book "Mastering Bitcoin" (also online available). Avery good overview of the details was also provided here: http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.html I am not experienced enough to answer the part on the blocks, but it is also mentioned in the links.

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.