Multi-signature functionality for StarkNet

Overview

Starknet multisig

Multi-signature functionality for StarkNet.

⚠️ WARNING! ⚠️

This repo contains highly experimental code which relies on other highly experimental code. Expect rapid iteration. Do not use in production.

Current preliminary version

The current version is a preliminary version. This version consists of three pieces:

  • Cairo contract code
  • Unit tests for testing all the multisig functionality
  • A very rough UI for testing a multisig

The current version supports only on-chain multi-signatures. The multisig is a separate contract, which is called through your regular account contract (wallet).

Usage

Network

You can try either in alpha network (Goerli) or mainnet, but alpha is highly recommended since it's a lot faster. Do note that faster means that it may take only 10 minutes for a transaction to go through, depending on the network conditions.

Using the Goerli network means you operate on Goerli through a separate StarkNet alpha network. You do not interact directly with the Goerli network.

Currently StarkNet devnet doesn't work properly with this version.

What is there to test?

Currently you can test the multisig with only one target contract. The target contract is a trivial contract which keeps track of some balance and has unrestricted functionality to update the balance. You can't change the target contract (without some development work).

If you want to have a fresh start, just refresh your browser window. No data is stored between sessions.

Fees

You do not need any assets in your wallets in order to use this functionality. StarkNet does not currently enforce fees and subsidises Goerli fees.

UI

The UI can be found at http://starknet-multisig.vercel.app.

How to use:

  1. If you don't have it yet, get the Argent X browser extension (not the regular Argent wallet!). Change the network to Goerli. Create some accounts
  2. Choose what the threshold is and how many signers there can be in total. The threshold states how many signers have to sign a transaction before it can be executed. The total number of signers states how many signers the contract supports in total.
  3. Enter owner addresses
  4. Deploy the multisig
  5. Enter some number in "Target balance" and submit the transaction
  6. Confirm the transaction with at least the threshold amount of signer accounts
  7. Execute the transaction. The displayed current balance in Target contract should reflect the changed balance.

Warnings

You should wait for each transaction to get status "ACCEPTED_ON_L2" (or L1) before proceeding with the next transaction. This can take some time. It may also take a bit of time for the UI to receive the latest data from the blockchain after a transaction has passed, so be patient.

There are very few UI validations currently. Enter sensible data in if you want to get sensible data out.

The network also doesn't provide any sensible error messages. If some of your transactions are rejected, you just have to figure out what failed in your setup.

Future development

In near future we'll get here:

  • A clearer UI
  • Possibility to choose an arbitrary target transaction
  • Possibly an option to use an account contract as multisig
  • Possibly off-chain signatures

Multisig implementation options

The current implementation uses Option 1 in the following image. Option 2 is in our roadmap for near future.

options

Fluffy stuff

Created by Equilibrium.

For support, free to poke LauriP#8728 at StarkNet Discord.

