Opal - metrodroid/metrodroid GitHub Wiki

Opal is the larger of the two active transit smartcard ticketing systems in Sydney, Australia (the other being Manly Fast Ferry. The system is developed and operated by Pearl Consortium (Cubic, Downer EDI, Commonwealth Bank) for Transport for NSW.
It replaces a previous mangetic-stripe system, and the aborted T-Card system.
Standard Opal cards are MIFARE DESFire EV1 cards, with the application ID 0x314553. All files are restricted except for file 0x7, which is freely readable.
This is different from Cubic Nextfare MFD.
The official Android app can read these cards.
Metrodroid implements support for this card format in v2.9.21 and later.
Free travel cards (including School Opal cards (SSTS), Veterans, Vision Impaired Persons, and TfNSW Employees) are Plastic Mifare Ultralight C cards.
Opal single trip tickets are paper Mifare Ultralight C cards.
These are not readable either by Metrodroid or the official Opal App.
Opal readers also support paying by credit cards (Mastercard, Visa) that support contactless EMV.
The file is 16 bytes long.
All multi-byte values are stored in little-endian on the card, unless specified otherwise.
For convenience, it is recommended to reverse the bytes in the file. Metrodroid's bit-reading code is all big-endian.
Offsets and lengths listed are measured in bits, and assume you have reversed the data. Ranges listed do not include the end bit.
| Start | End | Length | Field description |
|---|---|---|---|
| 0 | 16 | 16 | CRC16 checksum (bytes reversed) |
| 16 | 20 | 4 | Weekly paid journey count |
| 20 | 21 | 1 | Auto top-up enabled |
| 21 | 25 | 4 | Last tap usage type |
| 25 | 28 | 3 | Mode of transport |
| 28 | 39 | 11 | Last tap time: minutes since 00:00 |
| 39 | 54 | 15 | Last tap date: days since epoch |
| 54 | 75 | 21 | Balance in cents (two's complement) |
| 75 | 91 | 16 | Transaction sequence number |
| 91 | 92 | 1 | Card status, 1 if blocked |
| 92 | 96 | 4 | Serial number check digit |
| 96 | 128 | 32 | Serial number |
All card numbers start with "308522". This is then concatenated with the serial number zero-padded to 9 digits, followed by the check digit.
The epoch is 1 January 1980 (1980-01-01).
Tap dates and times are always stored in local time (Australia/Sydney).
Time-of-day is based on a 24 hour day, even in the case of daylight savings transitions. eg: 13:00 is always the 780th minute of the day.
It is not known how ambiguous times are handled (eg: 02:01 on the day DST ends).
| ID | Description |
|---|---|
| 0 | Rail (including Metro) |
| 1 | Ferry or Light Rail |
| 2 | Bus |
| 3-7 | (reserved) |
| ID | Description |
|---|---|
| 0 | Card has not been used |
| 1 | Tap on: new journey |
| 2 | Tap on: transfer from same mode |
| 3 | Tap on: transfer from different mode |
| 4 | Tap on: Manly-CQ ferry: new journey |
| 5 | Tap on: Manly-CQ ferry: transfer from another ferry 1 |
| 6 | Tap on: Manly-CQ ferry: transfer from different mode |
| 7 | Tap off: distance based fare |
| 8 | Tap off: flat-rate fare |
| 9 | Tap off: automatically completed journey (failure to tap off) |
| 10 | Tap off: end of trip without start (failure to tap on) |
| 11 | Tap off: tap on reversal |
| 12 | Tap on: tap on rejected |
| 13 | (reserved) |
| 14 | (reserved) |
1 Transfers between ferries can only occur at Circular Quay.