bitcoin URI is not transferred correctly over NFC
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
nfcpy |
Fix Released
|
High
|
Unassigned |
Bug Description
Hi Stephen
I'm working on some Bitcoin-related hardware device implementation that includes NFC, and what I need to do with NFC is to send bitcoin URI over it.
I've tested it with beam.py test script and found that http:// URIs work fine, but bitcoin: URI is failing. I've tried debugging it and managed to fix this, although I'm not fully understanding what was the problem, so I doubt that my code is good enough for pull request.
So what I did is this:
in beam.py:
def run_send_
# sp = nfc.ndef.
# if args.title:
# sp.title = args.title
sp = nfc.ndef.
in uri_record.py:
@property
def data(self):
# for i, p in enumerate(
# if i > 0 and self.uri.
# return chr(i) + self.uri[len(p):]
# else:
# return "\x00"
return "\x00"+self.uri
(commented parts are what was there before)
with this fix bitcoin URI processes fine via NFC and calls relevant application on the phone side to handle it.
You can get more data on bitcoin URI at https:/
Regards,
Alex
Thank you for the bug report. The actual error is where in uri_record.py the uri string is not appended to the abbreviation code 0x00 (which is for uri's with a non recognized prefix).
The modifications you did in run_send_ link_action may not be necessary, a smartposter is essentially just a wrapper around the uri which allows to give it a friendly title and maybe icon to display to the user when the uri is not understood. But if a handler for the uri scheme is registered it'll usually be called straight, as seems to be the case for 'bitcoin' (guess that's when a bc wallet app is installed).