Bringing NFC Standard To Bitcoin

Burak
4 min readDec 23, 2019

--

By killing the QR code in Bitcoin we not only get rid of a bit of a relic from the past but also simplify the end-user experience. Let’s all work together to make 2020 the year Bitcoin becomes the tap-to-pay cryptocurrency that can be used by anyone.

A Brief IntroductionTo Operating Modes Of NFC Devices

NFC devices support three modes of operation: reader/writer, peer-to-peer and emulation. The different operating modes are based on the ISO/IEC 18092 NFC IP-1 and ISO/IEC 14443 contactless smart card standards.

In reader/writer mode, the NFC device is capable of reading passive tags, such as a tag embedded in an NFC smart poster. The reader/writer mode on the RF interface is compliant with the ISO 14443 and FeliCa schemes.

In Peer-to-Peer mode, two active devices can exchange data. For example, you can share Bluetooth or WiFi link set-up parameters or you can exchange data such as virtual business cards or digital photos. Peer-to-Peer mode is standardized on the ISO/IEC 18092 standard.

In Emulation mode, one of active devices (Smartphone) appears to another active device (PoS terminal) much the same as a traditional contactless smart card.

Problem: Third party-running iOS devices cannot emulate NFC data

Unlike Android, peer-to-peer and emulation operating modes running on 3rd party iOS apps are currently not possible. There were some rumors that Apple will allow on iOS 13 but unfortunately they were not true. Supporting HCE (Host Card Emulation) would make it easier for third party payment apps to implement alternatives to Apple Pay, which Apple certainly will want to prevent. Maybe in the future versions of iOS developers will have access to more APIs than just reading and writing simple NFC NDEF tags today.

Solution: Reverse emulation

Reverse emulation is where iOS device is reading instead of emulating, and PoS device is emulating instead of reading. PoS devices initially request payment protocol URIs from GatePay API server. After responding, the device emulates an array of payment protocol URI records in NDEF format — using it’s antenna. By doing so, PoS devices are acting like a passive NFC tag where iOS apps can easily read the data from.

Generally speaking most NFC modules support tag emulation mode. Here’s some of them:

PN512 — https://www.seeedstudio.com/NFC-Module-for-Raspberry-Pi-p-1951.html

PN532 — https://www.pi-shop.ch/pn532-nfc-hat-for-raspberry-pi-i2c-spi-uart

A quick introduction to NDEF data format

An NDEF record contains a payload of data and metadata describing how to interpret the payload. The header for payload contains metadata describing the record and its place in the message. The payload is the most important part of an NDEF record; it’s the content that is being transmitted to wallet.

Structuring Payment Protocol URI in NDEF Format

A Complete NDEF Sample

Final NDEF Message:

0xB1013D5500626974636F696E3A2F2F31454A3139674831374B34757045657068774A34323137625061536F703766784C323F616D6F756E743D302E3033313433373601465500626974636F696E636173683A2F2F71717278613068396A716E63377634776D6A3979736574737033793777396C33367538676E6E6A756C713F616D6F756E743D312E30323636013F5520026974636F696E2D73763A2F2F31414C5366647341487261557A75384868414539436570396361316A7533666A74323F616D6F756E743D322E35313130393601475500657468657265756D3A2F2F3078343335643431383361653041656231624142433331626432354138313564363234346643333536323F616D6F756E743D312E3034343832383436013D55006C697465636F696E3A2F2F4C4D426B43695A59715176326876647556726548715A414B325A4C6D4848424274503F616D6F756E743D342E3930343935

--

--