
SentryGate
SentryGate: Secure Your Legacy
Demo
About
The problem it solves **SentryGate : The Ultimate Gatekeeper for Your Digital Legacy** SentryGate is an Onchain Mini App built on the Base network that redefines how we store and verify our most critical documents. By combining military-grade encryption with decentralized storage and a seamless onchain payment gateway, SentryGate turns your wallet into a bulletproof digital vault. **What can people use it for?** SentryGate is designed for anyone who handles high-stakes documentation that cannot afford to be lost, tampered with, or accessed by unauthorized parties: - Academic Sovereignty: Students and alumni can store encrypted versions of diplomas, transcripts, and certifications. No more worrying about physical damage or long university verification processes. - Freelance & Legal Protection: Independent contractors can vault signed SLAs, NDAs, and project milestones. With onchain timestamps, you have immutable proof of your contracts. - Corporate Credentials (HR): Professionals can maintain a portable, verified record of employment letters (Paklaring) and tax documents that follow them throughout their career. - Business Continuity for SMEs: Small business owners can secure NIBs, deeds, and rental agreements, ensuring they are always accessible for loan applications or permits, even if local hardware fails. **How SentryGate Makes Life Easier & Safer** 1. Safer : Zero-Knowledge Privacy Unlike traditional cloud providers (Google Drive/Dropbox), SentryGate cannot see your files. * Client-Side Encryption: Documents are encrypted on your device using keys derived from your wallet signature before they ever touch the network. Decentralized Resilience: Files are hosted on Pinata (IPFS), removing the "single point of failure" risk. Even if one server goes down, your data remains accessible and untampered. 2. Easier : Seamless Onchain Access We’ve removed the friction of traditional security systems : x402 Payment Middleware: No more manual subscriptions. The system automatically verifies your access status via the x402 protocol on Base. If you've paid, the gate opens; if not, you can pay and unlock features instantly in one transaction. Mobile-First Scanning: Use the built-in scanner to turn physical papers into encrypted digital assets in seconds. 3. Smarter : Immutable Integrity By storing the cryptographic hash of your documents on the Base network, SentryGate provides a permanent "fingerprint" of your data. You can prove a document existed at a certain time and hasn't been modified since—without ever revealing the actual content to the public.
How it's made
Challenges we ran into Building SentryGate was a journey of balancing high-level security with a smooth user experience. Here are the most significant hurdles we faced and how we cleared them : 1. The "Consistent Key" Dilemma (Client-Side Encryption) **The Hurdle :** The core promise of SentryGate is that even we, the developers, cannot see your files. This required client-side encryption. However, we faced a major UX problem : How do we generate the same encryption key every time a user logs in without asking them to remember a second password or worse storing their private key? **The Solution :** We implemented a deterministic key derivation flow. When a user connects their wallet (via Privy), we ask them to sign a specific, non-transactional message: "Sign this to unlock your SentryGate Vault". - This signature is unique to the user but deterministic. - We then feed this signature into a PBKDF2 (Password-Based Key Derivation Function 2) with a fixed salt to derive a 256-bit AES key. - This ensures that as long as the user has access to their wallet, they can always derive the same key to decrypt their vault on any device. 2. Development Environment & Toolchain Conflicts **The Hurdle** : Setting up the development environment for Foundry (to build the Base smart contracts) and the Sui CLI (for related research) within a Windows Subsystem for Linux (WSL) environment proved to be quite a challenge. We encountered several path conflicts and versioning issues that caused the smart contract deployment scripts to fail unexpectedly during the early stages of the hackathon. **The Solution** : We had to perform a deep dive into the WSL environment variables and toolchain management. After hard-resetting the local environment and manually configuring the binary paths for Foundry, we established a stable deployment pipeline. This experience taught us the importance of environment isolation and having a robust "clean start" script for the team. 3. Synchronizing x402 Middleware with the Backend **The Hurdle :** Using x402 as a payment gatekeeper created a "race condition" between the blockchain and our backend. Sometimes, a user would complete their payment on the Base network, but when they immediately tried to upload a document, the backend API (checking the state via a RPC provider) would still see the old "unpaid" status because the block hadn't fully indexed yet. **The Solution :** We solved this by implementing Optimistic Validation combined with a Retry Mechanism : - Frontend: Once the transaction hash is received, the UI optimistically unlocks the upload feature. - Backend: If the initial on-chain check fails, the API doesn't just reject the request. Instead, it enters a short "polling" loop for 5-10 seconds to verify the transaction status directly from the Base sequencer. - This ensures that by the time the encrypted file is processed, the payment status is confirmed without the user ever seeing a "Payment Required" error after they’ve already paid. 4. Browser-Based Document Scanning **The Hurdle :** Creating a "Mini App" feel meant the scanner had to work flawlessly on mobile browsers. Initially, the raw image data from the camera was too large to encrypt and upload efficiently, causing the browser to lag or crash on lower-end devices. **The Solution :** We integrated a client-side compression layer using canvas before the encryption step. By resizing and converting the scan to a high-quality WebP format first, we significantly reduced the payload size, making the subsequent AES encryption much faster and the upload to Pinata nearly instantaneous.