NGI Sargasso (Call 2) DPP-CRC project (online: https://hackmd.io/1WuM7GeeSvS7D6qI0V45Sg)
# Use Case #1 - Self-generated EPD in EU
#### Document Structure
* [Description](#Description)
* [Infrastructure](#Infrastructure)
* [Identities](#Identities)
* [Data Models](#Data-Models)
* [Walk-Through](#Walk-Through)
* [Video Recording](#Video-Recording)
* [Sequence Diagram](#Sequence-Diagram)
* [Step-by-Step Process](#Steps)
* [Learnings & Planned Improvements](#Learnings-amp-Planned-Improvements)
## Description
This use case illustrates the process of generating Environmental Product Declarations (EPDs) at a concrete factory and subsequently assembling a building component using multiple concrete deliveries (with attached DPPs referencing the EPDs), culminating in the compilation of a Digital Product Passport (DPP) that integrates data from these multiple concrete sources.
### Infrastructure
The following technical components are used:
<details><summary><strong>Private Data Store</strong> of a Concrete Producer:<br>stores data to generate EPDs</summary>
URL: https://cp-private.data-container.net
```bash
# Credentials
APP_KEY: 5mdPuiwt-H50Ixl2rWRKVPKQMhfdYw5LngK6RwBwZ5c
APP_SECRET: EFV6OgfmFj73XmAI-4ncU41MLjOACwvIU5jtlWXpFtA
```
Github Repo: https://github.com/OwnYourData/dc-cpprivate
Docker Image: https://hub.docker.com/r/oydeu/cp-private
</details>
<details><summary><strong>EPD Calc Tool</strong> of a Concrete Producer:<br>computes EPD and accompanying Zero-Knowledge Proof</summary>
URL: https://epd.ownyourdata.eu
Github Repo: https://github.com/OwnYourData/zk-epd-calc
Docker Image: https://hub.docker.com/r/oydeu/zk-epd-calc
*Steps for manual testing:*
* Create EPD:
```bash=
echo '{"description":"C 25/30/B1","cement":15,"gravel":20,"water":25,"additives":30,"material":"super starker Eco++","factory":"Eggendorf"}' | \
curl -s -H "Content-Type: application/json" -d @- \
-X POST https://epd.ownyourdata.eu/create
```
* Verify EPD:
```bash=
echo '{"description":"C 25/30/B1","factory":"Eggendorf","A13_gwp":165.4,"zkp":"1234abcd"}' | \
curl -s -H "Content-Type: application/json" -d @- \
-X POST https://epd.ownyourdata.eu/verify
```
</details>
<details><summary><strong>Private Data Store</strong> of a Construction Site Manager:<br>stores data of concrete deliveries and allows to generate DPPs</summary>
URL: https://sm-private.data-container.net
```bash
# Credentials
APP_KEY: qRXhTJVntLIQjKzllLD5gnE33QcVA81LAX1y7VZ7u4E
APP_SECRET: HV6OflMxRu9MgofNjwmiUTftLVidgzvoaqXXF46_zwc
```
Github Repo: https://github.com/OwnYourData/dc-smprivate
Docker Image: https://hub.docker.com/r/oydeu/sm-private
</details>
<details><summary><strong>Aggregation Tool</strong> of a Construction Site Manager:<br>aggregates concrete deliveries and accompanying ZKPs</summary>
URL: https://sm-zkp.data-container.net
Github Repo: https://github.com/OwnYourData/zk-epd-calc
Docker Image: https://hub.docker.com/r/oydeu/zk-epd-calc
</details>
<details><summary><strong>Data Intermediary</strong>: neutral actor <br>stores proof for DPPs and public information</summary>
URL: https://concrete.go-data.at
```bash
# Credentials
APP_KEY: nENk5CBuUIQy0e24bewN-WJx8w-FkPUekG9oQtx9N-4
APP_SECRET: 1oiPZTxbnQyQnl48QsRR9LlsAPFUUVTV5o4aaqZdOIg
```
Github Repo: https://github.com/OwnYourData/dc-intermediary
Docker Image: https://hub.docker.com/r/oydeu/dc-intermediary
</details>
<details><summary><strong>Sphereon Mobile Wallet</strong>: SSI wallet for Stakeholders<br> signs Verifiable Credentials with private key</summary>
General information: https://sphereon.com/sphereon-products/sphereon-wallet/
Github: https://github.com/Sphereon-Opensource/mobile-wallet/
</details>
### Identities
<details><summary><em>Concrete Producer (CP)</em><br>enters Concrete Mixture and creates DPP with EPD</summary>
<ul>
<li>uses Sphereon Mobile Wallet for signing data</li>
<li>DID: <code>did:oyd:zQmaS7yYwARSEw3ZEzi5wyfiz78hiBCS9UFaxWstueXxvNU</code><br>(note: will differ based on DID in wallet)</li>
<li>command: <code>echo '' | oydid create --doc-pwd cppwd --rev-pwd cprev -z 1</code></li>
</ul>
</details>
<details><summary><em>Construction Site Manager (SM)</em><br>uses concrete deliverables and creates DPP for building parts</summary>
<ul>
<li>uses Sphereon Mobile Wallet for signing data</li>
<li>DID: <code>did:oyd:zQmZ83C6BAi5qYRwaAnofAud4ozubFjRhFiyTFe3bDNnARy</code><br>(note: will differ based on DID in wallet)</li>
<li>command: <code>echo '' | oydid create --doc-pwd smpwd --rev-pwd smrev -z 1</code></li>
</ul>
</details>
<details><summary><em>Building Owner (BO)</em> <br>verifies DPPs</summary>
<ul>
<li>DID: <code>did:oyd:zQme8RBriYQSJFjXd6q559wJeSnMxGmTEgkX9GVdru9aTNh</code></li>
<li>command: <code>echo '' | oydid create --doc-pwd bopwd --rev-pwd borev -z 1</code></li>
</ul>
</details>
<details><summary><em>Data Intermediary (DI)</em> <br>public repository that can store data, DIDs, VCs, VPs, DPPs</summary>
<ul>
<li>DID: <code>did:oyd:zQmSAxAeWkGDN1xm9eKWq547DTfdFYkgJGjpBs54Q5BqLx8</code></li>
<li>command: <code>echo '' | oydid create --doc-pwd dipwd --rev-pwd direv -z 1</code></li>
</ul>
</details>
### Data Models
* [`ConcreteMixture`](https://soya.ownyourdata.eu/ConcreteMixture/yaml) - ingredients of concrete ([edit](https://soya-form.ownyourdata.eu/?schemaDri=ConcreteMixture&data=%7B%7D) | [example](https://soya-form.ownyourdata.eu/?schemaDri=ConcreteMixture&data=%7B%22description%22%3A%22C+25%2F30%2FB1%22%2C%22cement%22%3A15%2C%22gravel%22%3A20%2C%22water%22%3A25%2C%22additives%22%3A30%2C%22material%22%3A%22super+starker+Eco%2B%2B%22%2C%22factory%22%3A%22Eggendorf%22%7D))
* [`zkEPD`](https://soya.ownyourdata.eu/zkEPD/yaml) - Zero-Knowledge Proof for an EPD ([edit](https://soya-form.ownyourdata.eu/?schemaDri=zkEPD) | [example](https://soya-form.ownyourdata.eu/?schemaDri=zkEPD&data=%7B%22description%22%3A%22C+25%2F30%2FB1%22%2C%22factory%22%3A%22Eggendorf%22%2C%22A13_gwp%22%3A165.4%2C%22zkp%22%3A%221234abcd%22%7D))
* [`ConcreteDPP`](https://soya.ownyourdata.eu/ConcreteDPP/yaml) - Digital Product Passport for concrete ([edit](https://soya-form.ownyourdata.eu/?schemaDri=ConcreteDPP) | [example](https://soya-form.ownyourdata.eu/?schemaDri=ConcreteDPP&data=%7B%22date%22%3A%222024-05-29%22%2C%22epd%22%3A%7B%22description%22%3A%22C+25%2F30%2FB1%22%2C%22factory%22%3A%22Eggendorf%22%2C%22A13_gwp%22%3A165.4%2C%22zkp%22%3A%221234abcd%22%7D%2C%22volume%22%3A1.5%7D))
* [`ConcreteDelivery`](https://soya.ownyourdata.eu/ConcreteDelivery/yaml) - Verifiable Credential for concrete delivery ([edit](https://soya-form.ownyourdata.eu/?schemaDri=ConcreteDelivery) | [example](https://soya-form.ownyourdata.eu/?schemaDri=ConcreteDelivery&data=%7B%22timestamp%22%3A%222024-08-20T18%3A50%3A00%2B02%3A00%22%2C%22batch%22%3A%22did%3Aoyd%3AzQmQht8RJD6vx7nDvqjL8fdYPrTBJvDJui5oQVbW6cYJTw3%22%2C%22volume%22%3A3%2C%22transport%22%3A24.7%2C%22holder%22%3A%22did%3Aoyd%3AzQmZ83C6BAi5qYRwaAnofAud4ozubFjRhFiyTFe3bDNnARy%22%7D))
* [`BuildingPartDefinition`](https://soya.ownyourdata.eu/BuildingPartDefinition/yaml) - list of materials in a building part ([edit](https://soya-form.ownyourdata.eu/?schemaDri=BuildingPartDefinition) | [example](https://soya-form.ownyourdata.eu/?schemaDri=BuildingPartDefinition&data=%7B%22building%22%3A%22Vienna+Central%22%2C%22buildingPartID%22%3A%22West+Wing%22%2C%22date%22%3A%222024-09-08%22%2C%22usedMaterial%22%3A%5B%7B%22amount%22%3A4%2C%22concreteDppDid%22%3A%22did%3Aoyd%3AzQmdV9FowzCHiSzic8mgAohe62Fz7vbQr8q45nHreGN6AE7%22%2C%22select%22%3A%2234+-+2024-09-14%3A+C+25%2F30%2FB1+from+Company+B%22%7D%5D%7D))
* [`ZkBuildingPartEPD`](https://soya.ownyourdata.eu/ZkBuildingPartEPD/yaml) - Zero-Knowledge Proof for aggregated EPDs ([edit](https://soya-form.ownyourdata.eu/?schemaDri=ZkBuildingPartEPD) | [example](https://soya-form.ownyourdata.eu/?schemaDri=ZkBuildingPartEPD&data=%7B%22date%22%3A%222024-09-08%22%2C%22a14_gwp%22%3A123%2C%22building%22%3A%22Vienna+Central%22%2C%22buildingPartID%22%3A%22West+Wing%22%7D))
* [`BuildingPartDPP`](https://soya.ownyourdata.eu/BuildingPartDPP/yaml) - Digital Product passport for building part ([edit](https://soya-form.ownyourdata.eu/?schemaDri=BuildingPartDPP) | [example](https://soya-form.ownyourdata.eu/?schemaDri=BuildingPartDPP&data=%7B%22vp%22%3A%22https%3A%2F%2Fconcrete.go-data.at%2Fpresentations%2FzQm123%22%2C%22did%22%3A%22did%3Aoyd%3A123abc%22%2C%22epd%22%3A%7B%22zkp%22%3A%22abc890%22%2C%22date%22%3A%222024-09-08%22%2C%22a14_gwp%22%3A123%2C%22building%22%3A%22Vienna+Central%22%2C%22building_part_id%22%3A%22West+Wing%22%7D%7D))
## Walk Through
<a id="Video-Recording"></a>Video recording: https://www.loom.com/share/97ffe94afc11406f854a07a44d6b52b2
### Sequence Diagram
```plantuml
@startuml
box "\nServices Concrete Producer" #LightBlue
actor "Concrete\nProducer" as cp
participant "Online\nWallet" as cp_wallet
database "Private\nData Store" as cp_store
participant "Concrete\nEPD Calc" as epd
end box
box "\nServices Construction Manager" #Yellow
actor "Construction\nManager" as cm
participant "Online\nWallet" as cm_wallet
database "Private\nData Store" as cm_store
participant "Building Part\nEPD Calc" as agg
end box
box "\n Data\nIntermediary"
database " " as disp
box "\nServices Building Onwer\n" #LightGreen
actor "Building\nOwner" as owner
participant "Verification\nTool" as verifier
cp -> cp_store: enter ConcreteMix
cp --> cp_store: trigger EPD calculation
cp_store -> epd: send ConcreteMix
epd -> cp_store: store EPD
cp --> cp_store: trigger DPP creation
cp_store -> cp_store: create\nConcrete DPP
cp_store -> cp_wallet
cp_wallet -> cp_store: sign DPP
cp_store -> disp: publish Concrete DPP
cp_store -> cp_wallet: create\ndelivery VC
cm -> cp_wallet: read concrete delivery VCs
cm -> cm_wallet: store\ndelivery VCs
cm --> cm_store: trigger building part assemly
cm_store -> cm_store: assemble\nbuilding parts
cm_wallet --> cm_store: retrieve data\nfrom delivery VCs
disp --> cm_store: retrieve data from DPPs
cm_store -> agg: send BuildingPart
agg -> cm_store: store Aggregation
cm --> cm_store: trigger DPP creation
cm_store -> cm_store: create\nBuildingPart DPP
cm_store -> cm_wallet
cm_wallet -> cm_store: sign DPP
cm_store -> disp: publish BuildingPart DPP
cm --> owner: provide list of DPPs for building parts
owner --> disp: read\nDPPs
owner -> verifier: validate DPPs\n(incl. ZKP)
@enduml
```
### Steps
1) Concrete Producer (CP) logs into private data store
* url: https://cp-private.data-container.net/
App Key: `5mdPuiwt-H50Ixl2rWRKVPKQMhfdYw5LngK6RwBwZ5c`
App Secret: `EFV6OgfmFj73XmAI-4ncU41MLjOACwvIU5jtlWXpFtA`
2) CP creates new record for a `ConcreteMixture`
* **output:** new record
example link: https://cp-private.data-container.net/?itemId=176
3) CP triggers "Generate EPD" for a "ConcreteMixture" record
* **input:** record of structure `ConcreteMixture`<br><br>
* **output:** `zkEPD` record
example link: https://cp-private.data-container.net/?itemId=177
* **output:** `ConcreteDPP` record
example link: https://cp-private.data-container.net/?itemId=178
4) CP triggers "Publish DPP" for a "ConcreteDPP" record
* **input:** record of structure `ConcreteDPP`
* enter date+volume
* click "Publish DPP"<br><br>
* **outptut:** updated `ConcreteDPP` record with DID and link to VP
example link: https://cp-private.data-container.net/?itemId=178
* DID: [`did:oyd:zQmdV9FowzCHiSzic8mgAohe62Fz7vbQr8q45nHreGN6AE7`](https://dev.uniresolver.io/#did:oyd:zQmdV9FowzCHiSzic8mgAohe62Fz7vbQr8q45nHreGN6AE7)
* Verifiable Presentation: <br><span style="font-size:11px">[`https://concrete.go-data.at/presentations/zQmPSGgZq9WYXh9fxkVFrTbjJKpWxovRkvTfrVjoRjWxbhB`](https://concrete.go-data.at/presentations/zQmPSGgZq9WYXh9fxkVFrTbjJKpWxovRkvTfrVjoRjWxbhB)</span>
5) CP issues Verifiable Credential for `ConcreteDelivery`
* **input:** enter data for a `ConcreteDelivery` record
example link: https://cp-private.data-container.net/?itemId=179
* click "Show Delivery VC"
* enter URL of online wallet from construction site:
sm-private.data-container.net
and click "Go"
6) Construction Site Manager (SM) accepts `ConcreteDelivery` VC
* select record with schema `ReceivedConcreteDeliveryVCs`
* click "Accept VC"<br><br>
* **outptut:** new record `ConcreteDelivery`
example: https://sm-private.data-container.net/?itemId=18
7) SM assembles concrete deliveries to a `BuildingPartDefinition`
* **input:** enter data for `BuildingPartDefinition` record
example link: https://sm-private.data-container.net/?itemId=19
8) Create a ZKP of aggregating the "BuildingPartDefintion"
* select record with schema `BuildingPartDefintion`
* click "Aggregate BuildingPart"<br><br>
* **output:**
* new record `ZkBuildingPartEPD`
example: https://sm-private.data-container.net/?itemId=37
* new record `BuildingPartDPP`
example: https://sm-private.data-container.net/?itemId=38
9) SM triggers "Publish DPP" for a `BuildingPartDPP` record
* **input:** record of structure `BuildingPartDPP`
* click "Publish DPP<br><br>
* **outptut:** updated `BuildingPartDPP` record with DID and link to VP
example link: https://sm-private.data-container.net/?itemId=38
* DID: [`did:oyd:zQmf6uepGG49ZGsRqy5Vszceuf8xVhMZ7DavMQhgGLMEFkb`](https://dev.uniresolver.io/#did:oyd:zQmf6uepGG49ZGsRqy5Vszceuf8xVhMZ7DavMQhgGLMEFkb)
* Verifiable Presentation: <br><span style="font-size:11px">[`https://concrete.go-data.at/presentations/zQmfDjqDbDqu3yX93xyK5AeG3d6eS5kpjB8MjNcjvzj7dTG`](https://concrete.go-data.at/presentations/zQmfDjqDbDqu3yX93xyK5AeG3d6eS5kpjB8MjNcjvzj7dTG)</span>
10) Building Owner verifies DPP
* resolve DID (e.g., with [Uniresolver](https://dev.uniresolver.io/#did:oyd:zQmf6uepGG49ZGsRqy5Vszceuf8xVhMZ7DavMQhgGLMEFkb)) and download data from service endpoint
* perform the following checks:
* integrity of Verifiable Presentation
```bash=
curl -s https://concrete.go-data.at/presentations/zQmfDjqDbDqu3yX93xyK5AeG3d6eS5kpjB8MjNcjvzj7dTG | \
oydid vp-verify
```
* proof of correct calculation of GWP (global warming potential) using ZKP (Zero-Knowledge Proof)
```bash=
curl -s https://concrete.go-data.at/presentations/zQmfDjqDbDqu3yX93xyK5AeG3d6eS5kpjB8MjNcjvzj7dTG | \
jq '.verifiableCredential[0].credentialSubject' | \
curl -s -H "Content-Type: application/json" -d @- \
-X POST https://sm-zkp.data-container.net/verify
```
## Learnings & Planned Improvements
**Domain-specific Findings**
* process is too technical and needs focus on added business value for individual stakeholders:
* *Concrete Producer*: support in court-proof calculating GWP (global warming potential) and providing dynamic EPDs (Environmental Product Declarations) to their customers
* *Construction Site Manager*: accept EPD in various forms including DPPs (Digital Product Passports) and create provenance records of aggregating this information into DPPs for building parts
* *Building Owner*: create a web-based tool to verify content and provenance of DPP information
* identify available data and interfaces for involved stakeholders to better develop the business case for a production service
* Identity Management (and specifically SSI - Self Souvereign Identity) are still abstract concepts in the construction industry and the use of digital wallet (mobile and online) confuses people
**Technical Findings**
* limitations in [SOyA Forms](https://ownyourdata.github.io/soya/) for implementing complex use cases
* dynamic drop-downs to select DIDs (and other non human-readable identifiers)
* auto-complete for selecting SOyA structures [here](https://soya-form.ownyourdata.eu/)
* limitations in [Semantic Containers](https://ownyourdata.github.io/semcon/) for implementing complex use cases:
* Action Buttons should support configurable messages to use asynchronous function invocation
* support for deep-linking resources in a Semantic Container
* synchronization between Sphereon Online Wallet and Semantic Container is hard and the usage of different platforms is confusing for users; focus should be on technical concepts, e.g., credential exchange, use of supporting evidence
* specifications for DPP representation is fragmented and still in the early stages, the following documents were identified as most relevant for now:
- https://w3c-ccg.github.io/traceability-vocab/
- https://w3c-ccg.github.io/traceability-interop/draft/
- https://identity.foundation/linked-vp/