Multi-signature smart contracts
A multi-signed account, or multisig for short, is a way to share the ownership of an address (and of the associated balance) between several participants. You can picture this as a joined account at a Bank or a treasury requiring multiple signatures before funds can be disbursed out of the account.
To act on a multisig, a fraction of the participants must agree on the action by signing it with their private keys. The minimal number of participants that need to agree for the action to be approved is called the multisig threshold. You may also see this being referred to as a Quorum.
Below is an illustration demonstrating the same.
Multisig contracts can be used in a variety of cases. For example:
-
Governance: Multi-sig contracts are a great way for DAOs(Decentralized autonomous organizations) to manage their treasury (i.e funds owned by the organization and not by an individual).
-
Security: Multisigs can help secure funds by requiring the signature of multiple participants before a transaction can be approved. For example, if an attacker gains an account's private keys, they can steal the account's tokens. However, if tokens are stored in a multisig, one compromised account is not enough to steal them.
In fact, some cryptocurrency exchanges use multisig contracts to protect the funds in their cold storage wallets.
- Escrow: Multisigs can hold funds in trust for two parties until the terms of a transaction are met.
In the next section, you will learn to write the contract for a multisig in SmartPy.
This contract will have 4 members and would require the signature of at least 3 members for funds to be sent to the proposed address.