dmfxyz / supersig

Simple "commit-reveal" multisig in vyper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SuperSig

sign stuff

Supersig is a multisig written in vyper. It can be used in coordination with the supersig frontend.

The motivation for writing the supersig contract itself is to help avoid monoculture around decentralized tools. Vyper was specifically chosen as most multisig tooling is currently written in Solidity.

At this point in time this repo is a proof of concept. The mechanism design can be improved, and the code has not been closely reviewed. It is unit tested using ApeWorx, and it does work in a very basic sense.

At a high level, Supersig works like this:

  1. You deploy supersig with a list of owners and a minimum number of approvals (can be done via UI)
  2. Someone propose's a proposal
    • a proposal is very simple. It consists of an id, which is a number, and a proposal hash.
    • a proposal hash is a 32 byte commitment to the intended transaction. The commitment is keccak256(target_address . target_calldata . target_transaction_value)
  3. Owners call approve on a proposal ID
  4. Someone executes the proposal, providing the full intended transaction. The proposal only executes if the keccak256 of the provided transaction matches the proposed commitment hash.

The intent of Supersig is to keep all approval and proposal actions on-chain, without revealing the intent of the proposal until it's executed.

Supersig was written as part of the ETHNYC 2022 Hackathon. It uses Apeworx, Vyper, Pokt, and Privy who were among the awesome sponsors of the event.

For an offline, EIP712-based multisig in vyper, also see ricobank/multisig

Setup

Recommend using miniconda

  1. Create a new environment and activate
$> conda create --name supersig python==3.10.4
$> conda activate supersig
  1. Install apeworx
$> (supersig) python -m pip install -U pip
$> (supersig) python -m pip install eth-ape
$> (supersig) ape plugins install vyper
  1. Make sure stuff works
$> ape test
========================================== test session starts ===========================================
platform darwin -- Python 3.10.4, pytest-7.1.2, pluggy-0.13.1
rootdir: /Users/Dan/scontract/supersig
plugins: eth-ape-0.3.3, web3-5.29.2
collected 15 items                                                                                       

tests/test_supersig.py ...............                                                             [100%]

========================================== 15 passed in 19.94s ===========================================

Deploying to Testnet

(assumes you have a wallet with some Testnet eth)

  1. Import the wallet to ape and give it the testnet
$> (supersig) ape accounts import testnet
  1. Create three signer addresses for testing
$> (supersig) ape accounts generate signer1
$> (supersig) ape accounts generate signer2
$> (supersig) ape accounts generate signer3
  1. Run deploy job
$> (supersig) ape run scripts/deploy_testnet.py --network ethereum:rinkeby

About

Simple "commit-reveal" multisig in vyper

License:MIT License


Languages

Language:Python 75.1%Language:Vyper 24.9%