The UUID chain: how each receipt links to the one before
Each receipt’s UUID is the SHA-256 of its content, and that content includes the previous receipt’s UUID from the same POS, so the receipts form a chain from which no link vanishes unnoticed.
The ETA’s steps: include every field, the previous receipt’s UUID from the same POS among them (and, for a return, the original receipt’s reference); leave the receipt’s own UUID empty; serialize the receipt into one line; hash it with SHA-256; turn the 32 bytes into 64 hexadecimal characters; and put them in the field.
The first receipt from a POS has an empty previousUUID, and each one after carries its predecessor’s UUID. Change one character in an old receipt and its hash changes, no longer matching what the next receipt recorded.
A rejected receipt does not break the chain: in the ETA’s example R2, between R1 and R3, is rejected; it is corrected to R2* with a new UUID, keeps R1 as its predecessor, adds a referenceOldUUID pointing to R2, and R3 stays as it is.
In JooDax
BuiltJooDax computes the hash by these steps and writes it into the receipt, and tests cover the hash and the chain. The module does not store each POS’s last UUID and builds neither referenceOldUUID nor the return reference. The code comment calls emptying the field unconfirmed, while the ETA’s steps state it.
crates/jdx-einvoice-eg/src/lib.rs; crates/jdx-einvoice-eg/src/tests.rs
Steps
- Put the previous receipt’s UUID from the same POS in previousUUID (empty for the first).
- Leave the uuid field empty.
- Serialize the receipt by the ETA’s rules into one line.
- Hash the text with SHA-256 and turn it into 64 hexadecimal characters.
- Put the result in uuid and keep it as the next receipt’s previousUUID.
Questions and answers
What if a receipt mid-chain is rejected?
It is corrected and gets a new UUID, keeping its predecessor and adding a referenceOldUUID to the rejected receipt; an amendment referencing an invalidated receipt passes within 96 hours, one without a matching reference within 72, unless a late submission request covers it.
Related pages
Related concepts
- The ETA’s canonical serialization of a documentBefore hashing, the document becomes one line of text by fixed rules: field names upper-cased in quotes, values as they are, and the array name before each element.
- Issuing offline and the 24-hour windowA receipt is issued and checked locally, then submitted within 24 hours; anything later needs a late submission request.
E-receipts and e-invoices in Egypt
Sources
- Receipt Issuance FAQ — Egyptian Tax Authority (ETA) – eInvoicing & eReceipt SDK
- Receipt v1.2 (v1.2) — Egyptian Tax Authority (ETA) – eInvoicing & eReceipt SDK
- Document Serialization Approach — Egyptian Tax Authority (ETA) – eInvoicing & eReceipt SDK
Checked on: 4 November 2026. What concerns JooDax is taken from the programs’ own code.