Beta. STARCO Dev works with synthetic data only: do not send real personal or health data. Every feature shows its real status (Available Beta Beta · in development Coming).

Documentation menu

Tutorial 10

Export with a fingerprint.

Goal: take a twin out of STARCO as one file and prove, to yourself and to whoever you hand it to, that it is exactly what STARCO exported.

time 10 minlevel beginneryou need curl, jq and sha256sum, or Python 3 with requestsuses export Beta · audit chain Betatabs curl · Python · TypeScript · CLI (the SDK and the command line are not published as packages yet)
  1. 1Export
  2. 2Hash
  3. 3Chain
  4. 4Change

STEP 1 Export the twin Beta#

One request returns the whole twin: its layers as computed now, every observation, its typed measures and its current state, in the format starco-dev-export/v1. The SHA-256 of the exact bytes comes in the X-Content-SHA256 header. Save the body as it arrives: reformatting it changes the bytes.

export API="https://api.starco.dev/v1"
export STARCO_KEY="starco_dk_…"
TWIN=$(curl -s "$API/twins?limit=1" -H "Authorization: Bearer $STARCO_KEY" | jq -r '.data[0].id')
curl -s -D headers.txt -o twin.json "$API/twins/$TWIN/export" -H "Authorization: Bearer $STARCO_KEY"
grep -i x-content-sha256 headers.txt
Expected outputillustrative · synthetic
6197cbaab1f53567d1e913a90a73a18e6ade2a2c8a01ae55fc7ec0830c719587
['format', 'operator', 'project_id', 'twin', 'layers', 'observations', 'measures', 'state']

STEP 2 Recompute the fingerprint#

sha256sum twin.json
Expected outputillustrative · synthetic
6197cbaab1f53567d1e913a90a73a18e6ade2a2c8a01ae55fc7ec0830c719587  twin.json
True

STEP 3 Find the export in the audit chain Beta#

The export is a row of the project's chain with the same fingerprint in detail. Anyone who receives the file can compare its SHA-256 with that row, and verify the chain itself (tutorial 05).

curl -s "$API/audit?limit=1000" -H "Authorization: Bearer $STARCO_KEY" | jq '.data[] | select(.action == "twins.export") | {seq, actor_ref, detail}'
Expected outputillustrative · synthetic
29 starco_dk_fb7fa299 {"sha256":"6197cbaab1f53567d1e913a90a73a18e6ade2a2c8a01ae55fc7ec0830c719587","observations":1}

If the project has more than 1000 rows, follow next_after_seq as in tutorial 05.

STEP 4 Change one byte#

data = bytearray(open("twin.json", "rb").read())
data[data.index(b'"synthetic"') + 1] ^= 0x20       # "synthetic" → "Synthetic"
print(hashlib.sha256(bytes(data)).hexdigest())
Expected outputillustrative · synthetic
a completely different fingerprint

One letter changed and nothing of the fingerprint survives: the file no longer matches the header nor the row of the chain.

What just happened

You hold the twin as a single document whose fingerprint was computed by STARCO, sent with it and written to the audit chain. For reproducible research, cite the fingerprint next to the dataset. Missing values in the export are null, never zero. The export is of synthetic data: the sandbox holds nothing else.

twin.json X-Content-SHA256 audit row · twins.export sha256sum · equal

Next steps#