Building a Family Memory Vault on Stacks: From Problem to Working Smart Contracts

Table of contents
How I am creating MemoryChain, a Bitcoin-native platform for preserving family memories across generations
The Problem That Started Everything
When I began thinking about what to build for Stacks Ascent, I kept coming back to a personal frustration: watching families lose their digital memories. Not through dramatic disasters, but through the mundane reality of platforms changing, accounts getting locked, and services disappearing.
The problem isn't just storage - it's ownership and permanence. Families need something that outlasts any single company or platform. That's where Bitcoin's immutability becomes compelling, but Bitcoin alone can't handle the complexity of family permissions and privacy controls.
Why Three Contracts Instead of One
My initial instinct was to build everything in a single smart contract. This turned out to be a fundamental design mistake that I had to correct early in development.
The issue became clear when I tried to handle memory permissions alongside family management. These are fundamentally different concerns with different lifecycles:
Memories are permanent records that should never truly disappear
Family relationships change over time as people join, leave, or change roles
Permission systems need flexibility without compromising security
This led me to a three-contract architecture:
Memory-Storage Contract
This handles the core CRUD operations for individual memories. Each memory includes:
Basic metadata (title, description, category)
IPFS hash for the actual file content
Privacy controls (public to family vs private)
Ownership tracking with soft delete functionality
The soft delete decision was crucial. Families don't want memories to vanish permanently, even when someone "deletes" them. The is-active
flag allows apparent deletion while preserving data.
Family-Access Contract
This manages the social layer - who belongs to which families and what they can do. I implemented a four-tier role system:
Owner: Full control including family dissolution
Admin: Can invite/remove members and manage permissions
Member: Can contribute memories and access shared content
Viewer: Read-only access to shared memories
The invitation system includes expiration handling because indefinite pending invitations create security vulnerabilities and user confusion.
Memory-Family-Bridge Contract
This connects memories to families without creating tight coupling. The bridge pattern means I can upgrade individual contracts without breaking existing family data structures.
The Permission System Challenge
The most complex technical challenge was designing permissions that feel natural to families while remaining computationally efficient on-chain.
Families don't think in terms of access control lists. They think in terms of relationships and trust levels. But blockchain contracts need explicit, verifiable rules.
My solution was hierarchical permissions with explicit grants. Family roles provide baseline access, but individual memories can have specific permissions granted to particular users. This supports scenarios like "only parents can see this medical document" or "grandchildren get access to these photos when they turn 18."
The technical implementation stores permissions in a separate map structure:
(define-map memory-permissions
{memory-id: uint, user: principal}
{
can-view: bool,
can-edit: bool,
granted-by: principal,
granted-at: uint
}
)
This approach trades storage efficiency for query flexibility - a worthwhile trade-off for the user experience benefits.
Frontend Design Without Live Integration
Building a frontend that demonstrates complex functionality without live smart contract integration required careful thinking about state management and user experience.
I used mock data strategically to show realistic family scenarios:
Different memory categories with appropriate metadata
Privacy indicators that reflect real family dynamics
Search and filtering that would work with actual contract queries
The analytics dashboard demonstrates production capabilities using simulated data that reflects realistic usage patterns. This approach lets users envision the full experience while keeping development focused on proving the core concept.
What I Learned About Clarity Development
Three insights emerged from actually building these contracts:
Error handling is more important than feature completeness. Families will make mistakes - wrong addresses, invalid inputs, permission conflicts. Clear error messages with specific error codes make debugging possible.
Gas optimization matters for user experience. The difference between an expensive transaction and an affordable one determines whether families will actually use the system. Simple optimizations like caching user counts made significant differences.
Testing in console vs. production will be different. The Clarinet console environment is forgiving in ways that mainnet deployment won't be. Building with this awareness prevents surprises later.
Architectural Decisions I Will Make Differently
Looking back at the completed system, two architectural choices stand out as questionable:
The bridge contract adds complexity without clear benefits at this scale. For an MVP, direct references between memory and family contracts would be simpler and just as effective.
The invitation expiration logic is too simplistic. Using block height as a proxy for time works in console but creates user experience problems when block times are unpredictable.
Why This Approach Matters for Bitcoin
This project demonstrates that Bitcoin can support complex social applications through Stacks while maintaining the security guarantees families need for their most important data.
The key insight is that Bitcoin's immutability works for family data specifically because family memories shouldn't disappear or be censored by external parties. The permanent nature that makes Bitcoin unsuitable for some applications makes it perfect for family heritage preservation.
Next Steps Toward Production
The working contracts prove the concept, but production deployment needs several additions:
Real IPFS integration with redundant pinning
Client-side encryption before any upload
Testnet deployment with actual families
Mobile interfaces for broader accessibility
The foundation is solid. The architecture scales. The user experience patterns are proven. The next phase is making it real for actual families.
Subscribe to my newsletter
Read articles from Benjamin Owolabi directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
