Skip to content

Winner122/standard-pipe

Repository files navigation

Standard Pipe: Secure Document Management Protocol 🔒📄

Overview

Standard Pipe is a blockchain-native document management system built on the Stacks blockchain, providing secure, auditable, and permission-driven document storage and access control.

Key Features

  • 🔐 Permission-based access control
  • 📋 Comprehensive audit logging
  • 🏢 Multi-organization support
  • 🔍 Immutable document references
  • 🚀 Transparent document lifecycle management

Problem Statement

Modern organizations struggle with secure document management, often relying on centralized systems vulnerable to tampering, unauthorized access, and opaque audit trails. Standard Pipe solves these challenges by leveraging blockchain's inherent security and transparency.

Technical Architecture

graph TD
    A[Organization Owner] -->|Register Organization| B[Organization Registry]
    A -->|Upload Document| C[Document Storage]
    C -->|Store| D[Document References]
    C -->|Log| E[Audit Trail]
    A -->|Manage Access| F[Permission System]
    G[Employees/Partners] -->|Access Documents| C
    F -->|Control| G
    C -->|Record| E
Loading

Core Components

  1. Organization Registry: Stores organization information and ownership
  2. Document Storage: Manages document metadata and references
  3. Permission System: Controls access rights
  4. Audit System: Tracks all document interactions

Contract Documentation

Permission Levels

  • PERMISSION-NONE (u0): No access
  • PERMISSION-VIEW (u1): View-only access
  • PERMISSION-EDIT (u2): Can edit documents
  • PERMISSION-ADMIN (u3): Can manage permissions
  • PERMISSION-OWNER (u4): Full control

Action Types

  • ACTION-CREATE (u1): Document creation
  • ACTION-VIEW (u2): Document access
  • ACTION-EDIT (u3): Document modification
  • ACTION-SHARE (u4): Permission changes
  • ACTION-DELETE (u5): Document deletion

Getting Started

Prerequisites

  • Clarinet
  • Stacks wallet
  • Node.js environment

Basic Usage

  1. Register an organization:
(contract-call? .standard-pipe register-organization "org-123" "ACME Corp")
  1. Add a document:
(contract-call? .standard-pipe add-document 
    "org-123" 
    "doc-123" 
    "Contract.pdf" 
    "Service agreement" 
    0x1234... 
    "legal")
  1. Grant access:
(contract-call? .standard-pipe grant-document-permission 
    "org-123" 
    "doc-123" 
    'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM 
    u1)

Function Reference

Organization Management

(register-organization (org-id (string-ascii 64)) (name (string-ascii 256)))

Registers a new organization on the platform.

Document Management

(add-document 
    (org-id (string-ascii 64))
    (document-id (string-ascii 64))
    (name (string-ascii 256))
    (description (string-utf8 500))
    (document-hash (buff 32))
    (document-type (string-ascii 64)))

Adds a new document to the system.

(update-document 
    (org-id (string-ascii 64))
    (document-id (string-ascii 64))
    (name (string-ascii 256))
    (description (string-utf8 500))
    (document-hash (buff 32))
    (document-type (string-ascii 64)))

Updates an existing document.

Access Control

(grant-document-permission 
    (org-id (string-ascii 64))
    (document-id (string-ascii 64))
    (user principal)
    (permission-level uint))

Grants access permissions to a user.

(revoke-document-permission 
    (org-id (string-ascii 64))
    (document-id (string-ascii 64))
    (user principal))

Revokes access permissions from a user.

Development

Testing

  1. Clone the repository
  2. Install dependencies
  3. Run tests:
clarinet test

Local Development

  1. Start Clarinet console:
clarinet console
  1. Deploy contract:
clarinet deploy

Security Considerations

Access Control

  • Only organization owners can register new documents
  • Permission levels are strictly enforced
  • All access attempts are logged
  • Document owners have full control

Data Privacy

  • Only document references are stored on-chain
  • Actual documents should be stored off-chain in encrypted form
  • Access control is managed through permission levels
  • Audit trail maintains accountability

Limitations

  • Document hashes must be managed securely off-chain
  • Permission changes require admin access
  • No document content encryption on-chain
  • Limited to 64-character organization and document IDs

Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a new Pull Request

License

MIT License

Contact

Standard Pipe Team - [your-contact@example.com]

About

no description

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors