OK - another question about inputs and outputs.
Say I have a wallet with 2 BTC in it, which is made up of 50inputs of 0.04BTC each. I want to send 1BTC to another wallet - am I right that this will be made up of 25 inputs, and the transaction size will be 25 x 200bytes = 5000 ?
Yes, if every unspent output in your wallet was exactly 0.04 BTC, then a transaction to send 1 BTC would be
at least 25 inputs. Depending on the wallet program used to create the transaction there might be a preference programmed in to create "change". This improves privacy a bit. If a transaction only has a single output, then it becomes immediately obvious what address is being paid and how much is being sent. If an address has 2 outputs, then it isn't as easy for someone to tell which is the "change" and which is the "payment". If the wallet has a preference programmed in to create "change", then it might actually use something like 28 inputs, and create a second output for 0.12 BTC.
A transaction size is made up of more than just inputs, and inputs are typically more like 180 bytes each.
For the sake of the math, lets assume that your wallet creates a transaction with exactly 25 inputs and 1 output, here's the structure of such a transaction:
4 byte version number
1 byte input quantity
Then for each input:
32 byte transactionID
4 byte index
1 byte scriptSig length
1 byte signature length
variable length signature (perhaps typically approximately 72 bytes?)
1 byte public key length
65 byte public key
4 byte sequence number
(That's 108 bytes plus the signature per input, figure a typical input at 180 bytes)
Then:
Then for each output:
8 byte output value
1 byte script length
1 byte OP_DUP script code
1 byte OP_HASH160 script code
1 byte code to push 20 bytes onto the script processing stack
20 byte bitcoin address to pay to
1 byte OP_EQUALVERIFY script code
1 byte OP_CHECKSIG script code
(That's 34 bytes per output)
So depending on the length of the signatures in your example transaction, it should be around:
4 + 1 + (180 X 25) + 1 + (34 X 1) = 4,540 bytes