-
Notifications
You must be signed in to change notification settings - Fork 86
feat: add COS™ Blockchain Compliance Tracker module #4064
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Constructionmgmtpractitioner
wants to merge
16
commits into
OriginTrail:v8/develop
Choose a base branch
from
Constructionmgmtpractitioner:feature/cos-compliance-tracker
base: v8/develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
ec2b448
feat: add COS™ compliance tracker module with appendix reproducibilit…
cmacademyconsulting 53552f6
feat: add COS™ compliance tracker module with docs and reproducibilit…
cmacademyconsulting 72a1d07
fix(cos-compliance-tracker): await tx confirmation in demo.js, comple…
cmacademyconsulting 1a958bc
fix(cos-compliance-tracker): include hash in compliance note, align j…
cmacademyconsulting 0e910d3
fix(cos-compliance-tracker): update reproducibility docs (commands, c…
cmacademyconsulting 6ae9348
fix(cos-compliance-tracker): resolve eslint issues in demo_plain.js (…
cmacademyconsulting e8362f3
fix(cos-compliance-tracker): update audit_table.csv with SHA-256 repr…
cmacademyconsulting a35a2fe
fix(cos-compliance-tracker): switch demo.js to SHA-256 for reproducib…
cmacademyconsulting 05fce83
fix(cos-compliance-tracker): update screenshot5.png to reflect update…
cmacademyconsulting 1a75ad7
docs(cos-compliance-tracker): add JSON-LD examples, screenshot6.png, …
cmacademyconsulting c979b1b
Update demo video section in README
Constructionmgmtpractitioner 9e90da5
Link demo video section to README.md
Constructionmgmtpractitioner 993bafe
Link demo video in commands.md
Constructionmgmtpractitioner 604366b
Add demo video link reference to commands.md
Constructionmgmtpractitioner 7d57797
Update demo video section in quickstart.md
Constructionmgmtpractitioner 099434d
Update judge instructions to link demo video
Constructionmgmtpractitioner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| RPC_URL_SEPOLIA=https://sepolia.infura.io/v3/YOUR_PROJECT_ID | ||
| PRIVATE_KEY=0xYOUR_PRIVATE_KEY |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
|
|
||
|
|
||
| # Commands & Workflow Checklist — COS™ Blockchain Compliance Tracker | ||
|
|
||
| This document outlines the reproducibility workflow for generating SHA‑256 hashes, submitting demo transactions, verifying TxIDs, and capturing screenshots. | ||
| ▶ For the full demo walkthrough, see the [Demo Video section in README.md](../readme.md). | ||
|
|
||
|
|
||
| --- | ||
|
|
||
| ## ⚙️ Environment Reminder | ||
| Before running demo scripts, copy `.env.example` → `.env` and add your own Infura Project ID and Sepolia PRIVATE_KEY. | ||
| See `README.md` or `judge_instructions.md` for details. | ||
|
|
||
| --- | ||
|
|
||
| ## 1. Generate SHA‑256 Hashes (Local Terminal) | ||
|
|
||
| For each governance event, run: | ||
|
|
||
| **Linux/macOS:** | ||
| ```bash | ||
| echo "SafetyInspection: Worker safety inspection completed on site" | sha256sum | ||
| ``` | ||
|
|
||
| **Windows (Command Prompt):** | ||
| ```powershell | ||
| echo SafetyInspection: Worker safety inspection completed on site > event.txt | ||
| certutil -hashfile event.txt SHA256 | ||
| ``` | ||
|
|
||
| **Node.js alternative (cross‑platform):** | ||
| ```bash | ||
| node -e "const crypto=require('crypto'); const msg='SafetyInspection: Worker safety inspection completed on site'; console.log(crypto.createHash('sha256').update(msg).digest('hex'));" | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 2. Submit Demo Transaction (Blockchain Demo) | ||
|
|
||
| Run the demo script to publish a compliance note on Sepolia: | ||
|
|
||
| ```bash | ||
| node demo.js "SafetyInspection: Worker safety inspection completed on site" | ||
| ``` | ||
|
|
||
| Expected output (note: `hash` must match Step 1): | ||
| ```json | ||
| { | ||
| "event": "SafetyInspection: Worker safety inspection completed on site", | ||
| "hash": "f90d04055edc258a17232db4172cd206995de4fa244a017f523e83662060977f", | ||
| "evidence": { | ||
| "txid": "0x008f0fdf9c8f96b0d4ad5bbd0063723abbeda980767d02c62a95f279d737a82c", | ||
| "blockNumber": 9718072, | ||
| "blockTimestamp": 1764250824 | ||
| }, | ||
| "verified": true | ||
| } | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 3. Run Offline Fallback Demo (No Sepolia ETH) | ||
|
|
||
| If you don’t have Sepolia ETH or RPC credentials, use the fallback script: | ||
|
|
||
| ```bash | ||
| node demo_plain.js "SafetyInspection: Worker safety inspection completed on site" | ||
| ``` | ||
|
|
||
| Expected output: | ||
| ```json | ||
| { | ||
| "event": "SafetyInspection: Worker safety inspection completed on site", | ||
| "hash": "f90d04055edc258a17232db4172cd206995de4fa244a017f523e83662060977f", | ||
| "verified": false, | ||
| "note": "Local-only demo: no transaction submitted" | ||
| } | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 4. Verify Transaction | ||
|
|
||
| Open Sepolia Etherscan and paste the TxID from the demo output: | ||
| Example: | ||
| [https://sepolia.etherscan.io/tx/0x008f0fdf9c8f96b0d4ad5bbd0063723abbeda980767d02c62a95f279d737a82c](https://sepolia.etherscan.io/tx/0x008f0fdf9c8f96b0d4ad5bbd0063723abbeda980767d02c62a95f279d737a82c) | ||
|
|
||
| --- | ||
|
|
||
| ## 5. Capture Screenshots | ||
|
|
||
| Save terminal output, Etherscan verification, and audit table screenshots into: | ||
|
|
||
| ```text | ||
| appendix/screenshots.md | ||
| ``` | ||
|
|
||
| Follow the structure: | ||
| - Local Hash Generation | ||
| - Blockchain Demo Transaction | ||
| - Sepolia Etherscan Verification | ||
| - Offline Fallback Demo | ||
| - Audit Table Entry (from audit_table.csv) | ||
|
|
||
| --- | ||
|
|
||
| ▶ For the full demo walkthrough, see the [Demo Video section in README.md](../readme.md). | ||
|
|
||
|
|
||
| --- | ||
|
|
||
| ## ✅ Judge Checklist | ||
|
|
||
| By following this workflow, judges can: | ||
| - Generate and verify SHA‑256 hashes locally | ||
| - Run blockchain demo and confirm TxID on Sepolia | ||
| - Run offline fallback demo without Sepolia ETH | ||
| - Capture reproducibility screenshots | ||
| - Confirm audit table entries | ||
| - Follow [judge_checklist.md](appendix/judge_checklist.md) for quick verification | ||
| - Watch the demo video | ||
|
|
||
|
|
||
| --- | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
|
|
||
| # 📄 JSON‑LD Examples — COS™ Blockchain Compliance Tracker | ||
|
|
||
| This appendix provides structured JSON‑LD examples of compliance notes. | ||
| Judges can copy/paste these snippets to verify agent behavior, interoperability, and reproducibility. | ||
|
|
||
| --- | ||
|
|
||
| ## 🛡️ Safety Inspection | ||
|
|
||
| ```json | ||
| { | ||
| "@context": { | ||
| "schema": "http://schema.org/", | ||
| "cos": "https://neoplan.consult/schema/cos#" | ||
| }, | ||
| "@id": "cos:SafetyInspection2025-11-27", | ||
| "@type": "cos:ComplianceNote", | ||
| "schema:name": "SafetyInspection: Worker safety inspection completed on site", | ||
| "schema:identifier": "4be76f5ab25de6656c0c2837c7daddba53c74ea4ed59ce33f20425c185a16f82", | ||
| "cos:evidence": { | ||
| "cos:txid": "0xbcba824f947338957ca3f9afb02abb37aba9dde7750f4f2b998baedcdc69aab3", | ||
| "cos:blockNumber": 9718992, | ||
| "cos:blockTimestamp": "2025-11-27T22:56:24Z", | ||
| "cos:verified": true | ||
| }, | ||
| "schema:publisher": { | ||
| "@type": "schema:Organization", | ||
| "schema:name": "NeoPlan Consult Pvt. Ltd." | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 🌱 Carbon Permit | ||
|
|
||
| ```json | ||
| { | ||
| "@context": { | ||
| "schema": "http://schema.org/", | ||
| "cos": "https://neoplan.consult/schema/cos#" | ||
| }, | ||
| "@id": "cos:CarbonPermit2025-11-27", | ||
| "@type": "cos:ComplianceNote", | ||
| "schema:name": "CarbonPermit: Carbon emissions permit issued", | ||
| "schema:identifier": "0c00031ad51ca4e4e78de1b3312e4803f34a07468be3ae755a62436abfdeee51", | ||
| "cos:evidence": { | ||
| "cos:txid": "0x0297f64d9079cb0768a76ee949baa77484eced86217c07db5f297d60f5e4e4fc", | ||
| "cos:blockNumber": 9719008, | ||
| "cos:blockTimestamp": "2025-11-27T23:06:28Z", | ||
| "cos:verified": true | ||
| }, | ||
| "schema:publisher": { | ||
| "@type": "schema:Organization", | ||
| "schema:name": "NeoPlan Consult Pvt. Ltd." | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 📌 Usage Notes | ||
| - Each JSON‑LD snippet corresponds to a governance event logged in `audit_table.csv`. | ||
| - Judges can verify: | ||
| - **SHA‑256 hash** → matches `schema:identifier` | ||
| - **TxID** → verifiable on Sepolia Etherscan | ||
| - **Block number & timestamp** → confirm blockchain evidence | ||
| - These examples demonstrate **agent behavior** (publishing, querying, verifying) in the DKG. | ||
|
|
||
| --- | ||
|
|
||
| **End of JSON‑LD Examples** | ||
|
|
||
| --- |
121 changes: 121 additions & 0 deletions
121
apps/cos-compliance-tracker/appendix/judge_checklist.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
|
|
||
| # 🧑⚖️ Judge Checklist — COS™ Blockchain Compliance Tracker | ||
|
|
||
| This checklist provides a reference for verifying the reproducibility and ethics‑first commitments of the COS™ Blockchain Compliance Tracker submission. | ||
|
|
||
| --- | ||
|
|
||
| ## ✅ Setup | ||
| The setup process involves cloning the repository, installing dependencies, and configuring environment variables. | ||
|
|
||
| 1. Clone the repository: | ||
| ```bash | ||
| git clone https://github.com/Constructionmgmtpractitioner/dkg-engine.git | ||
| cd dkg-engine/apps/cos-compliance-tracker | ||
| npm install | ||
| ``` | ||
|
|
||
| 2. Configure environment: | ||
| - Copy `.env.example` to `.env` | ||
| - Add your **Infura Project ID** and **Sepolia PRIVATE_KEY** | ||
| ```env | ||
| RPC_URL_SEPOLIA=https://sepolia.infura.io/v3/YOUR_PROJECT_ID | ||
| PRIVATE_KEY=0xYOUR_PRIVATE_KEY | ||
| ``` | ||
|
|
||
| ⚠️ **Important:** This repository does **not** include private credentials. Judges must use their own Infura Project ID and Sepolia wallet key to reproduce the demo. | ||
|
|
||
| --- | ||
|
|
||
| ## 🚀 Demo Verification | ||
| The demo scripts illustrate how governance events are logged and verified. | ||
|
|
||
| Run demo script: | ||
| ```bash | ||
| node demo.js "SafetyInspection: Worker safety inspection completed on site" | ||
| ``` | ||
|
|
||
| Outputs governance event, SHA‑256 hash, TxID, block number, and timestamp. | ||
|
|
||
| Run additional governance events: | ||
| ```bash | ||
| node demo.js "QualityAudit: Independent quality audit completed" | ||
| node demo.js "EnvironmentalCheck: Environmental compliance check passed" | ||
| ``` | ||
|
|
||
| Fallback demo (plain‑text): | ||
| ```bash | ||
| node demo_plain.js "SafetyInspection: Worker safety inspection completed on site" | ||
| ``` | ||
|
|
||
| Provides simplified outputs for universal compatibility. | ||
|
|
||
| --- | ||
|
|
||
| ## 🔍 TxID Verification | ||
| 1. Copy a TxID from the demo output or `audit_table.csv` | ||
| 2. Paste into [Sepolia Etherscan](https://sepolia.etherscan.io/) | ||
| 3. Confirm block number and timestamp match demo output | ||
|
|
||
| --- | ||
|
|
||
| ## 📊 Reproducibility Workflow | ||
| See appendix files for reproducibility assets: | ||
| - [commands.md](appendix/commands.md) — step‑by‑step workflow | ||
| - [audit_table.csv](appendix/audit_table.csv) — reproducibility ledger | ||
| - [screenshots.md](appendix/screenshots.md) — screenshot evidence | ||
| - [jsonld_examples.md](appendix/jsonld_examples.md) — structured JSON‑LD compliance notes | ||
| - [judge_checklist.md](appendix/judge_checklist.md) — this checklist | ||
|
|
||
| Judges should confirm: | ||
| - Local SHA‑256 hash matches demo outputs | ||
| - TxID and block details match Sepolia Etherscan verification | ||
| - Offline fallback demo shows reproducibility without blockchain submission | ||
| - Audit table entries correspond to verified transactions | ||
| - **JSON‑LD structured examples in `appendix/jsonld_examples.md` match audit table and Sepolia evidence** | ||
| - **Screenshot6.png shows JSON‑LD compliance note aligned with audit_table.csv and Sepolia verification** | ||
|
|
||
| --- | ||
|
|
||
| ## 📊 DKG Integration (Optional Advanced Verification) | ||
| Scripts demonstrate publishing and querying compliance notes in the OriginTrail DKG. | ||
|
|
||
| - **Publish compliance notes** | ||
| ```bash | ||
| node src/dkg_publish.js | ||
| ``` | ||
|
|
||
| - **Query compliance notes** | ||
| ```bash | ||
| node src/mcp_query.js | ||
| ``` | ||
|
|
||
| - **Compute reputation scores** | ||
| ```bash | ||
| node src/reputation_score.js | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ▶ For the full demo walkthrough, see the [Demo Video section in README.md](../readme.md). | ||
| The demo video illustrates the flow: | ||
| **Governance Event → TxID → Etherscan Verification → Audit Table → JSON‑LD Note → Reputation Score → Dashboard View** | ||
|
|
||
| --- | ||
|
|
||
| ## ⚖️ Ethics‑First Commitments | ||
| - See `/docs/ethics_statement.md` for transparency, accountability, and sustainability principles | ||
| - License: CC BY 4.0 | ||
| - Reproducibility assets: `audit_table.csv`, `commands.md`, `screenshots.md`, `jsonld_examples.md`, `judge_checklist.md` | ||
|
|
||
| --- | ||
|
|
||
| ## 📘 References | ||
| - COS™ Working Paper (Zenodo DOI): [10.5281/zenodo.17620309](https://doi.org/10.5281/zenodo.17620309) | ||
| - Ethics Statement: `/docs/ethics_statement.md` | ||
| - Roadmap: `/docs/roadmap.md` | ||
| - Governance Framework: `/docs/governance_framework.md` | ||
| - Challenge Alignment: `/docs/challenge_alignment.md` | ||
|
|
||
| --- | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
|
|
||
|
|
||
| # 📸 Screenshots — COS™ Blockchain Compliance Tracker | ||
|
|
||
| This file serves as the **index of reproducibility screenshots** for hackathon judges. | ||
| Each screenshot provides visual evidence of the reproducibility workflow and must match outputs from demo scripts, Etherscan verification, and audit table entries. | ||
|
|
||
| All screenshots are stored in: | ||
| ``` | ||
| apps/cos-compliance-tracker/appendix/screenshots/ | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 1. Local Hash Generation | ||
|  | ||
|
|
||
| --- | ||
|
|
||
| ## 2. Blockchain Demo Transaction | ||
|  | ||
|
|
||
| --- | ||
|
|
||
| ## 3. Sepolia Etherscan Verification | ||
|  | ||
|
|
||
| --- | ||
|
|
||
| ## 4. Offline Fallback Demo | ||
|  | ||
|
|
||
| --- | ||
|
|
||
| ## 5. Audit Table Entry | ||
|  | ||
|
|
||
| --- | ||
|
|
||
| ## 6. JSON‑LD Structured Compliance Note | ||
|  | ||
|
|
||
|
|
||
| --- | ||
| ## ✅ Judge Reminder | ||
| Judges should confirm that: | ||
| - Local hash matches the `hash` field in demo outputs | ||
| - TxID and block details match Sepolia Etherscan verification | ||
| - Offline fallback demo shows reproducibility without blockchain submission | ||
| - Audit table entry corresponds to the verified transaction | ||
| - Screenshots are consistent with `commands.md` and `judge_checklist.md` | ||
|
|
||
|
|
||
| --- | ||
|
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| Event,Description,SHA256 Hash,TxID,Block Number,Block Timestamp,Verified | ||
| SafetyInspection: Worker safety inspection completed on site,Worker safety inspection completed on site,4be76f5ab25de6656c0c2837c7daddba53c74ea4ed59ce33f20425c185a16f82,0xbcba824f947338957ca3f9afb02abb37aba9dde7750f4f2b998baedcdc69aab3,9718992,2025-11-27T22:56:24Z,true | ||
| CarbonPermit: Carbon emissions permit issued,Carbon emissions permit issued,0c00031ad51ca4e4e78de1b3312e4803f34a07468be3ae755a62436abfdeee51,0x0297f64d9079cb0768a76ee949baa77484eced86217c07db5f297d60f5e4e4fc,9719008,2025-11-27T23:06:28Z,true | ||
| GenderInclusion: Gender inclusion report submitted,Gender inclusion report submitted,18b6481e1d69e9e17c1a4160fc248d420f35ae646853b9ac853765169d491333,0x7e5eff437543578084076dfb2b82f6de2dc5401e8a53e607e3a3e7d1f306a9a7,9719013,2025-11-27T23:07:40Z,true | ||
| AuditLog: Auditor compliance check completed,Auditor compliance check completed,fc6fa89062f2c9aa8d821f6aa459b6223b6af944cc65dd931770cc8396c10654,0xd9f5a084f5c59ce21a57e2007bcfa36ccdea2e98fe280a6ca74e1cde681e496e,9719015,2025-11-27T23:08:04Z,true | ||
| SustainabilityIndex: Sustainability index updated,Sustainability index updated,ad21997a523e70e805cfa33389c7347f15e1048638b1b72f79914c7d8122a1af,0xa047db6f61b177387f0383dda4b8a05d8d18f26770b7caedeba72c4b522e06e0,9719022,2025-11-27T23:09:40Z,true |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Commands file truncated with unclosed code block
The
commands.mdfile appears truncated—it ends abruptly at line 11 mid-command with an unclosed```bashcode block. The document title promises a workflow checklist covering hash generation, transactions, verification, and screenshots, but only includes the beginning of the first section. This looks like incomplete content that was accidentally committed.