A blockchain-based document verification system built with Next.js and Solana. This application allows you to generate cryptographic hashes of documents and store them immutably on the Solana blockchain for future verification.
Watch the full coding session where this project was built from scratch:
- π€ Document Upload: Drag-and-drop or browse to upload documents (PDF, PNG, JPG, DOCX)
- π SHA-256 Hashing: Generates cryptographically secure hashes of your documents
- βοΈ Blockchain Storage: Stores document hashes on Solana for immutable record-keeping
- β Document Verification: Verify document authenticity against blockchain records
- π¨ Modern UI: Beautiful, responsive interface built with Tailwind CSS
- β‘ Real-time Feedback: Loading states, success/error messages, and visual feedback
- Educational Credentials: Verify authenticity of degrees and certificates
- Legal Documents: Ensure contracts haven't been tampered with
- Medical Records: Verify integrity of patient records
- Intellectual Property: Timestamp and prove ownership of documents
- Supply Chain: Authenticate product documentation
- Node.js (v18 or higher)
- npm or yarn
- Solana CLI (for local development)
- Clone the repository
git clone <your-repo-url>
cd document-verifier- Install dependencies
npm install- Install Solana CLI (if not already installed)
For macOS (using Homebrew):
brew install solanaFor Linux/macOS (using official installer):
sh -c "$(curl -sSfL https://release.solana.com/stable/install)"- Start the local Solana test validator
solana-test-validatorKeep this running in a separate terminal window.
- Start the development server
npm run dev- Open your browser Navigate to http://localhost:3000
- Upload Your Document
- Drag and drop a file or click to browse
- Supported formats: PDF, PNG, JPG, DOCX (max 10MB)
-
Generate Hash
- The application automatically generates a SHA-256 hash of your document
-
Store on Blockchain
- Click "Store on Solana" to save the hash to the blockchain
- You'll receive an account address and transaction signature
- Save the Account Address
- Copy and save the account address - you'll need it to verify the document later
- Navigate to Verification Page
- Click "Verify a Document" from the home page
-
Upload Document to Verify
- Upload the document you want to verify
-
Enter Account Address
- Paste the account address you received when storing the hash
-
Verify
- Click "Verify Document"
- The system will compare the document's hash with the blockchain record
- β Match: Document is authentic and unchanged
- β Mismatch: Document has been modified or is not the original
- Frontend: Next.js 14 (App Router), React, TypeScript
- Styling: Tailwind CSS
- Blockchain: Solana (@solana/web3.js)
- Hashing: Node.js crypto module (SHA-256)
- File Upload: Multer
document-verifier/
βββ app/
β βββ api/
β β βββ upload/ # File upload & hash generation
β β βββ store/ # Store hash on Solana
β β βββ verify/ # Verify document against blockchain
β βββ verify/ # Verification page
β βββ page.tsx # Home page
βββ components/
β βββ FileUpload.tsx # Drag-and-drop file upload
β βββ HashDisplay.tsx # Display generated hash
β βββ StoreButton.tsx # Store hash on blockchain
β βββ VerifyResult.tsx # Display verification results
βββ lib/
β βββ hash.ts # SHA-256 hashing utilities
β βββ solana.ts # Solana blockchain interactions
βββ public/
βββ screenshots/ # Application screenshots
By default, the application connects to http://localhost:8899 (local test validator).
To change the network, update the connection in lib/solana.ts:
const SOLANA_RPC_URL =
process.env.NEXT_PUBLIC_SOLANA_RPC_URL || "http://localhost:8899";- Max file size: 10MB
- Supported formats: PDF, PNG, JPG, DOCX
To modify these limits, update components/FileUpload.tsx and app/api/upload/route.ts.
This demo application uses a keypair for signing transactions. For production, consider:
- Wallet Integration: Use Solana wallet adapters (Phantom, Solflare, etc.)
- Network Security: Use Solana mainnet or devnet
- API Security: Add authentication and rate limiting
- Input Validation: Enhanced file type and content validation
- HTTPS: Use secure connections
- Audit: Security audit of smart contracts
- Uses local Solana test validator
- Keypair-based transaction signing
- File-based hash storage (for demo persistence)
- No authentication or user accounts
-
Hash Generation: When a document is uploaded, the server generates a SHA-256 hash of its contents. This creates a unique "fingerprint" of the document.
-
Blockchain Storage: The hash is stored in a new Solana account. The account address serves as a unique identifier for this document record.
-
Verification: To verify a document, the system:
- Generates the hash of the uploaded document
- Retrieves the stored hash from the blockchain using the account address
- Compares the two hashes
- Returns whether they match (authentic) or not (tampered/different document)
-
Immutability: Once stored on the blockchain, the hash cannot be modified or deleted, providing a permanent, tamper-proof record.
Upload a file and generate its SHA-256 hash.
Request: multipart/form-data with file
Response:
{
"hash": "2fd852b8ec18dbb491c38a0ce3cdb0a45311d67d1f7b942db41a85bdb80b6604"
}Store a hash on the Solana blockchain.
Request:
{
"hash": "2fd852b8ec18dbb491c38a0ce3cdb0a45311d67d1f7b942db41a85bdb80b6604"
}Response:
{
"account": "9YG6W486MfYBHAYvvCPadp3SamX5LMFPYKRYnKSeqphv",
"signature": "5az4V6cqyBcUEWaAoKG2AG2PGe3BMeqbeq2ic9E3sqW7..."
}Verify a document against a stored hash.
Request: multipart/form-data with file and accountAddress
Response:
{
"match": true,
"message": "Document is authentic",
"hash": "2fd852b8ec18dbb491c38a0ce3cdb0a45311d67d1f7b942db41a85bdb80b6604",
"accountAddress": "9YG6W486MfYBHAYvvCPadp3SamX5LMFPYKRYnKSeqphv"
}npm testnpm run build
npm startnpm run lintContributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.
- Wallet adapter integration (Phantom, Solflare)
- Batch document verification
- Document history tracking
- Email notifications
- API key management
- Advanced analytics dashboard
- Mobile app version
- Multi-language support
# Reset the validator
solana-test-validator --reset- Ensure file size is under 10MB
- Check file format is supported
- Verify Node.js version is 18+
- Ensure Solana test validator is running
- Check connection to localhost:8899
- Verify sufficient SOL in the keypair account
For issues, questions, or suggestions, please open an issue on GitHub.
Built with β€οΈ using Next.js and Solana



