# VERI*FACTU hash chain (huella): how it works

> Each invoice record contains a SHA-256 hash of its key fields plus the hash of the previous record. Change or delete one record and every later hash stops matching.

## What is the huella?

The **huella** (Spanish for "fingerprint") is a hash that every registration record carries. It is calculated with **SHA-256** and written as uppercase hexadecimal text. Because each record includes the previous record's huella, the records form a **chain**, much like a blockchain but without the distributed ledger.

## Which fields go into the hash?

For a record of invoice issue (RegistroAlta), the input is a text string with these fields:

- issuer tax ID (IDEmisorFactura);
- invoice series and number (NumSerieFactura);
- issue date (FechaExpedicionFactura);
- invoice type (TipoFactura);
- total tax amount (CuotaTotal);
- total invoice amount (ImporteTotal);
- the **previous record's huella**;
- the date, time and time-zone offset when the record was generated.

The exact field order, formats and rules are fixed in Orden HAC/1177/2024 ([BOE](https://www.boe.es/buscar/act.php?id=BOE-A-2024-22138)). The first record of an issuer has no predecessor and is marked as such.

## Why a chain?

A chain makes **gaps and later edits detectable**:

- delete a record and the next one points to a hash that no longer exists;
- edit an amount and the record's hash changes, so the following record no longer matches.

The AEAT receives the records in VERI*FACTU mode, so it holds an independent copy of the chain.

## What if I make a mistake on an invoice?

You never edit a record. You create a **new record**: a correction (subsanación), a rectifying invoice (factura rectificativa) or a cancellation record (registro de anulación). Each new record is appended to the chain and gets its own huella. The history stays visible.

## Does the hash replace a digital signature?

No. In VERI*FACTU mode the hash chain is combined with immediate submission, so no electronic signature of the records is required. In NO VERI*FACTU mode, records must be electronically signed and an event log kept. See [VERI*FACTU vs NO VERI*FACTU](https://verifu.opsagent.app/en/verifactu-vs-no-verifactu).

## Can two invoices run at once?

The chain is sequential per issuer, so records must be created one after another. Software has to prevent two records pointing at the same predecessor. Separately, the AEAT requires a **waiting time** between submissions (about 60 seconds under the usual rules), so records are queued rather than sent in a burst.

## How does Verifu implement it?

Verifu stores records **append-only**: issued records are never updated or deleted. On Issue, in one transaction, it creates the record, computes the SHA-256 huella over the fields above plus the previous huella, and queues the submission. Corrections create new records. Related: [QR code](https://verifu.opsagent.app/en/verifactu-qr-code), [glossary](https://verifu.opsagent.app/en/verifactu-glossary), [what is VERI*FACTU](https://verifu.opsagent.app/en/what-is-verifactu).

---

Source: https://verifu.opsagent.app/en/verifactu-hash-chain (updated 2026-11-15)
