DecentraSign - Blockchain-Powered Smart Contract Platform

Inspiration

Traditional e-signature platforms like DocuSign face critical limitations: they're centralized, prone to manipulation, lack transparency, and charge hefty fees. We envisioned a future where contracts are immutable, verifiable, and truly decentralized.

The inspiration struck when we realized that blockchain technology could solve these pain points elegantly. By combining the Sui blockchain's speed and efficiency with AI-powered document parsing, we could create a platform that not only matches traditional e-signature tools but surpasses them with:

  • Immutable records that can't be altered after signing
  • Transparent verification on a public blockchain
  • Zero intermediaries - no company controlling your contracts
  • Smart contract automation - payments and conditions execute automatically

DecentraSign represents the convergence of legal tech and Web3, making blockchain accessible to everyday users who just want to sign a contract.

What it does

DecentraSign transforms traditional PDF contracts into executable smart contracts on the Sui blockchain with a seamless, intuitive workflow:

Core Features

  1. 🤖 AI-Powered Contract Parsing

    • Upload any PDF contract
    • AI extracts key terms: parties, payments, deadlines, penalties
    • Supports two parsing modes: AI (flexible) and Template (structured)
    • Identifies ambiguous terms that need clarification
  2. ✍️ Flexible Signature Options

    • Draw directly on PDF: Natural pen tool with customizable color and size
    • Type signature: Human-like handwriting fonts for typed names
    • Multi-page support with transparent signatures
    • Real-time signature placement and editing
  3. ⚡ Sui Blockchain Integration

    • Generates Move smart contracts from extracted terms
    • Deploys contracts to Sui blockchain
    • Immutable storage using Walrus for document permanence
    • zkLogin via Enoki for seamless authentication
  4. 📋 Interactive Review & Editing

    • Edit extracted contract terms before blockchain deployment
    • Add Sui wallet addresses for all parties
    • Real-time validation and error checking
    • Beautiful, warm terracotta-themed UI
  5. 🔗 Smart Contract Execution

    • Automatic milestone tracking
    • Conditional payment releases
    • Deadline enforcement with penalties
    • Multi-party signature workflows

How we built it

Frontend Architecture

Tech Stack:

  • React 18 with Vite for fast development
  • Framer Motion for fluid animations and interactions
  • react-pdf for PDF rendering and manipulation
  • React Router for seamless navigation
  • Custom Canvas API for signature drawing with transparent backgrounds

Key Components:

src/
├── pages/
│   ├── Landing.jsx          # Hero page with animated features
│   ├── Upload.jsx            # PDF upload and signature interface
│   ├── Review.jsx            # Contract term editing
│   ├── Dashboard.jsx         # User contract management
│   └── Sign.jsx              # Multi-party signing workflow
├── components/
│   ├── PDFWithSignature.jsx  # Direct PDF drawing component
│   ├── SignatureWizard.jsx   # Onboarding flow
│   └── DocumentViewer.jsx    # Contract preview
└── styles/
    ├── App.css               # Global blockchain-inspired design
    └── Review.css            # Warm terracotta aesthetic

Backend Infrastructure

Python Flask API:

  • Contract parsing endpoint (/api/parse-contract)
  • Two parsing engines:
    • AI Parser: Claude API for flexible document understanding
    • Template Parser: Fixed OCR for standardized contracts
  • Extracts: parties, payments, deadlines, penalties, ambiguous terms

Data Flow:

PDF Upload → Flask Backend → AI/Template Parser →
Structured JSON → Frontend Review → Sui Smart Contract Generation →
Blockchain Deployment → Walrus Storage

Blockchain Integration (Sui)

Move Smart Contracts:

  • Custom contract modules in Move language
  • Milestone-based payment logic
  • Multi-signature validation
  • Automated penalty enforcement

Sui Services Used:

  • Sui Blockchain: Fast, low-cost contract deployment
  • Walrus: Decentralized document storage (immutable PDF archives)
  • Enoki: zkLogin for wallet-less authentication
  • dApp Kit: React SDK for wallet connections

Smart Contract Structure:

module decentrasign::contract {
    struct Contract has key {
        id: UID,
        parties: vector<address>,
        amount: u64,
        deadline: u64,
        status: u8,
        signatures: vector<Signature>
    }

    public entry fun sign_contract(contract: &mut Contract, ctx: &mut TxContext)
    public entry fun release_payment(contract: &mut Contract, ctx: &mut TxContext)
}

