Skip to content
This repository was archived by the owner on Oct 30, 2024. It is now read-only.

HD wallet support [WIP]#3

Closed
axic wants to merge 4 commits intomasterfrom
feature/hdwallet
Closed

HD wallet support [WIP]#3
axic wants to merge 4 commits intomasterfrom
feature/hdwallet

Conversation

@axic
Copy link
Member

@axic axic commented Mar 22, 2016

HD wallet support based on bitcoinjs-lib. It has been imported and made to work with secp256k1-node. It would be better having the code shared between this and bitcoinjs-lib, but that might take a bit of work.

Tests also came from bitcoinjs-lib and they all pass (bar two which use a mock BigInteger test).

Edit: found in the pile of issues over at bitcoinjs-lib, that there's on going discussion about this at bitcoinjs/bitcoinjs-lib#508

@axic
Copy link
Member Author

axic commented Mar 22, 2016

@fanatid would you mind having a look at this?

There are a couple of things which could go into secp256k1:

  • check if a public key is compressed
  • more thorough validation (see below)
  • have the zero check and curve order check separately available
  • check if point (pubkey) is at infinity

For example this part I'm not sure secp256k1 does it?

// Verify that the X coordinate in the public point corresponds to a point on the curve.
// If not, the extended public key is invalid.
curve.validate(Q)

} else {
var publicKey = buffer.slice(45, 78)

secp256k1.publicKeyVerify(publicKey)
Copy link

Choose a reason for hiding this comment

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

You should throw error by yourself. publicKeyVerify return true/false

@fanatid
Copy link

fanatid commented Mar 23, 2016

@axic actions with secp256k1 looks good, except one nit.
You can check publicKeyVerify here: https://github.com/cryptocoinjs/secp256k1-node/blob/880a9ebb9e972f24803c1d86eaf851701c60ebd9/lib/js/ecpoint.js#L27

@axic
Copy link
Member Author

axic commented Mar 23, 2016

Thanks @fanatid, dropping this in the favour of #4

@axic axic closed this Mar 23, 2016
@axic axic deleted the feature/hdwallet branch March 23, 2016 13:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants