---
title: "Daisy chain: covering a batch of items with one verification"
description: Bind a batch of data items to a single hardware verification with the daisy chain flow, including two documented defects to fix before production.
---

[Skip to content](https://portal.sandgrain.eu/knowledge-base/daisy-chain-covering-a-batch-of-items-with-one-verification#main-content)

English

Show submenu for translations

![SandGrain\_Logo\_RGB\_white-bijgesneden (1)](https://portal.sandgrain.eu/hs-fs/hubfs/SandGrain_Logo_RGB_white-bijgesneden%20(1).png?width=427&height=83&name=SandGrain_Logo_RGB_white-bijgesneden%20(1).png)

Open main navigation

Close main navigation

- English
  
  Show submenu for translations
- [Contact us](https://portal.sandgrain.eu/login)

[Contact us](https://portal.sandgrain.eu/login?hsLang=en)

 How can we help you?

- There are no suggestions because the search field is empty.

1. [Knowledge Base](https://portal.sandgrain.eu/knowledge-base?hsLang=en)
2. [SDK](https://portal.sandgrain.eu/knowledge-base/sdk?hsLang=en)
3. [Core Functions](https://portal.sandgrain.eu/knowledge-base/sdk?hsLang=en#core-functions)

October 6, 2026

# Daisy chain: covering a batch of items with one verification

The daisy chain flow binds **several data items to a single verification**. Instead of one cloud round-trip per item, each item is folded into a running hardware computation, and the cloud checks only the final value. If it verifies, every item in the chain is covered: unmodified, and processed by the genuine token, in that order.

### When to use it

- Batching sensor readings collected between connectivity windows.
- Tagging an ordered set of records (a mini audit log) with one check.
- Reducing cloud round-trips where per-item verification is too expensive.

### How the chain is built

1. The host obtains a starting challenge (from the cloud, or generated locally in the host-initiated form).
2. The token produces the first response (HRW1).
3. For each data item: the running value is concatenated with the item, passed through the token, and the output becomes the new running value: HCW2 = HRW1 + data\[0\] → HRW2, and so on.
4. The final value is submitted to the cloud, which recomputes the entire chain in its HSM and returns `AUTH_OK` only if every link matches.

Order matters by construction: swapping, dropping, or altering any item changes every subsequent link.

### The three examples

All live in [`examples/06-chain-multiple-items/`](https://github.com/SandGrain-CyberRock/CyberRock-Core-Functions/tree/main/examples/06-chain-multiple-items):

| Script | Form | Use when |
| --- | --- | --- |
| `daisychain.py` | Cloud-initiated | The cloud issues the starting challenge. **Recommended starting point.** |
| [`daisychain_host.py`](https://github.com/SandGrain-CyberRock/CyberRock-Core-Functions/blob/main/examples/06-chain-multiple-items/daisychain_host.py) | Host-initiated | The device starts the chain itself. **Carries two documented defects; see below.** |
| [`daisychain_hrw.py`](https://github.com/SandGrain-CyberRock/CyberRock-Core-Functions/blob/main/examples/06-chain-multiple-items/daisychain_hrw.py) | HRW form | The cloud computes the expected chain value for items you supply. |

**Before copying [`daisychain_host.py`](https://github.com/SandGrain-CyberRock/CyberRock-Core-Functions/blob/main/examples/06-chain-multiple-items/daisychain_host.py), know its two preserved defects** (both marked inline with `NOTE:` comments, both deliberately left in place during the 2026-08 restructure):

1. **The loop does not advance.** It re-reads the pre-loop value each pass instead of the previous pass's output. Harmless with the demo's single item; **wrong with two or more items** (the cloud will reject the chain), and a `NameError` with zero items. Fix by reassigning the running value each pass, as [`daisychain.py`](https://github.com/SandGrain-CyberRock/CyberRock-Core-Functions/blob/main/examples/06-chain-multiple-items/daisychain.py) and [`daisychain_hrw.py`](https://github.com/SandGrain-CyberRock/CyberRock-Core-Functions/blob/main/examples/06-chain-multiple-items/daisychain_hrw.py) do.
2. **The generated challenge is overwritten by a constant** (`'ffff…ffff'`). Fine against sandbox; in production a fixed, publicly known challenge makes responses replayable. Delete the overwrite line.

### Correct chaining pattern

```
for d in l_data:         hcw_next = hrw + d         hrw = token.do_host_auth(token.hex_to_bytes(hcw_next))
```

The running value `hrw` must be reassigned on every pass; that is what makes it a chain.

---

**Source code:** [SandGrain CyberRock - Core Functions on GitHub](https://github.com/SandGrain-CyberRock/CyberRock-Core-Functions/tree/main)

- [User Documentation](https://portal.sandgrain.eu/knowledge-base/user-documentation?hsLang=en#main-content)

    - [Quick Starter Guide](https://portal.sandgrain.eu/knowledge-base/user-documentation?hsLang=en#quick-starter-guide)
    - [User Manual](https://portal.sandgrain.eu/knowledge-base/user-documentation?hsLang=en#user-manual)
    - [Whitepaper](https://portal.sandgrain.eu/knowledge-base/user-documentation?hsLang=en#whitepaper)
    - [Token Leaflet](https://portal.sandgrain.eu/knowledge-base/user-documentation?hsLang=en#token-leaflet)
    - [Claim Token Procedure](https://portal.sandgrain.eu/knowledge-base/user-documentation?hsLang=en#claim-token-procedure)
    - [Daisy Chain](https://portal.sandgrain.eu/knowledge-base/user-documentation?hsLang=en#daisy-chain)
    - [Release Note](https://portal.sandgrain.eu/knowledge-base/user-documentation?hsLang=en#release-note)
    - [Naming Convention](https://portal.sandgrain.eu/knowledge-base/user-documentation?hsLang=en#naming-convention)
    - [SandGrain SDK](https://portal.sandgrain.eu/knowledge-base/user-documentation?hsLang=en#sandgrain-sdk)
    - [TrustBridge](https://portal.sandgrain.eu/knowledge-base/user-documentation?hsLang=en#trustbridge)
- [API Documentation](https://portal.sandgrain.eu/knowledge-base/api-documentation?hsLang=en#main-content)

    - [Device API Integration](https://portal.sandgrain.eu/knowledge-base/api-documentation?hsLang=en#device-api-integration)
    - [Daisy Chain and Attestation](https://portal.sandgrain.eu/knowledge-base/api-documentation?hsLang=en#daisy-chain-and-attestation)
- [SDK](https://portal.sandgrain.eu/knowledge-base/sdk?hsLang=en#main-content)

    - [Core Functions](https://portal.sandgrain.eu/knowledge-base/sdk?hsLang=en#core-functions)
    - [SandGrain SDK](https://portal.sandgrain.eu/knowledge-base/sdk?hsLang=en#sandgrain-sdk)

[![SandGrain\_Logo\_RGB\_white-bijgesneden (1)-1](https://portal.sandgrain.eu/hs-fs/hubfs/SandGrain_Logo_RGB_white-bijgesneden%20(1)-1.png?width=427&height=83&name=SandGrain_Logo_RGB_white-bijgesneden%20(1)-1.png "SandGrain_Logo_RGB_white-bijgesneden (1)-1")](https://portal.sandgrain.eu/?hsLang=en)

<https://www.facebook.com/> <https://www.twitter.com/> <https://www.instagram.com/> <https://podcasts.apple.com/> [mailto:email@email.com](mailto:email@email.com)

Copyright © 2026, sandgrain.eu