Skip to content

mgnfy-view/multi-sig-wallet

Repository files navigation

Contributors Forks Stargazers Issues MIT License LinkedIn

Multi-Sig Wallet

A multi-signature wallet implementation using the Eth-Ape framework in python
Explore the docs »
Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Roadmap
  4. Contributing
  5. License
  6. Contact

About The Project

A multi-sig wallet, also known as a multi-signature wallet, is a crypto wallet which is held by multiple owners, and requires a predetermined minimum number of approvals to authorize and execute transactions.

The wallet owners and the minimum number of approvals required for transaction authorization are set during deployment of the smart contract. A transaction request can be issued by any one of the owners. Further, the transaction can be approved by other wallet owners, and then executed. This implementation of the multi-sig wallet supports ether, token, and NFT transactions.

To get a full list of multi-sig wallet functions and their descriptions, head over to ./docs/index.html. Open the file in a web browser to view the documentation.

Additionally, you can view the most recent deployment of an example wallet contract here.

Built With

  • Python
  • Eth-Ape
  • Solidity
  • Ethereum

Getting Started

Prerequisites

Make sure you have node.js, python3, pip3, python3-venv, and git installed and configured on your system. Also, you need to have a bunch of MetaMask accounts, with atleast one of them (the deployer) having about 1 ETH. If you are using the Sepolia testnet, you can get Sepolia testnet ETH from the Alchemy faucet.

Installation

Clone this repository

git clone https://github.com/mgnfy-view/multi-sig-wallet.git

Cd into the project folder and activate the virtual environment

cd multi-sig-wallet
python3 -m venv .venv
source .venv/bin/activate

Then install the dependencies

pip3 install -r requirements.txt
ape pm install .
npm install

Don't forget to install the plugins required by this project!

ape plugins install .

Setup and Deployment

Warning

The multi-sig wallet contract hasn't undergone a security review yet. It is highy advisable to keep your deployments restricted to testnets only.

You need to bring your Metamask accounts into ape. One of these accounts will be used to deploy your wallet. The others, along with the deployer, will be joint owners of the multi-sig wallet. You can import as many accounts as you like with

ape accounts import <ALIAS>

Answer the prompts and your accounts will be registered with ape. You will need to provide an alias for each account, and a passphrase. Don't forget these! Ape will ask you for the passphrase to sign transactions.

If you would like to deploy to the Sepolia testnet, you'll need to get your api key from Alchemy, and set it as an environment variable

export WEB3_ALCHEMY_API_KEY=<YOUR_API_KEY>

Additionally, you can get an api key from Etherscan to publish and verify your contracts. Once you have the api key, set it as an environment variable

export ETHERSCAN_API_KEY=<YOUR_API_KEY>

Then, go to ./scripts/deploy_multi_sig_wallet.py and bring in your accounts using the account aliases you set before. Remember, account_1 is the deployer.

account_1 = accounts.load("<ALIAS_1>")
account_2 = accounts.load("<ALIAS_2>")
...
account_n = accounts.load("<ALIAS_n>")

Set the minimum number of required approvals to authorize a transaction to a valid value (required_approvals <= number of wallet owners and required_approvals > 0).

required_approvals = 2 # an example

Tip

You can pass in only one owner, and set the required_approvals to 0 to use the multi-sig wallet as a conventional wallet!

Add all your accounts to the constructor arguments in order. These accounts will be registered as wallet owners during deployment.

constructor_args = [[account_1, account_2,..., account_n], required_approvals]

Finally, deploy your wallet to your preferred network (I'm using the Sepolia testnet as an example here)

ape run scripts/deploy_multi_sig_wallet.py --network ethereum:sepolia:alchemy

This will prompt you to sign the transaction by entering your passphrase. Wait for some time as the deployment script deploys the contract and publishes the contract code on Etherscan.

And there you have it, your very own multi-sig wallet!

You can go to Etherscan, paste in your wallet's address, connect your Metamask account (which is one of the wallet owners), and start issuing, approving, and executing transactions!

Roadmap

  • Write the multi-sig wallet and factory smart contracts
  • Write deployment scripts
  • Conduct unit testing
  • Perform gas optimizations
  • Deploy the wallet on Sepolia testnet
  • Write Natspec documentation and generate docs
  • Write a good README.md

See the open issues for a full list of proposed features (and known issues).

Contributing

Check out CONTRIBUTING.md for contribution guidelines.

License

Distributed under the MIT License. See LICENSE.txt for more information.

Reach Out

Here's a gateway to all my socials, don't forget to hit me up!

Linktree