Skip to content

Commit 06d7c90

Browse files
ameetdeshclaude
andcommitted
Add P2P trading examples, implementation guides, and enrollment specs
- P2P Trading implementation guide (revised) with notes on allocation/settlement and payment - Onboarding implementation guide for digital energy programs - Example JSONs for P2P trading flows (discover, select, init, confirm, status) - Example JSONs for P2P trading interdiscom flows (including cascaded, curtailment, settlement) - Example JSONs for enrollment flows (OAuth2, OTP, prosumer/consumer variants) - EV charging examples reorganized under examples/ev-charging/ - Energy credential VC examples (consumption, generation, storage profiles) - Updated schema validation and Postman collection generation scripts - Removed old examples/v2/P2P_Trading/ (superseded by new structure) - Removed taxonomy.md (content integrated into implementation guide) Part of PR #160 decomposition — Examples & Implementation Guides Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 686ef47 commit 06d7c90

109 files changed

Lines changed: 18730 additions & 2792 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/Onboarding_Users_in_Digital_Energy_Programs.md

Lines changed: 464 additions & 0 deletions
Large diffs are not rendered by default.

docs/implementation-guides/v2/EV_Charging/EV_Charging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ Specifically, for EV Charging, please use the following configuration:
303303

304304
### 11.2.3. 10.2.3 Performing a test EV charging transaction
305305

306-
Step 1 : Download the postman collection, from [here](/testnet/postman-collections/v2/EV_Charging/).
306+
Step 1 : Download the postman collection, from [here](/testnet/ev-charging-devkit/postman/).
307307

308308
Step 2 : Run API calls
309309

docs/implementation-guides/v2/Onboarding/IG_Onboarding_users_in_digital_energy_programs.md

Lines changed: 2775 additions & 0 deletions
Large diffs are not rendered by default.

docs/implementation-guides/v2/P2P_Trading/P2P_Trading_implementation_guide_DRAFT.md

Lines changed: 2343 additions & 1397 deletions
Large diffs are not rendered by default.

docs/implementation-guides/v2/P2P_Trading/note-on-allocation-settlement-logic.md

Lines changed: 1275 additions & 0 deletions
Large diffs are not rendered by default.

docs/implementation-guides/v2/P2P_Trading/note-on-payment-in-p2p-trading-interdiscom.md

Lines changed: 1487 additions & 0 deletions
Large diffs are not rendered by default.

docs/implementation-guides/v2/P2P_Trading/taxonomy.md

Lines changed: 0 additions & 253 deletions
This file was deleted.

