4
4
I'm trying to write a script that constructs a serialized bitcoin transaction from scratch.
But when it comes to the number of inputs, the field is a variable length integer.
It's typically only 1 byte (2 characters) in length and you do not have to do anything with it, because bitcoin transactions rarely have more than 0xFE (253) inputs.
But what happens when there are more than 253 inputs and the size of the field has to increase to accommodate it?
How would you put a count of 256 inputs in to this field?
https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer
Thanks. So all values above 0xFD are little-endian? Also, would decimal(65536) be FE 00 00 01? – inersha – 2015-09-09T09:17:13.593
no. (FE 00 00 01 00) because FE is prefix for 32-bit low-endian – amaclin – 2015-09-11T19:24:43.110