DEV Community


Posted on

Safe recovery module


Safe is a smart contract wallet running on several blockchains that requires a minimum number of people to approve a transaction before it can occur (M-of-N). If for example, you have 3 main stakeholders in your business, you are able to set up the wallet to require approval from 2 out of 3 (2/3) or all 3 people before the transaction is sent. This assures that no single person could compromise the funds.

A lot of smart people use Safe to manage their funds. It is not uncommon to have 2/3 safe and to control all 3 signers.

One wallet can live in the browser (Metamask) Another one can be a hardware wallet (Ledger), and the third one can be a piece of paper written and stored in a drawer.

This is considered a good practice because if one gets compromised, no harm is done. Funds are stored in Safe.

Painful truth - motivation

Everybody dies, eventually. And crypto hasn't solved the problem of leaving your coins and tokens to loved ones.

I'm a motorcycle fan and I enjoy going on random rides, I'm aware of the risk that I'm exposing myself to, and while I'm doing my best to behave on the road, I can't vouch for the others. One day I was riding and thinking to myself "what if something happened to me?". Of course, I'm a fan of self-custody, and I keep my stuff on Safe. I'd want to leave my crypto to others, but I don't want them to be in control of my money and my precious jpegs while I'm still alive.


Safe owner pays a yearly fee and sets up notifications (SMS/Email) and a goodbye message.

Let's say that Alice wants to give away Safe to Bob after 2 years. She'd set up the recovery address to Bob's address and a recovery date timestamp 2 years in the future.

Fast forward 2 years in the future, the notification system would notify Alice that Safe will be transferred to Bob in 30 days. If Alice is unable to extend the period/cancel the ownership transfer. Bob would get notified and would get the goodbye message and the Safe ownership would be transferred to Bob.

How it works:

Safe recovery module and service

Gnosis Safe Modules enable additional access-control logic for your Gnosis Safe account. Essentially, every Gnosis Safe account is controlled by two means. By the account owners using their signer keys and by optional modules that have their own custom access logic.

Idea is to create a module and a service that will transfer safe ownership to some new address.

The solution consists of a few different parts

  • RecoveryRegistry (Immutable smart contract) that is storing the recovery date and a recovery address
  • RecoveryModule smart contract that is responsible for transferring ownership of a safe
  • Notification system - a system that notifies Safe owner and a new recovery address of what happened


Orange represents smart contracts, yellow represents web2 infrastructure.
When the time comes, the Owner is notified via SMS/Email. The execution service executes an on-chain transaction that initiates ownership transfer, and after a 30-day time lock finalizes it and notifies the recovery recipient via SMS/Email.

Top comments (0)