So for example we know that a transaction contains:
- a certain number of inputs
- a cetrain number of outputs
Correct.
- a locking scrpit (scriptPubKey)
No.
Not
A locking script.
Each output has its own locking script to lock THAT output, so if you have multiple outputs then you have multiple locking scripts.
More importantly, EACH output
IS two things: a locking script, and the amount of satoshis being locked.
That's it. That's the entire output.
- an unlocking script (scriptSig)
No.
Not
AN unlocking script.
Each input has its own unlocking script to unlock THAT input, so if you have multiple inputs then you have multiple unlocking scripts.
More importantly, EACH input
IS three things: a reference to a previously unspent output, and the unlocking script that allows you to spend that previous output, a sequence number.
That's it. That's the entire input.
... and other elements.
There are about 10 bytes of "other elements".
- A 4 byte version number
- 1 or more bytes indicating the quantity of inputs
- 1 or more bytes indicating the quantity of outputs
- A 4 byte locktime
Unless you have significantly more than a hundred inputs or significantly more than a hundred outputs, the number of inputs and outputs will not need more than 1 byte each.