examples/enrollment/v2/README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Enrollment Examples
2+
3+
This directory contains JSON examples for the enrollment/onboarding flow for Digital Energy Programs.
4+
5+
## Files
6+
7+
### Init Requests
8+
- **init-request-simple-consumer.json** - Simple consumer with single meter enrolling in a demand flexibility program
9+
- **init-request-prosumer-solar-battery.json** - Prosumer with solar and battery DERs enrolling in a P2P trading program
10+
11+
### On_Init Responses
12+
- **on-init-response-success.json** - Successful credential verification with no conflicts
13+
- **on-init-response-conflict.json** - Enrollment conflict detected (meter already enrolled)
14+
- **on-init-response-error.json** - Credential verification failed
15+
16+
### Confirm Request
17+
- **confirm-request.json** - Confirm request with enrollment start and end dates
18+
19+
### On_Confirm Response
20+
- **on-confirm-response-success.json** - Successful enrollment with issued credential
21+
22+
### Update Requests (Revocation/Unenrollment)
23+
- **update-request-consent-revocation.json** - Request to revoke a consent credential
24+
- **update-request-unenrollment.json** - Request to unenroll from a program
25+
26+
### On_Update Responses
27+
- **on-update-response-consent-revocation.json** - Confirmation of consent revocation with status list details
28+
- **on-update-response-unenrollment.json** - Confirmation of unenrollment with all credential revocations
29+
30+
## Usage
31+
32+
These examples are embedded in the implementation guide using the `embed_example_json.py` script. The examples are referenced using `<details>` blocks in the markdown file.
33+
34+
To update the embedded examples in the guide, run:
35+
```bash
36+
python3 scripts/embed_example_json.py docs/implementation-guides/v2/Onboarding/IG_Onboarding_users_in_digital_energy_programs.md
37+
```
38+
39+
## Schema
40+
41+
All examples use the `EnergyEnrollment` schema defined at:
42+
- Context: `https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld`
43+
- Attributes: `../protocol-specifications-new/schema/EnergyEnrollment/v0.2/attributes.yaml`
44+
45+
## Revocation Mechanism
46+
47+
Consent and enrollment credentials use W3C VC Status Lists (BitstringStatusList) for revocation:
48+
49+
1. **Consent Revocation**: User revokes consent via `update` action → BPP updates status list → Future verifications fail
50+
2. **Unenrollment**: User unenrolls via `update` action → BPP revokes enrollment VC and all consent VCs → All credentials added to status lists
51+
52+
Verifiers must check status lists before accepting credentials. Status lists use bitstrings for efficient and privacy-preserving revocation checks as per [W3C VC Data Model v2.0](https://www.w3.org/TR/vc-data-model-2.0/).
53+
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"context": {
3+
"version": "2.0.0",
4+
"action": "confirm",
5+
"domain": "beckn.one:deg:p2p-enrollment:2.0.0",
6+
"timestamp": "2024-10-15T10:35:00Z",
7+
"message_id": "msg-confirm-oauth2-001",
8+
"transaction_id": "txn-onboard-oauth2-001",
9+
"bap_id": "utility-portal.example.com",
10+
"bap_uri": "https://utility-portal.example.com/beckn",
11+
"bpp_id": "vpp-program-owner.example.com",
12+
"bpp_uri": "https://vpp-program-owner.example.com/beckn",
13+
"ttl": "PT30S"
14+
},
15+
"message": {
16+
"order": {
17+
"@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld",
18+
"@type": "beckn:Order",
19+
"beckn:id": "order-onboard-oauth2-001",
20+
"beckn:orderStatus": "PENDING",
21+
"beckn:seller": "vpp-program-flex-001",
22+
"beckn:buyer": {
23+
"@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld",
24+
"@type": "beckn:Buyer",
25+
"beckn:id": "user-12345"
26+
},
27+
"beckn:orderItems": [
28+
{
29+
"beckn:orderedItem": "program-p2p-trading-001"
30+
}
31+
],
32+
"beckn:fulfillment": {
33+
"@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld",
34+
"@type": "beckn:Fulfillment",
35+
"beckn:id": "fulfillment-onboard-001",
36+
"beckn:mode": "DIGITAL",
37+
"beckn:fulfillmentStatus": "PENDING"
38+
},
39+
"beckn:orderAttributes": {
40+
"@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld",
41+
"@type": "EnergyEnrollment",
42+
"userAuth": {
43+
"authMethod": "OIDC",
44+
"accessToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyLTEyMzQ1IiwiYXVkIjoicHJvZ3JhbS1vd25lci1icHAiLCJpc3MiOiJodHRwczovL3V0aWxpdHktaWRwLmV4YW1wbGUuY29tIiwiaWF0IjoxNzI5MDAwMDAwLCJleHAiOjE3MjkwMDM2MDB9.signature"
45+
},
46+
"meters": [
47+
{
48+
"meterId": "umid-001",
49+
"meterNumber": "MTR-987654321",
50+
"connectionType": "residential"
51+
}
52+
],
53+
"startDate": "2024-11-01T00:00:00Z",
54+
"endDate": "2025-10-31T23:59:59Z"
55+
}
56+
}
57+
}
58+
}

0 commit comments

Comments
 (0)