๐ SDGE eManual
Complete reference for the Sovereign Document Governance Engine โ ingestion, verification, workflows, and API.
๐๏ธ Overview
SDGE (Sovereign Document Governance Engine) is an append-only, hash-chained document ledger designed for Indian Government document governance. It provides tamper-evident storage, ZK receipts, fraud scoring, and a GraphQL-first API for 15 governance domains.
Key properties:
- Append-only โ documents are never modified or deleted once committed
- SHA-256 chained โ each block links to the previous block's hash (like a blockchain)
- Domain-scoped โ all 15 departments have isolated namespaces with domain-specific metadata
- Actor-authenticated โ every ingest is attributed to a verified government actor
- Fraud-scored โ every document receives a fraud risk score (0โ100) on ingest
๐ Quick Start
- Go to /login and select your department actor (all demo actors use PIN
1234) - After login, visit /wizard โ the 5-step guided document ingest tool
- Select your domain, fill document metadata, paste content, review, and confirm
- Your document is hashed, assigned a ledger sequence number, and a ZK receipt is issued
- Verify any document at any time via the /dashboard โ Document Lookup tab
1234. Production deployment uses UIDAI-linked biometric or eSign-based authentication.
๐ก Core Concepts
Document
A sovereign document is any government-issued record: certificate, order, filing, report, or sensor reading. Each document has a unique docId (UUID), a SHA-256 contentHash, a domain, an actorId, and an ingestTime.
Ledger Entry
When a document is ingested, a ledger entry is created with a monotonically increasing ledgerSeq. Each entry stores the hash of its content plus the prevHash of the prior entry, forming an unbreakable chain.
Fraud Score
Every document is scored 0โ100 at ingest time by the SDGE fraud engine. Score interpretation:
- 0โ29 โ Low risk (green) โ routine document
- 30โ59 โ Medium risk (yellow) โ review recommended
- 60โ79 โ High risk (orange) โ manual verification required
- 80โ100 โ Critical (red) โ flagged for fraud investigation
๐ค Actor Roles
Every SDGE operation is performed by an actor โ an authenticated government officer. Actors are scoped to their department's domain.
| Actor ID | Name | Domain |
|---|---|---|
actor-land-reg-01 | Land Registry | LAND |
actor-hospital-01 | Civil Hospital | HEALTH |
actor-agri-dept-01 | Agriculture Dept | AGRICULTURE |
actor-gem-01 | GeM Procurement | PROCUREMENT |
actor-cbse-01 | CBSE | EDUCATION |
actor-gst-01 | GST / Supply | SUPPLY_CHAIN |
actor-fcs-01 | FCS / PDS | SUPPLY_CHAIN (PDS) |
actor-discom-01 | DISCOM / IoT | IOT |
actor-gst-dept-01 | Tax Dept (GST) | TAXATION |
actor-uidai-01 | UIDAI / Identity | IDENTITY |
actor-court-01 | District Court | JUDICIARY |
actor-mcd-01 | Municipal Corp | URBAN_LOCAL |
actor-sbi-01 | Bank / Finance | FINANCE |
actor-epfo-01 | EPFO / Labour | LABOUR |
actor-rto-dl-01 | RTO / Transport | TRANSPORT |
๐ Authentication
SDGE uses actor-based PIN authentication in this demo. The session is stored in browser localStorage as sdge_actor โ a JSON object with id, name, role, domain, and icon.
The ingest console on the Dashboard checks for this session. If absent, the ingest form is hidden. The wizard also pre-fills the Actor ID from this session.
๐๏ธ Sessions
Sessions are browser-local and persist until explicitly cleared. To log out, the session is removed from localStorage. If you clear your browser storage, you will be logged out and redirected to /login.
๐๏ธ All 15 Governance Domains
SDGE covers all major Indian government document domains. Each domain has its own namespace, auto-classification patterns, and domain-specific metadata fields.
๐ค Auto-Classification
When you select "Auto-detect domain" in the Wizard or via the GraphQL mutation, SDGE scans the document content for domain-specific signals:
| Domain | Signals (regex patterns) |
|---|---|
| LAND | khasra, khatauni, mutation, registry, e-nakal |
| HEALTH | opd, prescription, patient, discharge, abha |
| AGRICULTURE | msp, kisan, fasal, pm-kisan, crop insurance |
| PROCUREMENT | gem, tender, purchase order, bid, procurement |
| EDUCATION | cbse, marksheet, result, admit card, roll number |
| TAXATION | gstin, gstr, tax invoice, pan, income tax |
| IDENTITY | aadhaar, uid, voter id, digilocker |
| JUDICIARY | fir, court order, judgement, summons, case no |
| TRANSPORT | driving licence, dl no, rc book, vehicle registration |
If no patterns match, the document is classified as UNKNOWN. You can always override the auto-detected domain by selecting one manually.
๐ฅ Ingest Guide
There are three ways to ingest a document:
1. Dashboard Ingest Form
On /dashboard, switch to the Ingest Document tab. You must be logged in. Fill the form and submit โ the ledger entry is shown inline.
2. Wizard (Recommended)
The /wizard provides a guided 5-step flow with per-domain metadata fields, auto-detect, a review step, and a formatted ZK receipt on completion. Best for manual document entry.
3. GraphQL Mutation
For programmatic ingest (integrations, batch scripts, workflow automations):
๐ง Using the Wizard
The wizard at /wizard walks you through 5 steps:
- Select Domain โ Choose from 15 domain tiles. Each has an icon, name, and document count badge.
- Document Details โ Enter filename, verify your actor ID (pre-filled from session), and fill domain-specific fields (e.g., GSTIN for TAXATION, Case No. for JUDICIARY).
- Paste Content โ Enter the document text. Optionally enable Auto-detect domain to re-classify based on content.
- Review โ A summary panel shows all fields before commit. Confirm or go back to edit.
- Receipt โ After successful ingest, a formatted ZK receipt is displayed with
docId,ledgerSeq,contentHash, fraud score, and a sharable receipt ID.
๐ฆ Bulk Ingest
For batch ingestion, use the /workflows automation page. Each workflow can ingest multiple documents in a single run. Alternatively, use the GraphQL mutation in a loop from your backend service.
๐ Sovereign Ledger
The SDGE ledger is an in-memory, append-only chain. Each entry has:
| Field | Type | Description |
|---|---|---|
ledgerSeq | number | Monotonically increasing sequence number |
docId | UUID | Unique document identifier |
contentHash | SHA-256 hex | Hash of filename+actorId+domain+content |
prevHash | SHA-256 hex | Hash of the previous ledger entry |
ingestTime | ISO timestamp | UTC timestamp of ingest |
fraudScore | 0โ100 | Fraud risk score at ingest time |
zkReceiptId | UUID | Zero-knowledge proof receipt identifier |
โ Chain Verification
Use the Verify Chain tab on the Dashboard to check the integrity of any document or the entire chain:
๐ ZK Receipts
Every successful ingest issues a Zero-Knowledge Receipt โ a UUID that can be shared publicly to prove a document was committed to the chain at a specific time, without revealing the document content itself.
The ZK receipt ID is derived from the contentHash and ledgerSeq. It can be verified by anyone with access to the SDGE API:
๐ GraphQL Schema
All SDGE operations are exposed via a single GraphQL endpoint: POST https://sdge.ankrlabs.org/graphql
๐ Queries
| Query | Auth | Description |
|---|---|---|
sdgeStats | Public | totalDocs, ledgerSeq, chainHealth, onlineSince |
sdgeLookupDoc(docId) | Public | Fetch document by docId |
sdgeListDocs(domain?, limit, offset) | Actor | List documents, optionally filtered by domain |
sdgeVerifyChain | Public | Verify full chain integrity |
sdgeDomainStats | Public | Per-domain document counts |
sdgeLookupReceipt(receiptId) | Public | Verify a ZK receipt |
โ๏ธ Mutations
| Mutation | Auth | Description |
|---|---|---|
sdgeIngestDocument(input) | Actor | Ingest a document โ returns full ledger entry with ZK receipt |
Input fields for sdgeIngestDocument
| Field | Required | Description |
|---|---|---|
filename | โ | Original filename of the document |
actorId | โ | Authenticated actor ID (e.g. actor-land-reg-01) |
domain | โ | DocumentDomain enum value |
content | โ | Full text content of the document to be hashed and stored |
โ๏ธ Automation Guide
The /workflows page provides 11 pre-built automation workflows across 4 categories:
- Ingest Automations โ Bulk, scheduled pulls from source APIs (LRC, GSTN, NHA, GeM)
- Verification & Audit โ Chain integrity scan, fraud pipeline, identity dedup, IoT sweep
- Reporting & Export โ Daily digest, court approval flow, municipal consolidation
Each workflow can be triggered on-demand, scheduled (hourly/daily/weekly), or chained. Schedule state is stored in the session and persists in localStorage.
@ankr/workflow-engine package โ a cron-backed orchestrator with webhook triggers, retry logic, and audit log persistence.
๐ต๏ธ Fraud Detection
The SDGE fraud scoring engine runs on every ingest. It evaluates several signals:
- Content entropy โ random or garbled content scores higher
- Actor domain mismatch โ a HEALTH actor ingesting LAND documents is flagged
- Duplicate content hash โ exact duplicates score 100 (blocked)
- Known fraud patterns โ regex matches for forged Aadhaar numbers, fake GSTINs
- Temporal anomalies โ document dated in the future or >10 years old
To run a full fraud investigation across all high-risk documents, use the Fraud Investigation Pipeline workflow.