Overview
MessageVault is an ERC-4337 smart account deployed on Sepolia that lets users send messages to a wallet. Instead of storing message content on-chain, the contract emits events (MessageStored) and increments an internal counter, while the frontend reads messages via The Graph Subgraph for pagination and ordering.
What it demonstrates
- Account Abstraction with EntryPoint v0.7 (ERC-4337) on Sepolia
- Dual interaction model:
- Owner (EOA) direct calls
- AA flow via
UserOperation(bundler + optional paymaster)
- Event-driven design: no message storage, just indexed events
- Subgraph “Studio-first” operations: deploy and manage in The Graph Studio
- Practical production patterns: validation surface control, deposit checks, and clear env-driven config
Key features
sendMessageToWallet(string content)emitsMessageStored(...)and advancesnextMessageId- Owner-only wiring:
setEntryPoint(address)to the canonical EntryPoint - Deposit management:
addDeposit()/withdrawDepositTo(...)for AA prefund when needed - The Graph indexing for:
- pagination (
limit,pageToken) - ordering by id / block metadata
- pagination (
- Frontend polling strategy with backoff + jitter for resilient reads
This repo keeps Subgraph management Studio-first. Do not commit a local
subgraph/ folder, use The Graph Studio and configure the frontend via
VITE_SUBGRAPH_URL.
Live demo
Screenshot

Architecture notes
-
Contract
- Smart account implements ERC-4337 validation (
validateUserOp) for AA execution paths. - Messages are events, not storage, to keep gas low and index-friendly.
- Smart account implements ERC-4337 validation (
-
Indexing
MessageStored,OwnerChanged, andEntryPointSetare indexed.- Subgraph is created and deployed in The Graph Studio (no local subgraph folder in repo).
-
Frontend
- Vite/React UI with WalletConnect/RainbowKit.
- Reads events from
VITE_SUBGRAPH_URL(with polling + backoff). - AA transactions can be sponsored (paymaster) or funded via EntryPoint deposit.
Quickstart
git clone https://github.com/casaisdev/MessageVault.gitSee the repository docs:
- Backend deploy + verification + deposit checks:
- https://github.com/casaisdev/MessageVault/blob/main/backend/README.md
- Frontend env vars + AA configuration + Subgraph polling:
- https://github.com/casaisdev/MessageVault/blob/main/frontend/README.md
Notes
- Events over storage: message content is not persisted on-chain; the app relies on
MessageStoredevents and Subgraph indexing for pagination and ordering. - AA deposit vs ETH balance: Etherscan may show
0ETH even when the wallet is “funded” for AA, prefund lives as an EntryPoint deposit, not as native balance. - Studio-first subgraph: configure the frontend with
VITE_SUBGRAPH_URLand keep endpoints out of source control.
Next steps
If I were to evolve MessageVault further:
- Add selector-level capability policies (session-style permissions with bounded actions)
- Add richer indexing at the Subgraph layer (threads, per-sender feeds, tags)
- Add a fallback read path (RPC logs) when the Subgraph is unavailable
- Add optional “reactions” or metadata events (still event-only, indexable)