Skip to content

Conversation

@dcousens
Copy link
Contributor

Chained on #180, but not dependent.

This pull request centers mostly around adding support for alternative strMessageMagic constants which often vary between alt-coin implementations.

The implemented list of constants can be seen here.

It should be noted that the length has been included at the front of these constants as inline hex constants \x18, this is to save on adding the generic variable integer code that would be needed to do it.

Also, for all signature data, I've opted towards base64, as that is easily verifiable against bitcoin-qt.

Comparison link: https://github.com/dcousens/bitcoinjs-lib/compare/eckey1...mesnet

@dcousens
Copy link
Contributor Author

Fixes the last (known) missing feature in relation to #84.

@sidazhang
Copy link
Contributor

LGTM +1
ACK

@ralphtheninja
Copy link

+1 awesome!

@kyledrake
Copy link
Contributor

+1, will merge after I get one more ACK on #179.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not related to this particular PR, it occurs to me that ecdsa maybe not be the best place to host parseSigCompact because

  1. It is not used else where other than message sig verification. And I don't know how useful it is to expose it as a publicly accessible API.
  2. Sitting side by side with parseSig it is just confusing.

Maybe consider moving it into message.js and make it a internal function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its a valid concern, but I'm not sure where to put it. I settled with the status-quo after trying to figure out where to put ecdsa.serializeSigCompact.
I don't mind, but it should be noted it is a custom format specifically for Bitcoin.

dcousens added 6 commits May 18, 2014 17:50
The use of fixtures allows for more behavioural driven tests and simpler addition of more test cases in future. However, as ECPubKey is just a wrapper around other strenuously tested modules, the test data is currently limited to testing a subset of the total wrapper. This should probably be done better by using mocked out modules instead.
An ECKey is a composition of a private key (D), a public key (Q) and its compression flag. These functions gave the impression of serialization of this composition, when really they only serialized `D`. They have therefore been removed in favour of always using a sane serialization format (WIF) that matches the needed behaviour. If a user needs the previous functionality, simply use `privKey.D.*` instead of `privKey.*`, as BigInteger supports `*Buffer/*Hex` functions as expected.
The signature verifications here are unnecessary, as this is not what is under test.
weilu added a commit that referenced this pull request May 18, 2014
Message signing and altcoins
@weilu weilu merged commit aafbe46 into bitcoinjs:master May 18, 2014
@dcousens dcousens deleted the mesnet branch May 28, 2014 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants