🎯 Your Digital Documents, Now With Blockchain-Backed Proof
Imagine this: You sign an important contract today. Six months later, the other party claims it never existed. How do you prove them wrong? With DocumentSignStorage, you can prove a document existed at a specific timestamp — without ever revealing its content.

Technical subtitle: Keccak-256 hashing and EIP-712 signatures on-chain for tamper-proof document timestamping
📊 The Problem: Trusting Intermediaries to Prove Existence
Currently, proving that a document existed at a specific time requires trusting a third party:
| Current Approach | Weakness |
|---|---|
| Notary public | Expensive, slow, centralized |
| Email with attachment | Anyone can change the date |
| Cloud storage | Provider can alter timestamps |
| Internal databases | Admin can modify records |
The fundamental question: How do you create a timestamp that no one can manipulate — including you?
flowchart LR
subgraph Current System
A[Document] --> B[Trusted Third Party]
B --> C[Timestamp]
C --> D[Can Be Manipulated]
end
subgraph Blockchain Solution
E[Document] --> F[Keccak-256 Hash]
F --> G[EIP-712 Signature]
G --> H[On-Chain Registry]
H --> I[Immutable Timestamp]
end
style D fill:#ffcccc,stroke:#ff0000
style I fill:#ccffcc,stroke:#00aa00💡 The Solution: Cryptography as a Notary
DocumentSignStorage replaces the human notary with mathematics. The system works in 4 steps:
- Upload any file — it stays in your browser, never touches the blockchain
- Calculate its Keccak-256 hash — the document's unique "digital fingerprint"
- Sign that hash with your wallet using EIP-712 — proving you controlled it
- Register the signature on-chain — immutable timestamp on Ethereum
The Magic: Hashes Are Unique
Every document produces a completely unique hash. Change a single comma, a single character, and the hash changes entirely:
This means: ** anyone can later prove a specific document matches the hash on-chain** — without the blockchain ever storing the document itself.
🔧 Implementation: Smart Contract Architecture
The Document Structure
Why EIP-712 Matters
EIP-712 is an Ethereum standard for typed structured data signatures. Unlike a plain message signature, EIP-712 includes:
- The application domain (contract name, version, chainId)
- The typed structure of what's being signed
This prevents cross-domain replay attacks — where a signature from one dApp could be maliciously reused on another.
When you sign with EIP-712 in MetaMask, you see readable structured data:
Key Repository Files
contracts/DocumentSignStorage.sol— Main contract with EIP-712 implementationcontracts/DocumentSignStorageEIP712.sol— EIP-712 domain and typed structtest/DocumentSignStorage.test.ts— Foundry testsfrontend/src/— Next.js interface
💻 Frontend: Secure Browser-Side Processing
Technology Stack
| Layer | Technologies |
|---|---|
| Smart Contracts | Solidity 0.8.19, OpenZeppelin, EIP-712 |
| Testing | Foundry (Forge + Anvil), forge test |
| Frontend | Next.js 15, React 19, TypeScript |
| Web3 | Ethers.js v6 |
| Validation | Zod schemas |
| Styling | TailwindCSS |
| Tests | Jest + Testing Library |
User Flow
flowchart TD
A[📄 User uploads file] --> B[🔐 Browser generates<br/>Keccak-256 hash]
B --> C[🦊 User signs with<br/>MetaMask EIP-712]
C --> D[📤 Frontend sends<br/>hash + signature]
D --> E[⛓️ Contract registers]
E --> F[📋 DocumentRegistered event]
F --> G[✅ Anyone can verify]
style A fill:#fff3e0,stroke:#ffa000
style C fill:#e0f7ff,stroke:#00f2ff
style E fill:#1a1a2e,stroke:#00f2ff,color:#fff
style G fill:#ccffcc,stroke:#00aa00Critical Design Decision: The File Never Reaches the Blockchain
Uploading files on-chain costs hundreds of dollars in gas per megabyte. The solution: only the hash goes on-chain.
📈 Real-World Applications
This technology enables:
| Use Case | Benefit |
|---|---|
| Digital notary | Prove document existence without storing it |
| Academic credentials | Certify degrees without exposing student data |
| Intellectual property | Timestamp creative work with cryptographic proof |
| Legal evidence | Prove documents existed before a dispute |
| Corporate records | Immutable audit trail for contracts and invoices |
🤔 Why This Matters
Privacy + Immutability = Trust
Traditional systems force you to choose: either you store the document publicly (transparent but no privacy) or privately (private but no proof). DocumentSignStorage gives you both — the hash proves existence without revealing content.
This is the foundation for a decentralized digital notary that:
- Costs fractions of a cent vs. $100+ for a traditional notary
- Works 24/7 without appointments
- Is globally verifiable by anyone
- Can never be manipulated retroactively
✅ Lessons Learned
- EIP-712 UX is superior: Users understand what they're signing when they see structured data instead of "0x..." strings
- Hash-only storage is essential: Uploading files on-chain is prohibitively expensive; hashes solve this elegantly
- Foundry testing is fast:
forge testruns in seconds compared to minutes with Hardhat
📊 Metrics: Document Timestamping Performance
| Metric | Value | Description |
|---|---|---|
| Hash Algorithm | Keccak-256 | Ethereum native, 32-byte output |
| On-Chain Storage Cost | ~$0.005 per hash | Gas-optimized single storage slot |
| Confirmation Time | ~15 sec | Ethereum block time |
| Signature Type | EIP-712 | Structured data signing |
| Documents Tested | 50+ | Unit and integration tests |
| False Positive Rate | 0% | Collision resistance verified |
🔗 Continuous Learning
- EIP-712: Typed Structured Data Signing - The standard that makes blockchain signatures readable and secure
- Solidity Documentation - Bytes - Understanding hash storage on-chain
- Foundry Testing Guide - Fast smart contract testing with Forge
- IPFS for Document Storage - Decentralized file storage to complement on-chain hashes
- Digital Signature Best Practices - NIST - Technical guidance on randomness and cryptographic strength
💬 Want to Contribute?
This project shows how blockchain can solve document authenticity without sacrificing privacy. Contribute:
| Contribution Type | Description | Link |
|---|---|---|
| Pull Request | Add new features or improve EIP-712 schemas | github.com/87maxi/documentSignStorage |
| Issues | Report bugs or UX improvements | Issues · documentSignStorage |
| Discussions | Share your document signing use case | Discussions · documentSignStorage |
| Fork | Adapt for your organization's needs | Fork Repository |
Call to Action: Do you work with digital documents that need tamper-proof verification? Share your use case or contribute to the project.
🔗 Related Articles
| Article | Category | Link |
|---|---|---|
| Supply Chain Tracker | Web3 / Traceability | RBAC on-chain with Solidity |
| Euro Stablecoin E-Commerce | Web3 / Payments | EURT token payments |
| Ethereum → Solana Migration | Web3 / Migration | EVM to Sealevel architecture |
| RWA Security & Governance | RWA / Security | Agent-based access control |
🔗 Explore the Code
Full source code: github.com/87maxi/documentSignStorage
Try it: Clone the repo, run
anvilfor a local blockchain, and register your first document. The frontend connects to MetaMask and signs using EIP-712 — you'll see the structured signature dialog in action.
Project from the Blockchain and Web3 Master — CodeCrypto Academy