VC architecture overview (Part 2 / Stages 0–7, T, A, P)¶
Where this page belongs
This is a document in the Design section. A bird's-eye summary of what Part 2 built: 6 VC kinds × 4 token kinds × hands-on Stages 0–7 plus Stages T / A / P. See the individual pages for the details of each spec. End-to-end behavior is checked with the publisher tests and on a real iPhone.
1. Overview¶
Writing data, reading data, and listing identity are authorized by a human or a machine presenting a VC. Each VC records "who is allowed to do what" as claims, a presentation yields a short-lived token, and the APIs are gated by that token.
2. Six VC kinds¶
| Kind | Role | Main claims | Expected holder |
|---|---|---|---|
| ConsentVC | Single-use consent to write data | dataset_id, allowed_purposes[] |
Human (data provider) |
| ViewerVC | Read data (any dataset) | dataset_id, allowed_actions=["read"] |
Human (viewer) |
| ServiceVC | M2M continuous write | dataset_id, allowed_actions=["write_continuous"] |
Service (publisher etc.) |
| PurchaseViewerVC | Purchase-bound read | dataset_id, merchandise_address, tx_hash, buyer_eth_addr |
Human (buyer) |
| SellerVC | Listing identity + dataset license | seller_id, licensed_datasets[] |
Human / service (seller) |
| DataUserVC | Trust attributes of the data receiver (Stage T) | entityType, purpose, legalCompliance, dataHandlingPolicy, misuseRecord |
Human / organization (data receiver) |
VCs are issued as SD-JWT VC (vct: https://iw3ip.example/credentials/<Kind>/v1) and held by the wallet. They are presented via OID4VP (DCQL).
3. Four token kinds¶
| Token | TTL | Uses | Gated API | Source VC |
|---|---|---|---|---|
| PolicyToken | 5 min | Single | POST /platform/ingest |
ConsentVC |
| ViewerToken | 60 s | Multiple within TTL | GET /platform/data |
ViewerVC / PurchaseViewerVC |
| ServiceToken | 1 h | Multiple within TTL | POST /platform/ingest |
ServiceVC |
| SellerToken | 24 h | Multiple within TTL | POST /marketplace/register, POST /provider/publish |
SellerVC |
ViewerToken is issued from both ViewerVC and PurchaseViewerVC, but the namespace is the same (once issued, the two are treated identically). Otherwise each token kind has its own namespace and cannot be reused elsewhere (for example, using a SellerToken on ingest returns 401).
DataUserVC does not issue a token on its own. At /marketplace/claim it is used to compute a trust score, and the result, allowed_views (how much of the content may be shown), is carried into the PurchaseViewerVC and the ViewerToken.
4. Authorization matrix (which VC gates which API)¶
| write: single-use | write: continuous | read: short-term | read: purchase-bound | |
|---|---|---|---|---|
| JSON registration | /consents POST | — | — | — |
| Wallet (human) | ConsentVC | — | ViewerVC | PurchaseViewerVC |
| Wallet (M2M) | — | ServiceVC | — | — |
| Listing governance (cross-cutting) | — | — | — | — |
For listing governance (cross-cutting), SellerVC gates "/marketplace/register" (and "/provider/publish").
SellerVC does not gate the data-read APIs. Instead, it leaves evidence of the seller's identity at listing time in the audit log, and that identity is included as seller_did in the buyer's /platform/data?merchandise= response. In the implementation, the SellerToken also works for POST /provider/publish in Stage T (writes from the data-provider PWA), and each use increments register_count.
5. Hands-on stages (Stages 0–7, T, A, P)¶
The figure below shows the dependency graph of the Part 2 hands-on. A dotted arrow marks a design basis, not a hands-on prerequisite.
flowchart TB
S0["Stage 0 (baseline: /consents JSON registration)<br>webcam-event-sharing<br>environment-disaster"]
S1["Stage 1 ── ha-ssi-wallet<br>ConsentVC + PolicyToken (single-use write)"]
S3["Stage 3 ── ha-ssi-viewer<br>ViewerVC + ViewerToken (multi-use read)"]
S4["Stage 4 prep ── ha-ssi-service<br>ServiceVC + ServiceToken (M2M continuous)"]
S5["Stage 5 ── marketplace-vc-bridge<br>PurchaseViewerVC (purchase-bound read)"]
S6["Stage 6 ── marketplace-vc-end-to-end<br>Service (write) × PurchaseViewer (read) combined"]
S7["Stage 7 ── marketplace-seller-vc<br>SellerVC (listing identity)"]
ST["Stage T ── data-user-vc-tiered<br>DataUserVC (content tiered by trust)"]
SA["Stage A ── marketplace-mobile-app<br>purchase to viewing in a phone PWA"]
SP["Stage P ── c2pa-provenance<br>image provenance signed with C2PA"]
S0 --> S1 --> S3 --> S4 --> S5 --> S6 --> S7
S1 --> ST
S0 --> ST
S6 --> SA
ST -.-> SP
S7 -.-> SP
The prerequisites of Stage P are as follows.
- P0 has no prerequisite stage and runs on its own without VCs.
- P1–P3 send data with /simulate/publish and do not use SellerVC or Stage 7. They connect to the publisher and the chain and use the per-tier ViewerToken.
Details of each stage:
| Stage | Hands-on | Main additions |
|---|---|---|
| 0 | Share detections, not raw frames, Share disaster events | /consents JSON registration, MQTT → ingest |
| 1 | Authenticate the data provider (Consent VC / Stage 1) | OID4VCI/OID4VP + ConsentVC + PolicyToken |
| 3 | Authenticate the viewer (Viewer VC / Stage 3) | ViewerVC + ViewerToken + GET /platform/data |
| 4 prep | Authenticate machines (Service VC / Stage 4 prep) | ServiceVC + ServiceToken (M2M) |
| 5 | Hand a credential to the buyer's wallet (Bridge / Stage 5) | bridge service + PurchaseViewerVC + merchandise=<addr> reverse lookup |
| 6 | Read ServiceVC-written data with a PurchaseViewerVC (Stage 6) | ServiceVC writes and PurchaseViewerVC reads connected on one dataset (building on the ConsentVC / ViewerVC flows of Stages 1 and 3) + dataset_id obtained dynamically from additionalInfo |
| 7 | Back the seller's identity (Seller VC / Stage 7) | SellerVC + /marketplace/register + on-chain getOwner() verification + seller_did included in the response |
| T | Tier the response by trust (DataUserVC / Stage T) | DataUserVC + trust score + allowed_views to tier the /platform/data output |
| A | Marketplace as a phone app (Stage A) | Use iot-market-ui as a PWA on the phone, from purchase through VC receipt to viewing |
| P | Prove where an image came from (C2PA / Stage P) | P0. No VC. Prove image provenance with C2PA signing using X.509 certificates. Prerequisite stages: none (runs on its own with only the repository and Python; no publisher or wallet needed) |
| P | Connect provenance to the publisher and the chain (C2PA / Stage P, P1 and P2) | P1 and P2. Validation at the publisher's /media/upload, signing of the Tier 2 image, ProvenanceToken issuance, and per-tier provenance. The tiers are checked with PurchaseViewerVC and DataUserVC attributes (a wallet inside the program) |
| P | Trace a VLM summary back to the image (C2PA / Stage P, P3) | The publisher signs a summary card that shows the VLM's summary (P3). A Tier 1 user traces the summary text to the capture's manifest and the ProvenanceToken |
6. v1 / v2 marketplaces running side by side¶
From Stage 5 onward, the existing marketplace (v1) and the new scheme (v2) are designed so that both paths run from the same Purchase event.
| Aspect | v1 (current) | v2 (Stage 5+) |
|---|---|---|
| Identifier | Ethereum address | + did:jwk |
| Authorization | confirmedBuyers mapping |
+ PurchaseViewerVC + ViewerToken |
| Delivery | Decrypting emitUpload(encryptURI) |
+ /platform/data?merchandise=<addr> |
| Audit | on-chain Upload event | + publisher audit log (eth_did_bound, seller_register, viewer_token_used, etc.) |
| Listing identity | Merchandise.owner (eth) | + seller_did of the SellerVC |
Details: Marketplace VC Bridge — v1 / v2 Design Spec, SellerVC — marketplace listing governance VC (Stage 7 design spec)
7. Audit log chain¶
A single purchase chains the following 8 kinds of audit log rows (when Stages 4-prep, 5, and 7 are all involved; #4 repeats once per ingest). In the Stage 6 hands-on, Stage 7's #1 and #2 are absent and there are 5 ingests, so there are 10 rows:
| # | raw_topic | reason | Subject (subject_did) |
|---|---|---|---|
| 1 | oid4vp/response |
ok (SellerVC presented) |
seller did:jwk |
| 2 | marketplace/seller_registered |
seller_register:...:owner_verify=verified |
seller did:jwk |
| 3 | oid4vp/response |
ok (ServiceVC presented) |
service did:jwk |
| 4 | platform/ingest × N |
service_token_used:<jti>:<n> |
service did:jwk |
| 5 | marketplace/claim |
claim_received:<id>:tx=... |
eth:<buyer_addr> |
| 6 | marketplace/issued |
eth_did_bound:claim=...:eth=...:tx=... |
buyer did:jwk |
| 7 | oid4vp/response |
ok (PurchaseViewerVC presented) |
buyer did:jwk |
| 8 | platform/data |
viewer_token_used:<jti>:<n>:views=... |
buyer did:jwk |
Points to note:
marketplace/claim(eth) andmarketplace/issued(did:jwk) are linked byclaim_id, tying the same person to two different keys- The
seller_didinmarketplace/seller_registeredmatches theseller_didin the/platform/dataresponse (traceability from listing to viewing)
8. Token namespace isolation¶
Each token is valid only on its dedicated API:
| Token | Valid API | If reused elsewhere |
|---|---|---|
| PolicyToken | POST /platform/ingest |
/platform/data: 401 / /marketplace/register: 401 |
| ViewerToken | GET /platform/data |
/platform/ingest: 401 / /marketplace/register: 401 |
| ServiceToken | POST /platform/ingest |
/platform/data: 401 / /marketplace/register: 401 |
| SellerToken | POST /marketplace/register, POST /provider/publish |
/platform/ingest: 401 / /platform/data: 401 |
/platform/ingest accepts both PolicyToken and ServiceToken, but internally it tries PolicyToken first and falls back to ServiceToken only on failure (unknown), for compatibility and uniform error messages.
9. Keys and identity¶
Hands-on participants handle the following three kinds of keys at the same time:
| Key | Location | Purpose |
|---|---|---|
| Ethereum key (Account #N) | MetaMask / Hardhat console | Paying for Merchandise purchases, calling contracts |
| Wallet did:jwk | iw3ip-wallet | Subject of OID4VCI/OID4VP, cnf of the VC |
| Publisher issuer key (did:jwk) | publisher container | Signing issued VCs |
The eth_did_bound audit row of Stage 5 records the link between the Ethereum key ↔ did:jwk. This is an off-chain mechanism (the publisher's audit log) for asserting that the "ETH payer" and the "VC presenter" are the same person (currently an MVP that simply trusts the bridge; it is planned to be strengthened with EIP-712 signatures = Stage 8).
10. Known limitations (to be considered for Stage 8+)¶
The following are intentionally out of scope for Stages 0–7 of Part 2:
- Identity binding with EIP-712 signatures (protection against eth ↔ did:jwk impersonation)
- On-chain guard (requiring a SellerToken proof on the Solidity side when registering Merchandise)
- Revocation: VC revocation lists using Status List 2021 or similar
- Trust framework: verifying the identity of the "marketplace authority" that can issue SellerVCs
- Token sharing across multiple publishers (currently in-memory, so distributed operation is not possible)
- Connection to the Phase 3 LLM Planner (proving the authorization of each plan step with a VC)
11. Related pages¶
- Design specs
- Marketplace VC Bridge — v1 / v2 Design Spec — structure of Stages 5/6
- SellerVC — marketplace listing governance VC (Stage 7 design spec) — design decisions of Stage 7
- Hands-on
- Hands-on — list of the Part 2 hands-on pages
- For each stage, see the table in §5