Signature System

We built a sophisticated multi-modal signature system:

  1. Canvas-based drawing with signature_pad library
  2. Transparent PNG export for professional appearance
  3. Direct PDF annotation using HTML5 Canvas overlay
  4. Typed signatures with cursive fonts (Brush Script MT)
  5. Drag-and-drop positioning with Framer Motion
  6. Per-page signature tracking for multi-page documents

Design Philosophy

We chose a warm, trustworthy aesthetic to make blockchain feel approachable:

  • Terracotta and gold color palette (vs. typical crypto blue)
  • Serif fonts (Fraunces) for legal gravitas
  • Smooth animations to reduce anxiety around "blockchain complexity"
  • Clear visual hierarchy and generous whitespace

Challenges we ran into

1. PDF Text Layer Interference

Problem: When users tried to draw signatures, they were selecting text instead.

Solution:

  • Conditionally disabled text/annotation layers when pen is active
  • Added userSelect: 'none' to prevent highlighting
  • Implemented e.preventDefault() on mouse events
  • Set pointerEvents: 'none' on PDF layer during drawing
<div style={{ pointerEvents: penEnabled ? 'none' : 'auto' }}>
  <Page renderTextLayer={!penEnabled} />
</div>
<canvas
  onMouseDown={e => { e.preventDefault(); startDrawing(e); }}
  style={{ pointerEvents: penEnabled ? 'auto' : 'none' }}
/>

2. AI Contract Parsing Accuracy 🤖

Problem: Generic AI models struggled with legal jargon and contract structure.

Solution:

  • Crafted specialized prompts with legal terminology
  • Implemented dual-mode parsing (AI + Template)
  • Added "ambiguous terms" detection
  • Structured output validation with JSON schema

3. Signature Transparency 🎨

Problem: Signatures had white backgrounds, looking unprofessional on PDFs.

Solution:

  • Used backgroundColor: 'rgba(255, 255, 255, 0)' in SignaturePad
  • Exported as PNG with full alpha channel
  • Applied CSS filter: drop-shadow() for visibility
  • Removed all hardcoded background colors

4. Sui Blockchain Learning Curve ⛓️

Problem: Move language and Sui concepts were entirely new to the team.

Solution:

  • Built MCP (Model Context Protocol) documentation server
  • Indexed 300+ pages from Sui docs, Move book, Walrus, Enoki
  • Created local SQLite database with full-text search
  • Used Claude to query documentation in real-time

5. Multi-Page PDF Rendering 📄

Problem: Initially showed only one page, users couldn't sign all pages.

Solution:

{Array.from(new Array(numPages), (el, index) => (
  <div key={`page_${index + 1}`}>
    <Page pageNumber={index + 1} />
    <canvas ref={el => canvasRefs.current[index + 1] = el} />
  </div>
))}

6. Signature Placement UX 🎯

Problem: Dragging signatures felt clunky and imprecise.

Solution:

  • Switched to direct drawing on PDF
  • Added typed signature option with handwriting fonts
  • Implemented page-specific signature tracking
  • Added visual feedback with dashed borders

Accomplishments that we're proud of

🎨 Beautiful, Intuitive UI

We created a design that makes blockchain feel warm and approachable, not intimidating. The terracotta color scheme and smooth animations set us apart from typical "crypto blue" applications.

🤖 AI That Actually Works

Our contract parser successfully extracts complex terms from real legal documents, not just demos. It handles ambiguity gracefully and provides structured output ready for blockchain deployment.

Seamless Sui Integration

Despite Sui being new to us, we successfully:

  • Wrote Move smart contracts
  • Integrated Walrus for storage
  • Implemented Enoki zkLogin
  • Connected wallet providers via dApp Kit

✍️ Revolutionary Signature System

Our dual-mode signature approach (draw + type) with transparent backgrounds and direct PDF annotation is more flexible than traditional e-signature tools.

📚 MCP Documentation Server

We built a local documentation server that indexed 300+ pages of Sui ecosystem docs, making development significantly faster.

🚀 Full-Stack Blockchain App

From PDF upload to blockchain deployment, we built a complete end-to-end application in 48 hours.

What we learned

Blockchain Development

  • Move language syntax and paradigms
  • Sui's object model and how it differs from Ethereum
  • Smart contract security considerations (reentrancy, overflow)
  • Gas optimization techniques for Sui transactions

