Qrcode scanning api

Would be great if status implement https://github.com/ethereum/EIPs/issues/945

It is already implemented in Cypher Browser and trust wallet.

I have written about my usage at https://medium.com/coinmonks/what-scares-off-normal-people-from-using-dapps-519e811193b4

Hi Makoto!

Thanks for sharing your request :slight_smile:
I went through your doc. Very informative!

I am not sure I fully grasp what you expect from this API. Is it only about scanning a QR code and getting the address back?
If so I have two questions:

Thanks!

Hi, Julien.

I don’t think normal QR code API provides a way for dapp detect if the browser/device has barcode scanner. It may be safe to assume any device/browser has a camera but the quality of QR scanning via camera varies.

Payment link Alex specified is not the use case for me (as I want to know the ethereum address of the person in front of me to check the person in using my smart contract rather than paying to that person) so not applicable.

Thanks.

Makoto

Hi Makoto,

I don’t think normal QR code API provides a way for dapp detect if the browser/device has barcode scanner

Can you detail what do you mean by that? AFAIK most camera lib do. Here is the one used by status: https://github.com/react-native-community/react-native-camera
I don’t quite see what would be status added value here as it’s not directly related to any ethereum constraint.

Maybe there could be some other option? Like having them scan a QR code that points to a smart contract you own? Then by asking them to sign a transaction they could prove that they control this particular address.

Thanks

Hi, Julien. I had a quick look into react-native-camera repo and it looks like it is a library to be included at react native app, not at dapp level.

I looked into purely browser based QR code reader js library (which Dapp can include) such as https://github.com/schmich/instascan and had the following problem.

  • Scanned well from laptop, but had problems reading from mobile browser.
  • It used rear camera, not back camera (couldn’t figure out how to change from the js library)
  • It gives no styling of captcha camera so I (as a developer) has to style it by myself.
  • The read text has “ethereum:0x…” So I need to decode it by myself. Not a lot of work, but an extra work.

If you guys already did a ground work including these library and customising it for scanning Ethereum address, it would be great if you can expose it for dapp developer to easily integrate into.

https://github.com/makoto/blockparty/blob/315e0982bb57933b8582af10b9682ec9000e587c/src/components/QRCode.js#L11-L24 is how I integrated with the QR code API and it was very easy to integrate (took less than 30 min to integrate).

Hope this gives you more context from Dapp developer’s end.

Thanks.

Makoto

Hi Makoto,

thanks for the feedback. Makes more sense now.

In general I still feel like this API should not be provided by web3 browsers. It might be well adapted to your use case but I don’t quite see how it would be valuable for the web3 developer community at large.

One alternative option could be for status to provide documentation / advices on how to do this in a status optimized way. Then DApps developers would still have the opportunity to adapt to their needs.
We will soon start an initiative to improve our documentation. I will keep you posted.

Julien

Hi, Julien.

If you look into the original EIP url, a couple of game developers are requesting so I don’t think this is the use case just for me.

Also, optimising experience per different mobile browser is the last thing any Dapp developers want to do so I don’t think providing documentation would be any useful.

I sort of agree that this is not the fundamental functionality as a web3 browser, but this feature will make dapp developer’s life easier (and attract more dapp developers into status.im).

Regards,

Makoto

Seems like https://github.com/ethereum/EIPs/issues/945 is mixing up things. Why QRCode API needs to be inside web3 instance?
I think we should use qrcodes as needed, specially for scanning stuff, and having an API is important, however I dont see why mixing up web3 with qrcode api.

Hi, Ricardo.

I think it sort of depending on your definition of what web3 is. Your argument applies to why there are many utils to convert hex, ascii within web3.js itself https://web3js.readthedocs.io/en/1.0/web3-utils.html There are plenty of independent libraries you can cherry pick from elsewhere but having these things in web3 util toolbox will enhance the productivity of developers massively.

What differentiates mobile wallet from desktop wallet is that people can bring the device closer to other people or objects and it is common practice to scan them through QR code.

For me it makes sense to have QR code as long as we have to deal with long hex Ethereum address.

Hope this answers your question.

Makoto

Thank you for the details.
In the case the QRCode API is specifically for safely producing and reading QRCodes for ethereum related stuff, then yes, this might be one case to include in web3.js.