|
May 12, 2016, 12:00:51 PM |
|
OP is confusing two different serialization artifacts.
Outputs look like this: [fixed 64bit integer][output script]
When writing a parser, your software needs to know how long the output script section is, so the length comes before it. That way the system knows when it has finished, or if there was a problem. Assuming it's a valid transaction, the network knows the 64bit integer is actually the number of satoshis, and second part is the output script.
The contents of output script are expressed as Bitcoin Script. This involves different length serialization, one involving PUSHDATA opcodes.
As OP saw, inside the output script, there's a public key with 0x41 (=65) as a length. If we start to use larger pieces of data, this would look like: PUSHDATA1 0xff [256 byte long input] PUSHDATA2 0xffff [65535 byte long input]
You don't have to explicitly declare the pushdata opcodes for short length, but for multi-byte length encoding, you use PUSHDATA1/2/4.
|