bitcoinjs / bitcoinjs-message

MIT License
124 stars 76 forks source link

Add sign/verify for SegWit P2SH addresses #6

Closed dcousens closed 5 years ago

dcousens commented 6 years ago

For TREZOR we implemented a way how to Sign and Verify SegWit P2SH addresses. This is achieved by introducing extra v values used during signing.

Currently the following are used:

  • 27-30 uncompressed pubkey (base58)
  • 31-34 compressed pubkey (base58)

We added the following:

  • 35-38 p2sh segwit pubkey (base58)
  • 39-42 segwit pubkey (bech32)

Unit tests for reference

Reference https://github.com/bitcoinjs/bitcoinjs-lib/issues/880

dabura667 commented 6 years ago

is there a BIP that explains the original signature methodology???

I'm guessing not.

dcousens commented 6 years ago

@dabura667 I don't think so

prusnak commented 6 years ago

There was not a BIP describing the original method, so I did not create a BIP for new values. It would be nice to have one, though.

EvilJordan commented 6 years ago

Does this mean that the current release of bitcoinjs-message does or does not handle the signing/verifying of segwit addresses?

dcousens commented 6 years ago

@EvilJordan it does not handle it, as it [as of yet] doesn't have community consensus. PR's welcome though :+1:

prusnak commented 5 years ago

Reason?

dcousens commented 5 years ago

@prusnak I don't have time to implement the feature. Happy to re-open if you or someone else intends to :+1:

prusnak commented 5 years ago

Fair enough :)