Since we only need the sorting for creating the scriptPubKey, 
wouldn't it make the most sense to sort it by the way it represented in that context?


On Thu, Jan 15, 2015 at 2:03 PM, Wladimir <laanwj@gmail.com> wrote:
On Thu, Jan 15, 2015 at 1:17 AM, Matt Whitlock <bip@mattwhitlock.name> wrote:
> On Wednesday, 14 January 2015, at 3:53 pm, Eric Lombrozo wrote:
>> Internally, pubkeys are DER-encoded integers.
>
> I thought pubkeys were represented as raw integers (i.e., they're embedded in Script as a push operation whose payload is the raw bytes of the big-endian representation of the integer). As far as I know, DER encoding is only used for signatures. Am I mistaken?

OP_CHECKSIG (and OP_CHECKSIGVERIFY) takes a DER-encoded pubkey and a
DER-encoded signature on the stack.

Possibly you're confused with OP_HASH160 <hash160> OP_EQUALVERIFY as
used in outputs, which compares the 160-bit hash of the pubkey against
the given hash (usually taken from a bitcoin address).

It doesn't help understanding to consider either as integers. They are
binary blob objects with either a fixed format (DER) or a fixed size
(hashes).

Wladimir



--
BlockTrail B.V.
Barbara Strozzilaan 201
1083HN Amsterdam
The Netherlands

Phone: +31 (0)612227277

BlockTrail B.V. Is registered with the Dutch Chamber of Commerce in Amsterdam with registration No.:60262060 and VAT No.:NL853833035B01