MyEtherWallet / etherwallet

https://vintage.myetherwallet.com
MIT License
2.33k stars 1.72k forks source link

QR code reader #367

Open chriseth opened 7 years ago

chriseth commented 7 years ago

Adding a QR code reader to MEW would be make it super-awesome as an "ad hoc" wallet:

Take any phone, go to myetherwallet.com, scan a QR code containing your private key from a piece of paper, scan the recipient's address, enter the value (or select function to call) and hit send.

In general, I think MEW would profit a lot from a QR code reader to "enter" addresses.

Are there any plans to add such a feature?

I had a short look at javascript client-side-only QR code scanners, and it seem that it is possible in principle via webRTC (a fallback to having to perform a "file upload" and selecting the camera app to take a picture would not be too bad), but the demos a tried were not able to actually decode some QR codes I tested it with.

It seems that https://github.com/dwa012/html5-qrcode is the most self-contained example but in the end, all such readers build on top of https://github.com/LazarSoft/jsqrcode .

tayvano commented 7 years ago

I think if you go back in time to the original posts --- the posts where kvhnuke was still posting them to reddit --- this was requested and we were like "oh yeah for sure...we'll add that." I mean, QR codes have been on the paper wallets since day 1. 😂

It is one of those features that isn't that hard to implement, would be a very nice nice-to-have, but never somehow makes it on to the "it gets done" list.

I had this one in our Asana - https://www.npmjs.com/package/qrcode-reader which is also a built off of LazarSoft, but seems better maintained? I'm sure there's one that is a perfect little angular directive if we wanted that too.

I wonder if LazarSoft realizes he literally is the foundation for every JS QR Code reader out there. If he pulled a left-pad....... ;)

Anyways - it'll get done some day. 😉 I might actually try to do it. It's simple enough. It would also be perfect for https://www.reddit.com/r/ethereum/comments/5ya5fx/commiteth_earn_eth_by_committing_to_open_source/

chriseth commented 7 years ago

Nice! I just tried the npm package and it seems to work! I took a photo of the "generate wallet" screen - at first the decoder was confused because some parts of the second qr code was still visible (you might consider moving them more apart for that reason), but cropping the image did the trick! I just tried it on a laptop, so combining it with webrtc for a demo would be the next step.

chriseth commented 7 years ago

I created a small demo using the qrcode-reader npm package: https://chriseth.github.io/qr-demo/ It works really nicely with both firefox and chrome on my laptop, but somehow, firefox on my phone reports some internal qr decoding error - it finds the patterns but then complains about "locator degree does not match the number of roots".

tayvano commented 7 years ago

https://github.com/sembrestels/angular-qr-scanner - So I also had this one saved but never thought much of it because the demo doesn't work. Turns out...the demo doesn't work because the demo has a hardcoded http:// in there. I fixed it and it works fairly well (tested with a printed paper wallet - address and private key)

It gets lost if you move too much though...

I sftp'd to the nearest ssl server I have access to so you can test as well. (That link will be removed in ~24 hours)

chriseth commented 7 years ago

I get exactly the same error for that.

tayvano commented 7 years ago

Yours is better because it stops when it detects, too. Alright. I'll try to sneak this in with ENS. It may go into wallet decryption before addresses, but we'll see.

As an internal note, we will need to use a standard QR code format for addresses or whatever (similar to Bitcoin). I'll take a look at Jaxx and see if they do anything special. And ping Metamask because they love standards. 😝

TODOS

Keep in minds

linagee commented 7 years ago

I was going to add my 2 wei, but I realize the library I was just going to suggest was already suggested. I guess the same one really is used everywhere!

johnshearing commented 6 years ago

Hi Guys I have MyEtherWallet running on an air-gapped raspberry pi with a camera and QR-Code reader installed. The QR-Code software is zbarcam which is part of zbar-tools. My directions for setting up everything can be found here with attention resting on the qr-code setup https://gist.github.com/johnshearing/f00d7effd09a80c2f462887778da07a3#install-the-camera-and-qr-code-reader Hope this helps