Building Coinsafe

NwachukwuNwachukwu
3 min read

Coinsafe is a purpose build save and earn platform built on the Lisk L2 blockchain. It features efficient and seamless saving strategies like target based saving, time locked saving, automated saving and AI driven insights into saving strategies.

banner image

When I joined CoinSafe as the Lead Smart Contract Engineer, I knew I was stepping into a project that had the potential to redefine digital asset security. CoinSafe’s mission was clear: provide users with a simple, trustless, and highly secure way to store and manage their crypto assets. My job? Architect and implement the smart contract layer that would power it all.

Designing CoinSafe from the Ground Up

From day one, I was tasked with making the backbone of CoinSafe: the smart contracts. These weren’t just any contracts — they needed to handle high-value assets, time-locked withdrawals, recovery mechanisms, and upgradability — all while being gas-efficient and bulletproof against vulnerabilities.

The process began with extensive protocol design. I collaborated closely with our product and audit teams to define clear contract interfaces and threat models. We landed on a modular architecture, allowing different vault types and policies to plug into a secure core contract.

My Role and Key Responsibilities

As the lead, I handled:

  • Architecture & Design: From wallet logic to time-locks and emergency access protocols.

  • Implementation: Writing and testing smart contracts in Solidity with a focus on clarity and gas efficiency.

  • Security-First Development: Integrating industry best practices like checks-effects-interactions, reentrancy guards, and custom error handling.

  • Review & Audits: Conducting internal reviews and coordinating with third-party auditors to stress test our codebase.

  • Tooling & DevOps: Setting up testing frameworks (Hardhat/Foundry), CI pipelines, and deployment scripts.

  • UUPS Upgradability with EIP 2535 Diamond standard.

Challenges and How I Overcame Them

1. Handling Upgradability without Sacrificing Security

One of the hardest design problems was contract upgradability. We needed the ability to patch bugs or add new features without jeopardizing user funds. Proxy patterns are notoriously risky if not handled carefully.

Solution: I designed a tightly-scoped, diamond standard contract with multi-signature wallets for deploying and upgrading.

2. Gas Optimization vs. Readability

With complex logic like vault management and wallet tracking, our contracts quickly grew heavy.

Solution: I focused on data structure optimizations (using packed structs, efficient mapping lookups, custom errors instead of require strings) and stripped out any logic that didn’t directly contribute to core security or functionality. I also wrote extensive documentation so that auditors and contributors could still easily follow the logic.

3. Automation process

One of the biggest features of Coinsafe was the automation of saving by frequency. Building on a new chain was tough, given that popular cron executors on-chain were not yet live on Lisk

Solution: I figured out a service, Gelato - though crude at the time, I was able to break into their Discord, chat with a few developers, and found my way around their relayer, web-3 automated function, and relayer for gas sponsorship.

What I Learned

Leading the smart contract engineering at CoinSafe taught me how to build security-critical systems under real-world constraints. It wasn’t just about coding — it was about thinking adversarially, communicating clearly with non-dev teams, and balancing user experience with uncompromising security.

I'm still iterating, still improving — but seeing users trust CoinSafe with their digital wealth makes every late-night debugging session worth it.

0
Subscribe to my newsletter

Read articles from Nwachukwu directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Nwachukwu
Nwachukwu

I am a skilled full-stack developer experienced in JavaScript, TypeScript, react, PHP, and Laravel. I create visually appealing and responsive user interfaces. I have a strong background in back-end development with proficiency in Laravel, enabling me to build robust and scalable server-side solutions. My skills extend to data management using tools like SQL, and POSGRESQL for efficient storage and real-time communication. Additionally, I actively contribute to open-source projects and have a knack for BAAS like supabase.