A blockchain-based document verification and management system built on Solana.
- Document storage on IPFS and Arweave
- Document verification through Solana blockchain
- Secure document sharing and access control
- Version control and document history
- User-friendly dashboard interface
- Multi-wallet support (Phantom, Solflare, Torus)
- Advanced document processing and content extraction
- Searchable document metadata and content
- Automated document classification using AI
- Collaborative editing and review workflows
- Document templating and form generation
- Custom approval workflows and digital signatures
- Advanced analytics and audit trails
- REST API for third-party integrations
- Frontend: React, Next.js, TailwindCSS
- Backend: Next.js API routes
- Blockchain: Solana
- Storage: IPFS, Arweave
- Authentication: NextAuth.js
- Document Processing: PDF.js
- AI/ML: TensorFlow.js for document classification
- WebAssembly for performance-critical operations
blokdoc/
βββ contracts/ # Solana smart contracts
βββ docs/ # Documentation
βββ public/ # Static assets
βββ src/
β βββ blockchain/ # Blockchain integration
β β βββ solana/ # Solana specific code
β βββ components/ # React components
β βββ pages/ # Next.js pages and API routes
β β βββ api/ # Backend API endpoints
β β βββ ... # Frontend pages
β βββ services/ # Business logic services
β β βββ document/ # Document processing services
β β βββ storage/ # Storage services (IPFS, Arweave)
β βββ styles/ # CSS and styling
β βββ types/ # TypeScript type definitions
β βββ utils/ # Utility functions
βββ tests/ # Test files
+-----------------+ +-----------------+ +------------------+
| | | | | |
| Client Layer |---->| API Layer |---->| Service Layer |
| (Next.js/React)| | (Next.js API) | | (Core Logic) |
| | | | | |
+-----------------+ +-----------------+ +--------+---------+
|
v
+--------------+-------------+
| | |
v v v
+----------------+ +-------------+ +------------+
| | | | | |
| Blockchain | | IPFS | | Arweave |
| (Solana) | | Storage | | Storage |
| | | | | |
+----------------+ +-------------+ +------------+
Blokdoc follows a multi-layered architecture:
- Frontend Layer - React/Next.js application providing the user interface
- API Layer - Next.js API routes handling backend logic
- Service Layer - Core business logic for document processing
- Blockchain Layer - Integration with Solana for document verification
- Storage Layer - IPFS and Arweave for decentralized storage
+-------------+ +-----------------+ +-------------------+
| User Upload | | File Processing | | Storage & Blockchain
+-------------+ +-----------------+ +-------------------+
| | |
v v v
+-------------+ +-----------------+ +-------------------+
| Select File | | Validate & Scan | | Upload to IPFS/ |
| Add Metadata| | Extract Content | | Arweave |
+-------------+ +-----------------+ +-------------------+
| | |
v v v
+-------------+ +-----------------+ +-------------------+
| Submit Form | | Generate Hash | | Register on Solana|
| | | Process Content | | Store Reference |
+-------------+ +-----------------+ +-------------------+
- User selects a document and submits metadata
- File is validated and scanned for viruses
- Document content is processed and extracted
- File is encrypted and uploaded to IPFS/Arweave
- Document hash and metadata are registered on Solana blockchain
- Document reference is stored in database with user ownership
- User requests document verification
- System retrieves document hash from blockchain
- Original document hash is compared with blockchain record
- Verification result is returned to user
- Verification transaction is added to document history
// Document verification on Solana
export const verifyDocumentOnChain = async (
connection: Connection,
wallet: any,
documentHash: string,
metadata: Record<string, any> = {}
): Promise<DocumentVerification | null> => {
try {
// Create a memo instruction with the document hash
const encodedData = Buffer.from(
JSON.stringify({
type: 'document_verification',
hash: documentHash,
timestamp: Date.now(),
metadata
})
);
// Send transaction
const instruction = new TransactionInstruction({
keys: [
{ pubkey: wallet.publicKey, isSigner: true, isWritable: true }
],
programId: new PublicKey('MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr'),
data: encodedData
});
const transaction = new Transaction().add(instruction);
const signature = await wallet.sendTransaction(transaction, connection);
// Confirm transaction
await connection.confirmTransaction(signature, 'confirmed');
return {
documentHash,
timestamp: Date.now(),
owner: wallet.publicKey.toString(),
signature,
transactionId: signature
};
} catch (error) {
console.error('Error verifying document on chain:', error);
return null;
}
};
export const processFileUpload = async (
fileBuffer: Buffer,
fileName: string,
mimeType: string,
size: number,
uploadedBy: string
): Promise<UploadResult> => {
try {
// 1. Validate file size and type
validateFileSize(size);
validateFileType(fileName, mimeType);
// 2. Scan for viruses
const isSafe = await scanForViruses(fileBuffer);
// 3. Calculate file hash for integrity
const hash = await calculateFileHash(fileBuffer);
// 4. Create file metadata
const metadata = {
originalName: fileName,
size,
mimeType,
extension: fileName.split('.').pop()?.toLowerCase() || '',
hash,
uploadedBy,
uploadedAt: new Date()
};
// 5. Store file in decentralized storage
const storageLocation = await storeFile(fileBuffer, metadata);
// 6. Create document record
const document = {
id: `doc-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
name: fileName,
fileType: metadata.extension,
fileSize: size,
createdAt: metadata.uploadedAt,
updatedAt: metadata.uploadedAt,
storageInfo: {
location: storageLocation,
hash,
originalName: fileName
},
owner: uploadedBy,
version: 1,
status: 'processing'
};
return { success: true, document, metadata, storageLocation };
} catch (error) {
// Handle errors
return {
success: false,
error: error instanceof UploadError ? error : new UploadError(UploadErrorType.UPLOAD_FAILED, 'Unknown error')
};
}
};
Blokdoc implements several security measures:
- File Validation: Checks file size, type, and extension before processing
- Virus Scanning: All uploaded files are scanned for malware
- Content Hashing: SHA-256 hash verification for document integrity
- Blockchain Verification: Immutable proof of document existence and ownership
- Access Control: Fine-grained permission system for document sharing
- Encryption: Document content is encrypted before storage
- Multi-factor Authentication: Additional security layer for sensitive operations
- Audit Logging: Comprehensive activity tracking and anomaly detection
- Security Headers: Protection against common web vulnerabilities
- Rate Limiting: Prevention of brute force and DoS attacks
- Node.js 16+
- Solana CLI tools
- A Solana wallet (Phantom, Solflare, or similar)
-
Clone the repository
git clone https://github.com/Blokdoc/Blokdoc.git cd Blokdoc
-
Install dependencies
npm install
-
Configure environment variables
cp .env.example .env.local
Edit
.env.local
with your Solana network settings -
Run the development server
npm run dev
Blokdoc is designed to serve a variety of document verification and management needs:
- Legal Contracts: Securely store and verify legal agreements with immutable timestamps
- Intellectual Property: Register patents, trademarks, and copyright materials with blockchain proof
- Compliance Documentation: Maintain regulatory documents with verifiable audit trails
- Degree Certificates: Issue and verify academic credentials
- Research Publications: Timestamp and verify authorship of research papers
- Training Certifications: Manage professional certifications with verifiable validity
- Public Records: Maintain transparent and tamper-proof public documents
- Citizen Identity: Secure personal identification documents
- Land Registry: Record property ownership with blockchain verification
- Medical Records: Secure patient records with controlled access
- Clinical Trial Documentation: Ensure integrity of research documentation
- Prescription Management: Verify authenticity of medical prescriptions
- Insurance Policies: Store and verify policy documents
- Loan Agreements: Manage lending documentation with verifiable timestamps
- Audit Reports: Maintain tamper-proof financial audit documentation
Feature | Blokdoc | Traditional DMS | Blockchain-only Solutions |
---|---|---|---|
Document Storage | Decentralized (IPFS/Arweave) | Centralized servers | On-chain (limited) |
Verification | Blockchain-based | Digital signatures | Blockchain-based |
Cost Efficiency | Low transaction fees (Solana) | Subscription-based | High gas fees (Ethereum) |
Scalability | High-throughput | Limited by servers | Depends on blockchain |
User Experience | Web3 + Traditional UI | Traditional UI | Complex Web3 UI |
Privacy | Encrypted, controlled sharing | Access control | Public by default |
Integration | API-first approach | Varies | Limited |
Search Capabilities | Full-text + metadata | Full-text + metadata | Limited to metadata |
Compliance Features | Built-in audit trails | Manual tracking | Transparent but basic |
Blokdoc is an open-source project that thrives on community contributions. We welcome developers, designers, testers, and documentation writers to join our mission of revolutionizing document management through blockchain technology.
- Code Contributions: Help improve the core platform or build new features
- Documentation: Enhance our guides and technical documentation
- Testing: Identify bugs and help improve platform stability
- Translations: Help make Blokdoc accessible in multiple languages
- Feedback: Share your experience and suggest improvements
- Security First: Security is our top priority in all development decisions
- User-Centered Design: Focus on creating intuitive and accessible experiences
- Performance: Optimize for speed and efficiency
- Modularity: Build components that can be easily maintained and extended
- Documentation: Comprehensive documentation for all features and APIs
Join our community channels to get involved!
For detailed documentation, please see the docs directory.
Run the test suite:
npm test
For specific test files:
npm test -- src/services/document/upload.test.ts
We welcome contributions! Please see our Contributing Guide for details.
This project is licensed under the MIT License - see the LICENSE file for details.
Blokdoc is currently in Beta Release.
- Website: https://www.blokdoc.xyz/
- GitHub: https://github.com/Blokdoc/Blokdoc
- Twitter: https://x.com/Blok_doc_
For any technical inquiries or bug reports, please open an issue on our GitHub repository.