Author: Vitaly Bahachuk, co-founder of Linen
Safe, previously Gnosis Safe, powers Linen’s multi-signature, self-custodial architecture, providing security that was once primarily accessible to institutions and now available to all users. This document outlines our security model and our commitment to creating the most secure solution for protecting your crypto wealth.
In cryptographic systems, private keys – crucial for blockchain account access – are increasingly at risk from hacks and lost seed phrases (Secret Phrases). For many crypto asset holders, preempting these asset-loss threats is a significant concern.
In this document:
- What’s Wrong With Wallet Security
- Rationale Behind Linen’s Security Model
- Linen Security Model
- Wallet Recovery
- Future Research and Development
What’s Wrong With Wallet Security
Custodial wallets
The critical element of any crypto-based system is a private key. It must be securely stored and managed. A private key is needed to sign transactions and to recover crypto assets if the wallet app or device is stolen or lost. Safeguarding a private key is easier said than done, and for many novice crypto users, the most reasonable choice might be trusting a centralized exchange with their private keys and assets. We won’t discuss how this approach goes against the entire premise of cryptocurrency and blockchain technology because that is not the focus of this document.
Any ideological beliefs aside, many unpleasant episodes have shown that centralized institutions holding massive amounts of users’ digital assets is not an optimal solution. We have seen many failed institutions where customer funds were lost, such as FTX, Celsius, and Quadriga, to name a few.
Legacy self-custody wallets
Instead of entrusting your crypto assets to a centralized exchange, you could store your wallet’s private keys as a mnemonic Secret Phrase. It is 12 or 24 common English words that cryptocurrency wallet software can decode into a set of private keys to restore access to your assets.
Although this is a popular option, it, unfortunately, bears its own set of significant risks. The reality is that these Secret Phrases often become an attack vector for hackers. Most people are not equipped to manage a mnemonic Secret Phrase securely and usually store it online or paste it into other wallet software apps, posing a serious security risk.
Even advanced crypto community members like Farokh have lost close to a million dollars worth of crypto assets using wallets like Ledger or MetaMask because their Secret Phrases were compromised or lost.
Hardware wallets
Unlike private keys in ‘hot’ wallets (wallets connected to the internet), private keys in hardware wallets, or ‘cold’ wallets, aren’t stored on devices connected to the internet. Keeping private keys offline protects wallets from hacks. However, this solution still has a single point of failure — if your Secret Phrase is stolen or lost, you won’t be able to access your wallet, and your crypto wealth is forever lost.
Rationale Behind Linen’s Security Model
When developing Linen, our main priority was to build a wallet. This wallet wouldn’t compromise between security and ease of use. It needed to offer more security and reliability than any existing solutions on the market, a wallet that must:
- Offer more security and reliability than any existing solutions on the market;
- Exhibit censorship resistance, meaning that users can access their assets without relying on Linen by using third-party interfaces or going directly to the blockchain;
- Be simple and easy to use, ensuring low mental overhead;
- Adapt easily to new crypto asset types and use cases that are yet to emerge.
Let’s look at each principle in more detail.
1. Security objectives
The cornerstone of any self-custody wallet should be protection against cyber threats. That’s why we established strict, non-negotiable requirements for our security mechanism design:
- It should be impractical for an attacker to gain unauthorized access to the owner’s assets; therefore, no single private key (no single point of failure) can grant access to the wallet.
- It should be practically impossible for the wallet owner to lose access to their wallet; thus, if one of the private keys is lost or damaged, the wallet owner can recover access with the remaining private keys and remove the compromised key.
So, instead of relying on a single private key like most wallets do, Linen has adopted a multi-signature architecture powered by Safe, the gold standard in crypto security. By doing so, we eliminate the single point of failure.
2. Censorship resistance objectives
We are strong proponents of self-sovereignty, meaning everyone should be able to securely possess their crypto wealth without relying on third-party financial institutions like exchanges, fintech apps, or other wallets. These entities can potentially censor access to your wallet at any time. It’s not necessarily that these entities are bad actors and want to censor on purpose, but sometimes accidents do happen. We’ve seen exchanges and hosted wallet providers closing user accounts, leaving assets stuck in limbo, and custodians losing access to private keys, among other incidents.
Linen is designed so that users can always use third-party interfaces or interact directly with smart contracts either voluntarily or in the unlikely event that Linen ceases operations for any reason
3. Usability objectives
Designing a secure system for wallets shouldn’t lead to any compromises on usability. More specifically, the backup and recovery process of the multi-signature wallet must be simple, transparent, and user-friendly.
After analyzing the UX hurdles of multiple mainstream crypto wallets, we concluded that less is more. We are not aiming to integrate every possible use case in our wallet app, but rather are focusing on one thing – allowing our users to securely manage their private keys and revolver the wallet when needed.
Making it simple for users to recover their wallets using the Linen mobile app, while maintaining the highest security standards was our most significant challenge, as security and usability usually exist on opposite sides of the spectrum.
4. Future-proof objectives
Wallet security is constantly evolving. Strategies that worked yesterday may not work tomorrow. Therefore, we must stay updated with security research and industry best practices. Because it’s hard to predict how the technology will evolve, it’s crucial to build a future-proof foundation and quickly adapt to enhanced security features. For these reasons, we adopted a smart contract wallet architecture and prioritized security-related features.
To the best of our knowledge, the concept of smart contract wallets was first introduced in late 2016 by the DappHub ds-proxy project. The main idea behind this concept is to separate two things. Firstly, smart contracts that store crypto assets on blockchains. Secondly, the logic that users want to apply to their crypto assets.
With externally owned accounts (EOA) on Ethereum, managing a single private key is the only option to secure funds. For this reason, EOAs are not flexible and can’t be easily adapted to future use cases that crypto brings, particularly those that require greater security. Smart contract wallets give users and developers much more flexibility, making them the preferred solution for the many future use cases of crypto that we cannot even imagine today.
A significant advantage of adopting this framework is the ability to set various authentication mechanisms for the wallet. For example, it is possible to set a requirement that two of the three signatures be needed to move crypto assets or any other access policy.
Another benefit of smart contract wallets is meta transactions which Linen had implemented. With EOA, wallet owners must have some Ether (ETH) in their wallets to pay gas fees to miners for transaction processing. Thus, if a new user receives their first token in an EOA-based wallet, they can’t use it without ETH. This requirement creates a high barrier to entry for some crypto holders.
However, this is different with smart contract wallets, where users can transact from the get-go without needing to buy ETH. Thanks to meta transactions, users can pay a fee to a relayer in the token they already own. Linen currently supports paying fees in stablecoins in addition to ETH.
Now that we have gone through the rationale behind our design, we can outline the actual security model adopted by Linen.
Wallet Recovery
So what happens if your mobile device where one of the keys stored is stolen, lost, or damaged beyond repair, or if you simply have to reinstall the Linen app and delete the device key?
Linen is designed to have two wallet recovery options:
- Linen mobile app recovery using Wallet Recovery Kit – optimized for ease of use;
- Sovereign Mode – for those who choose third-party interfaces to recover their wallets or access their wallets if, in the unlikely event, Linen, the company behind Linen wallet, is no longer around.
Linen mobile app recovery using Wallet Recovery Kit
Regaining access to your wallet is easy thanks to the Linen Wallet Recovery Kit — it requires you to have access to:
- The email address you’ve provided and verified while signing up. Here are 7 tips on how to keep your email secure;
- The phone number you provided and verified while signing up;
- The Cloud Drive Key, saved to your iCloud or Google Drive, which is associated with the Apple ID or Google Account you used when setting up your Linen wallet. The Cloud Drive Key on its own is not enough to regain access to your wallet. Linen Vaults use the Hardware Wallet Key instead of the Cloud Drive Key.
To recover your wallet, download the Linen app, launch it, and select ‘Recover Wallet’ from the main screen. The app will guide you through the process.
Sovereign Mode
As mentioned earlier, one of our guiding principles is censorship resistance. Sovereign Mode is a testament to it, as users can access their Linen wallet using third-party interfaces without reliance on Linen. To do this, users need their User Device Key and either the User Cloud Drive Key or Hardware Key and connect them to third-party interfaces such as the Safe app. A detailed guide on how to do that is here.
Please note that in the current version of Linen, once you use Sovereign Mode, you cannot revert to using the Linen mobile app to sign transactions.
Using cloud drives as key storage
As mentioned earlier, the User Cloud Drive Key is stored in iCloud Drive on iOS and Google Drive on Android in the Linen Easy Recovery option. Access to the User Cloud Drive Key alone does not grant access to the wallet as access to the wallet requires a second key (User Device Key or Linen Recovery Key), hence the name multi-signature.
To upgrade cloud drive security, it is advisable that users also set up 2FA for their cloud storage.
Using hardware wallets as key storage
Hardware wallets provide extra security when used as a signer in a multisig wallet setup because they allow users to sign transactions without exposing the key to the online environment. At the same time, even if the hardware wallet key is lost or compromised, that will not be enough to gain unauthorized access to the user assets.
Keeping the Secret Recovery phrase for hardware wallets offline and separate from your Device Key is important.
Linen Security Model
Enter Smart Contract Technology powered by Safe
As a more versatile alternative, ‘smart wallets’ like Linen, powered by Safe, are set to alleviate most of the problems associated with more conventional solutions. Indeed, they are:
- More secure;
- More flexible;
- Generally more convenient;
With that being said, let’s discuss Linen’s multi-signature wallet in a bit more detail.
Smart Contract Technology
We have chosen Safe smart contracts, the gold standard in smart contract security. Having developed blockchain-based infrastructures since 2016, Safe is the only multi-signature solution that has passed formal verification, the highest possible security standard in the crypto industry.
Besides being formally verified, its smart contracts have also passed three independent security audits. To this day, no major or critical issues have been found in the codebase, and that’s why Safe offers up to $1,000,000 to anyone who can find a bug in the code (that’s the richest bug bounty program in the industry!).
With all that being said, it’s no coincidence that the latest deployment of Gnosis Safe smart contracts secures more than $39 billion worth of crypto assets as of February 2023.
Considering all of this, we find it very unlikely that any other wallet operator could write smart contracts that can even come close to the level of security provided by Safe because Safe is essentially a modular operating system for crypto assets custody and anyone can develop modules that enhance overall security and functionality of Safe. For these reasons, we chose to use Safe’s established smart contracts rather than developing our own from scratch.
Linen security
In the current implementation, users of Linen can choose between the two options – Safe powers both and are user self-custody – with different security assumptions:
- Linen Easy Recovery. Best for ease of use.
- Linen Vault: Multisig with Hardware Wallet (Ledger X) Support. More secure for large asset holdings (currently in testing).
Linen Easy Recovery
This custody option has three keys, and this wallet design is optimized for easy wallet recovery if a user loses their mobile device or one of their Secret Phrases is compromised. The keys are stored in the following places:
- User Device Key – stored in a secure area on a user mobile device using Secure Enclave. This key can’t be accessed by any other app. User Device Key is available for export.
- User Cloud Drive Key – stored on the user’s cloud storage, such as iCloud Drive. A copy of this key is stored on a user’s mobile device for easy co-signing of transactions along with the User Device Key. This key is also available to export.
- Linen Recovery Key – resides on Linen’s secure software infrastructure and can be accessed for wallet recovery only by a user authenticating with their verified email, SMS one-time passcode verification, and Cloud Drive Key.
To execute a transaction, such as withdrawing assets or swapping, a user needs access to 2 of those 3 keys. In the Linen Easy Recovery option, each transaction is signed with the User Device Key and a copy of the User Cloud Drive Key, which is stored on the user device too.
Linen Vault: Multisig with Hardware Wallet (Ledger X)
This wallet option has three keys physically separated, which is optimized for increased security for those users who hold high balances and need that extra piece of mind. Since all the keys are stored separately from one another, it is very unlikely that a hacker can gain access to two keys at the same time. This security setup gives users enough time to react accordingly and protect their assets, for example, remove the compromised key with a new one.
- User Device Key – stored in a secure area on a user mobile device using Secure Enclave. This key can’t be accessed by any other app. User Device Key is available for export.
- User Hardware Key (Ledger X) – stored offline by the user and used to co-sign transactions along with the User Device Key.
- Linen Recovery Key – resides on Linen’s secure software infrastructure and can be accessed for wallet recovery only by a user authenticating with their verified email, SMS one-time passcode verification, and the Hardware Key.
To execute a transaction, such as withdrawing assets or swapping, a user needs access to 2 of those 3 keys. In the Linen Multisig with the Hardware option, each transaction is signed with the User Device Key and a Hardware Key.
Future Research and Development
Linen’s security model described in this document is currently one of the most secure options available to crypto users worldwide. In future versions of Linen, users can add trusted contacts to help them recover wallets, transaction monitoring services, and other security-related improvements.