greenaddress / WalletCrx

GreenAddress open source client
https://greenaddress.it/
GNU Lesser General Public License v2.1
79 stars 39 forks source link

BTChip backward compatibility broken #17

Closed antonio-fr closed 8 years ago

antonio-fr commented 8 years ago

Version before 0.77 inits or at least checks btchip with compressed keys. As stated in previous bug report, BTCHip can no longer be init with v0.77, So I can't tel you for sure if the BTChip init w v0.77 is done with compressed or uncompressed keys.

On v0.77, the software checks whether keys are compressed

But with a BTChip initialized on v0.76, that gives this error TypeError: BIP32 only allows compressed keyPairs

Even with commenting this compressed key ckeck (L3736 in bitcoinjs_min.js) , that leads to error later : var msg = Bitcoin.CryptoJS.enc.Hex.stringify(Bitcoin.CryptoJS.enc.Utf8.parse(msg_plain)); TypeError: Cannot read property 'enc' of undefined at services.js:2185 at angular.min.js:119 at r.$eval (angular.min.js:133) at r.$digest (angular.min.js:130) at angular.min.js:133 at e (angular.min.js:43) at angular.min.js:46(anonymous function) @ angular.min.js:107(anonymous function) @ app.js:112(anonymous function) @ angular.min.js:119r.$eval @ angular.min.js:133r.$digest @ angular.min.js:130(anonymous function) @ angular.min.js:133e @ angular.min.js:43(anonymous function) @ angular.min.js:46 services.js:1805 Login failed

Please also fix typo in : static/greenwallet/services.js L417 "Bitcion" Was done in dev branch of CItadelleApp https://github.com/antonio-fr/CitadelleApp/commit/6949d9cb417a1665afb14bd566db1564419e5d54

greenaddress commented 8 years ago

The typo was fixed as well as an other error (7df3b53a66b826443551f2d697f60c05fc82396b and 78958159c9cba199cfc383000c2c036a33ada19b) but as you say it still fails with "TypeError: BIP32 only allows compressed keyPairs" and

    at new HDNode (chrome-extension://fdhgplmbbghfhlbiofempffjhdejdjjg/static/js/bitcoinjs.min.js:3736:34)
    at Object.walletsService.login_btchip (chrome-extension://fdhgplmbbghfhlbiofempffjhdejdjjg/static/js/greenwallet/services.js:420:24)
    at chrome-extension://fdhgplmbbghfhlbiofempffjhdejdjjg/static/js/greenwallet/signuplogin/controllers.js:358:33
    at h (chrome-extension://fdhgplmbbghfhlbiofempffjhdejdjjg/static/js/btchip-js-api/thirdparty/q/q.min.js:27:8089)
    at d.promiseDispatch.g (chrome-extension://fdhgplmbbghfhlbiofempffjhdejdjjg/static/js/btchip-js-api/thirdparty/q/q.min.js:27:8362)
    at F.d.promiseDispatch (chrome-extension://fdhgplmbbghfhlbiofempffjhdejdjjg/static/js/btchip-js-api/thirdparty/q/q.min.js:27:2898)
    at chrome-extension://fdhgplmbbghfhlbiofempffjhdejdjjg/static/js/btchip-js-api/thirdparty/q/q.min.js:27:1656
    at MessagePort.g (chrome-extension://fdhgplmbbghfhlbiofempffjhdejdjjg/static/js/btchip-js-api/thirdparty/q/q.min.js:27:5813)

I don't think you need or want to comment out the check, still investigating

antonio-fr commented 8 years ago

WIth theses fixes, I can confirm that the issue is the same, even with initializing with v0.77.

This is not a really "backward compat" issue. Still something is wrong is the new version about BIP32 with BTChip and needs deep investigation.

antonio-fr commented 8 years ago

From my investigation from BTChip, the initialization is rightly performed with "compressed keys". Features flag = 0x0A. So that could be an issue on compress state detection or in the bitcoinjs third party lib.

greenaddress commented 8 years ago

Agreed. This may be a bug in our code or something going wrong inside bitcoinjs and requires investigation.

For now the work around is using the previous version which still works. Either from GitHub https://github.com/greenaddress/WalletCrx/releases/tag/v0.0.76 or there are some other ways from your local cache or from a proxy http://superuser.com/questions/936432/how-do-i-install-a-previous-version-of-chrome

greenaddress commented 8 years ago

fixed in 7afde0f914cb66a456b780d5b47f823eb2b69531 (0.0.78 released)