Comments
  • feat: support multi-wallets

    feat: support multi-wallets

    1. generalizing wallet related access/docs (StarkNet is a multi-wallet ecosystem)
    2. upgrading @argent/get-starknet to its latest version (which wraps get-starknet, StarkNet community's multi-wallet lib)
    3. replaced faucet link to point towards a multi-wallet supporting TST faucet (argent locks their faucet to argent-only wallets)
    opened by avimak 9
  • Code review findings - submit should also confirm + few other minor suggestions

    Code review findings - submit should also confirm + few other minor suggestions

    Hi Equilibrium team 👋

    Internally, Chainlink and ShardLabs teams have reviewed the current multisig codebase and we'll present our findings in this GH Issue. No critical findings surfaced, one UX optimisation that we'd like to have and few other minor suggestions (inconsistencies or code style).

    1. submit_transaction should also confirm transaction, as onlySigner is allowed. This would avoid the need to invoke a subsequent confirm_transaction from the same signer. Serum on Solana also implements it like this. (medium - functional)
    2. Event names mix present and past tense, e.g. ConfirmTransaction vs SignersSet (minor - API). We suggest past tense should be used for events, as do these resources: a. https://twitter.com/james_zaki/status/1323763725145239552 b. https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/GUIDELINES.md#solidity-code
    3. with_attr error_message("No direct invocations allowed"): is slightly confusing (LOC here). A better error message would be something like "Access denied - only multisig". (minor - API)
    4. _get_signers, _get_transaction_calldata, and _set_transaction_calldata functions should be considered to be renamed with an _range suffix , as to be consistent with other _range fn names. (minor - code style inconsistency)
    5. Function signature style inconsistent at Multisig.cairo#L208. (minor - code style inconsistency)
    6. In Multisig.test.ts there is some mixing of camelCase & snake_case. To improve TS readability we suggest using camelCase throughout the codebase (TS). (minor - code style inconsistency)

    Hope this helps prepare the codebase for an third-party audit 🙌

    Thank you!

    opened by krebernisak 8
  • Separate the UI to a different repository

    Separate the UI to a different repository

    This repository can still be named starknet-multisig.

    TODO (in order!):

    • [x] Separate the UI to a repo called ´starknet-multisig-ui`
    • [x] Close all pending pull requests from this contract repo
    • [x] Remove the frontend code from this repo in another PR
    opened by JaniAnttonen 4
  • Upgrade Account contract

    Upgrade Account contract

    • Change Account contract to the newest OpenZeppelin version. Not bringing in all of the OZ files, just hand-picked the required ones to one folder and fixed their imports
    • Non-account related contracts needed to be moved to their own folder, because compilation has to be done separately for account contracts and non-account contracts
    • Updated compilation script to reflect the changes
    deployed 
    opened by microbecode 4
  • Fix dummy UI to support StarkNet 0.9

    Fix dummy UI to support StarkNet 0.9

    Fix the current minimal UI to utilize the new StarkNet 0.9 contract deployment pattern.

    This is a good exercise to get hands dirty with the new deployment system.

    opened by microbecode 2
  • Fix unit test deployment for StarkNet 0.9

    Fix unit test deployment for StarkNet 0.9

    StarkNet version 0.9.0 introduced a new way of deploying contracts (https://starknet.io/docs/hello_starknet/deploying_from_contracts.html#the-deploy-system-call). Old way will be deprecated.

    Fix unit tests to use the new way of deploying contracts.

    opened by microbecode 2
  • Optimize for new devnet version

    Optimize for new devnet version

    New devnet version was released.

    • Re-enable devnet restart in unit tests
    • Remove superfluous dump delays
    • Update hardhat at the same time. Running all unit tests in venv went down from 10mins to 3 mins!
    deployed 
    opened by microbecode 1
Owner
Equilibrium
Equilibrium is a research and development company focused on core infrastructure for the distributed web.
Equilibrium
StarkNet support extension for VSCode. Visualize StarkNet contracts: view storage variables, external and view functions, and events.

StarkNet Explorer extension This VSCode extension quickly shows relevant aspects of StarkNet contracts: Storage variables of the current contract, and

Crytic 6 Nov 4, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Simple-load-more - This jQuery function will add a functionality to load 5 (or custom) more items. No AJAX functionality.

Simple Load More This jQuery plugin will add a functionality to load 5 (or custom) more items. Best for lists that are long and you want to hide all e

Zeshan Ahmed 28 Jan 4, 2023
JavaScript OAuth 1.0a signature generator (RFC 5849) for node and the browser

OAuth 1.0a signature generator for node and the browser Compliant with RFC 5843 + Errata ID 2550 and community spec Installation Install with npm: npm

Marco Bettiolo 230 Dec 16, 2022
Simple implementation of online contract signature.

react-pdf-signaturer Simple implementation of online contract signature. Example online demo: https://buynao.github.io/react-pdf-signaturer/ Usage $ g

law 20 Nov 28, 2022
A component built in angular 13 which can generate an signature image in different fonts based on the selection.

AngularSignatureGenerator This project was generated with Angular CLI version 13.2.6. Development server Run ng serve for a dev server. Navigate to ht

Rohith P 4 Apr 26, 2022
I'm trying to create simple program for adding the digital signature to a pdf file with self-signed certificate. I use node-signpdf and pdf-lib library.

pdf-digital-signature-with-node-signpdf-ejs I'm trying to create simple program for adding the digital signature to a pdf file with self-signed certif

null 5 Dec 25, 2022
Reward your community using NFTs and thirdweb's signature based minting.

Community Rewards Example Introduction In this guide, we will utilize signature-based minting of NFTs as a mechanism to reward users of a specific com

thirdweb examples 18 Jan 2, 2023
Node JS utility to check the signature of Apple P12 Certificates.

CertCheck Node JS utility to check the signature of Apple P12 Certificates. Confirmed to work on macOS and Linux. Windows may need slight changes. Wor

Jailbreaks.app Team 10 Dec 24, 2022
Use signature-based minting to allow users who have contributed to your github repositories to claim an NFT!

GitHub contributors NFT rewards This project demonstrates how you can build a full-stack web3 application that allows github contributors of certain r

thirdweb templates 8 Nov 5, 2022
Modern, Flexible Starknet Dapp Template

cairopal • Modern, Flexible Starknet Dapp Template. Developing Clone the repository git clone [email protected]:a5f9t4/cairopal.git cd cairopal Install D

andreas 38 Sep 28, 2022
Verbosely Documented, Minimal Starknet Contract Examples.

cairo-by-example • Verbosely Documented, Minimal Starknet Contract Examples. Cairo By Example deployed to https://cairo-by-example.xyz Developing Clon

andreas 63 Dec 6, 2022
A simple environment to start building on Starknet with Cairo

Starknet Boilerplate A simple environment to start building on Starknet with Cairo. Uses Nile for compilation/deployment and Starknetjs for contract i

threepwave 19 Dec 11, 2022
A set of librairies in Cairo for use on StarkNet

Sekai StarkNet Libraries A series of libraries to help using Cairo on StarkNet. Examples for use in other Cairo contracts are provided in examples. Co

Sekai 38 Nov 14, 2022
This is a development platform to quickly generate, develop & deploy smart contract based applications on StarkNet.

generator-starknet This is a development platform to quickly generate, develop, & deploy smart contract based apps on StarkNet. Installation First, in

Only Dust 34 Nov 18, 2022
StarkNet wallet <-> dApp bridge

get-starknet StarkNet wallet <-> dApp bridge Alpha version Goals Allow dApps to seamlessly connect to any wallet on StarkNet Allow wallets to seamless

null 44 Dec 21, 2022
Adapter application for consuming web3 messages from ie. wallets, and passing them on to starknet

?? StarknNet web3 account Development setup Clone deps with submodules git clone --recurse-submodules [email protected]:software-mansion-labs/starknet-we

Software Mansion – Labs 20 Nov 21, 2022
scaffold-stark is a forkable StarkNet dev stack focused on fast product iterations, inspired by scaffold-eth.

?? scaffold-stark scaffold-stark is a forkable StarkNet dev stack focused on fast product iterations, inspired by scaffold-eth. Drop in your Cairo sma

parketh 25 Oct 7, 2022