Frontend Engineering

  • Canvas API mastery for signature drawing and PDF annotation
  • Event handling complexity (preventing text selection, mouse event capture)
  • State management for multi-step workflows
  • Animation performance with Framer Motion

AI Integration

  • Prompt engineering for legal document parsing
  • Structured output generation with Claude
  • Error handling for AI unpredictability
  • Hybrid AI/template approaches for reliability

UX/UI Design

  • Progressive disclosure to reduce cognitive load
  • Animation as communication (not just decoration)
  • Color psychology for trust and warmth
  • Accessibility in blockchain applications

Backend Architecture

  • Flask API design for ML integration
  • CORS handling for local development
  • File upload processing at scale
  • Error propagation from AI to frontend

Web3 Ecosystem

  • Wallet integration patterns (Sui Wallet, zkLogin)
  • Decentralized storage with Walrus
  • On-chain vs off-chain data tradeoffs
  • Transaction signing UX flows

What's next for DecentraSign

Short-term (Next 3 Months)

  1. 🔐 Enhanced Security

    • Multi-signature requirements for high-value contracts
    • Time-locked signatures (must sign by deadline)
    • Revocation mechanisms for unsigned contracts
  2. 📱 Mobile App

    • React Native port for iOS/Android
    • Touch-optimized signature drawing
    • Push notifications for signature requests
  3. 🌐 Multi-Chain Support

    • Ethereum/Polygon integration for EVM contracts
    • Cross-chain contract verification
    • Bridge contracts for multi-chain enforcement
  4. 📊 Analytics Dashboard

    • Contract status tracking
    • Payment milestone visualization
    • Time-to-signature metrics

Mid-term (6-12 Months)

  1. 🤝 Enterprise Features

    • Organization accounts with role-based access
    • Template libraries for common contracts
    • Bulk contract deployment
    • API access for integrations
  2. ⚖️ Legal Compliance

    • eIDAS compliance (EU electronic signatures)
    • ESIGN Act validation (US)
    • Audit trails and evidence packages
    • Court-admissible blockchain proofs
  3. 🎓 Smart Contract Templates

    • Pre-built modules: NDAs, employment agreements, leases
    • Industry-specific contract libraries (real estate, freelance, M&A)
    • Community-contributed templates marketplace
  4. 🔍 Advanced AI Features

    • Contract risk analysis and flagging
    • Clause recommendation engine
    • Automatic contract comparison (v1 vs v2)
    • Natural language contract generation

Long-term (1+ Years)

  1. 🌍 Decentralized Dispute Resolution

    • On-chain arbitration protocols
    • Community jury systems
    • Escrow integration for contested payments
    • Kleros integration for decentralized justice
  2. 💰 DeFi Integration

    • Contract-backed loans (use signed contracts as collateral)
    • Automatic payment streaming (Superfluid)
    • Stablecoin-denominated contracts
    • Insurance protocols for contract breaches
  3. 🤖 AI Negotiation Agents

    • Autonomous contract negotiation bots
    • Optimal term suggestion based on historical data
    • Real-time contract redlining
    • Multi-party negotiation orchestration
  4. 🔗 Interoperability Layer

    • Traditional e-signature import (DocuSign, Adobe Sign)
    • Legacy system API bridges
    • Hybrid on-chain/off-chain contracts
    • Government registry integrations

Vision: The Future of Contracts

We envision a world where:

  • Every contract is verifiable on-chain in seconds
  • Smart contracts self-execute without lawyers or courts
  • AI negotiators handle routine agreements
  • Decentralized arbitration resolves disputes fairly
  • Anyone, anywhere can enforce agreements without intermediaries

DecentraSign is the first step toward trustless, transparent, and accessible legal agreements for everyone.


Technical Metrics

  • Lines of Code: ~15,000
  • Components: 25+ React components
  • API Endpoints: 5 backend routes
  • Smart Contracts: 3 Move modules
  • Documentation Indexed: 300+ pages
  • Supported File Types: PDF, DOC, DOCX
  • Blockchain: Sui Testnet
  • Storage: Walrus decentralized storage

Try It Out

  1. Upload a PDF contract
  2. Sign with our intuitive draw/type tools
  3. Review AI-extracted terms
  4. Deploy to Sui blockchain
  5. Share with other parties for co-signing

DecentraSign: Where Web2 contracts meet Web3 trust.


Built with ❤️ at CalHacks 2025

Built With

Share this project:

Updates