DocuChain is a cutting-edge, secure document management platform leveraging blockchain technology to provide immutable, verifiable, and transparent document handling. Built with Node.js, Ethereum, and IPFS, DocuChain ensures document integrity, traceability, and ownership verification.
- Immutable Document Storage: Leverage blockchain's inherent security
- Decentralized File Storage: Utilize IPFS for distributed file management
- Ownership Tracking: Real-time document ownership transfer and verification
- Comprehensive Logging: Detailed audit trails for every document action
- Secure Document Issuance: Cryptographically signed and verifiable documents
- Backend: Node.js, Express.js
- Blockchain: Ethereum, Solidity
- File Storage: IPFS
- Database: MongoDB
- Logging: Custom logging service
- Smart Contracts: Truffle Framework
DocuChain-Backend/
β
βββ build/
β βββ contracts/
β
βββ logs/
β
βββ src/
β βββ config/
β βββ controllers/
β βββ models/
β βββ routes/
β βββ services/
β
βββ truffle/
βββ contracts/
βββ migrations/
- Endpoint:
POST http://localhost:3000/api/documents/issue
- Purpose: Upload and register a new document on blockchain
- Request Headers:
Authorization
: Bearer {access_token}
- Request Body (Form-Data):
document
: File to be uploadedrecipientAddress
: Ethereum address of document recipient
- Endpoint:
POST http://localhost:3000/api/documents/get
- Purpose: Retrieve a specific document
- Request Headers:
Authorization
: Bearer {access_token}
- Request Body:
{ "docId": "unique-document-identifier" }
- Endpoint:
POST http://localhost:3000/api/documents/verify
- Purpose: Validate document authenticity
- Request Headers:
Authorization
: Bearer {access_token}
- Request Body:
{ "docId": "unique-document-identifier" }
- Endpoint:
POST http://localhost:3000/api/documents/transfer
- Purpose: Transfer document ownership between addresses
- Request Headers:
Authorization
: Bearer {access_token}
- Request Body:
{ "docId": "unique-document-identifier", "newOwner": "Ethereum address of document's current owner" }
- Endpoint:
POST http://localhost:3000/api/documents/search
- Purpose: Search documents by issuer or recipient
- Request Headers:
Authorization
: Bearer {access_token}
- Request Body:
{ "recipientAddress": "Ethereum address of document recipient" }
- Endpoint:
http://localhost:3000/auth/signup
- HTTP Method: POST
- Content-Type: multipart/form-data
- Purpose: Creating New Account on platform
{
walletAddress: string, // Ethereum wallet address
name: string, // User's full name
email: string, // Valid email address
phone: string, // Phone number with country code
uid: string, // Unique identifier
dob: string, // Date of birth (MM/DD/YYYY)
role: string, // User role (default: 'user')
photo: File, // User photo (JPEG/PNG)
idDocument: File // Identity document (PDF)
}
{
"success": true,
"walletAddress": "0x092Afb01ADFf2ca70860A7441AB12dae96b75Bae",
"processingTime": 92
}
- Endpoint:
http://localhost:3000/auth/generate-nonce
- HTTP Method: POST
- Purpose: Generate a unique nonce for signature challenge
{
"walletAddress": "0xUserWalletAddress"
}
{
"nonce": "0xWalletAddress:Timestamp:RandomString"
}
- Endpoint:
http://localhost:3000/auth/verify-signature
- HTTP Method: POST
- Purpose: Verify user's cryptographic signature and issue authentication tokens
{
"walletAddress": "0xUserWalletAddress",
"signature": "0xSignatureGeneratedByWallet",
"nonce": "0xGeneratedNonceFromPreviousStep"
}
{
"accessToken": "JWT_ACCESS_TOKEN",
"refreshToken": "JWT_REFRESH_TOKEN"
}
- Endpoint:
http://localhost:3000/auth/refresh-token
- HTTP Method: POST
- Purpose: Generate a new access token using a valid refresh token
{
"refreshToken": "EXISTING_REFRESH_TOKEN"
}
{
"accessToken": "NEW_JWT_ACCESS_TOKEN"
}
- Ethereum address validation
- Multer-based file upload security
- IPFS decentralized storage
- Blockchain-based document verification
- Comprehensive error logging
- File size limitations (50MB)
- Node.js (v14+ recommended)
- MongoDB
- Ethereum Wallet
- Truffle
- IPFS Node
-
Clone the repository
git clone https://github.com/DocuChain-Document-Ownership-DApp/DocuChain-Backend.git
-
Install dependencies
npm install
-
Configure environment variables
cp .env.example .env
-
Compile The Contracts
npm run compile
-
Migrate the Contract
npm run migrate
-
Start the server
npm run start
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- Ethereum Foundation
- IPFS Team
- OpenZeppelin
- Truffle Suite
Built with β€οΈ by the DocuChain Team