Skip to content

Latest commit

 

History

History
300 lines (203 loc) · 5.7 KB

File metadata and controls

300 lines (203 loc) · 5.7 KB

🏗️ Architecture Deep Dive

Proof‑of‑Contribution Protocol Core

Version: 0.1.0
Status: Public (Alpha)


🎯 Purpose

This document provides a comprehensive, technical deep dive into the architecture of the Proof‑of‑Contribution Protocol Core.
It explains the design philosophy, internal components, data flow, and deterministic guarantees that underpin the protocol.

This is the document for:

  • Integrators
  • Auditors
  • Contributors
  • Governance reviewers
  • Security researchers
  • Ecosystem partners

It is intentionally detailed and explicit.


1. Architectural Philosophy

The protocol is built on four foundational principles:

1.1 Determinism

Every component must produce identical output for identical input.
This is enforced through:

  • Pure functions
  • Stateless validators
  • Integer‑only scoring
  • Canonical JSON
  • Version pinning
  • No external state
1.2 Minimalism

The protocol does only what is essential:

  • Validate events
  • Score events
  • Produce proofs

Everything else — storage, rewards, governance dashboards — is left to integrators.

1.3 Composability

Validators, scoring rules, and proof formats are modular and versioned.
New components can be added without breaking existing behavior.

1.4 Auditability

Every decision is:

  • Transparent
  • Versioned
  • Documented
  • Testable

This makes the protocol suitable for compliance‑driven environments.


2. High‑Level Architecture

mermaid flowchart TD A[Event Intake] --> B[Validation Pipeline] B --> C[Scoring Engine] C --> D[Proof Generator] D --> E[Integrator Layer]

Each component is deterministic, stateless, and versioned.


3. Event Model

Events are the atomic unit of the protocol.

3.1 Canonical Event Structure

json { "eventid": "evt001", "type": "code_commit", "timestamp": "2026-01-27T12:34:56Z", "payload": { "...": "..." }, "metadata": { "...": "..." } }

3.2 Requirements
  • Must pass schema validation
  • Must include a valid timestamp
  • Must include a recognized type
  • Must include a payload appropriate for the type

Events are intentionally simple — complexity lives in validators and scoring rules.


4. Event Intake Layer

The intake layer performs:
  • Schema validation
  • Timestamp sanity checks
  • Basic structural checks

It ensures malformed events never reach the validator pipeline.

4.1 Deterministic Guarantees
  • No external time sources
  • No environment‑dependent behavior
  • No mutation of the event

5. Validation Pipeline

The validation pipeline is a deterministic sequence of stateless validators.

mermaid flowchart LR A[Type Validator] --> B[Payload Validator] B --> C[Replay Validator] C --> D[Rule-Specific Validators]

5.1 Type Validator

Ensures the event type is recognized.

5.2 Payload Validator

Ensures required fields exist and values are valid.

5.3 Replay Validator

Prevents duplicate or regressive events.

5.4 Rule‑Specific Validators

Optional validators tied to specific contribution types.

5.5 Deterministic Guarantees
  • Fixed validator order
  • Pure functions
  • No side effects
  • Deterministic error messages

6. Scoring Engine

The scoring engine assigns integer scores to validated events.

mermaid flowchart LR A[Rule Matcher] --> B[Rule Evaluator] B --> C[Score Aggregator]

6.1 Rule Matcher

Identifies which scoring rules apply to the event.

6.2 Rule Evaluator

Evaluates rule conditions deterministically.

6.3 Score Aggregator

Sums integer scores in a fixed order.

6.4 Deterministic Guarantees
  • No floating‑point math
  • No randomness
  • No external state
  • Fixed rule evaluation order

7. Proof Generator

The proof generator produces the final, verifiable artifact.

7.1 Proof Structure

json { "event": { "...": "..." }, "validated": true, "score": 5, "rulesapplied": ["codecommit_base"], "version": "0.1.0", "signature": null }

7.2 Deterministic Guarantees
  • No nondeterministic fields
  • Version pinned
  • Optional signature must be deterministic

8. Versioning Model

The protocol uses semantic versioning:

  • MAJOR — breaking changes
  • MINOR — new rules/validators
  • PATCH — fixes

Every component is versioned:

  • Protocol
  • Validators
  • Scoring rules
  • Proof format

Version pinning is required for integrators.


9. Cross‑Language Architecture

The protocol is designed for multi‑language implementations:

  • JavaScript
  • Python
  • Rust
  • (Future) Go, on‑chain Solana, etc.
9.1 Requirements
  • Identical fixtures
  • Identical outputs
  • Identical error messages
  • Identical rule evaluation order

This is enforced through the conformance test suite.


10. Security Architecture

Security is enforced through:

  • Replay protection
  • Payload validation
  • Deterministic behavior
  • Version pinning
  • Threat model alignment

A full threat model is provided separately.


11. Integrator Architecture

Integrators are responsible for:

  • Event creation
  • Storage
  • Rewards
  • Dashboards
  • Governance integration

The protocol intentionally does not dictate downstream behavior.


12. Future Extensions

The architecture supports:

  • ZK contribution proofs
  • On‑chain scoring
  • Cross‑ecosystem bridges
  • AI‑assisted classification
  • Reputation decay models

All extensions must preserve determinism.


✔️ Status

This Architecture Deep Dive is now ready for:

  • Documentation site
  • Audit packages
  • Governance RFCs
  • Integrator onboarding
  • Partner presentations