-
Notifications
You must be signed in to change notification settings - Fork 11.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Multisig in Sui #7187
Comments
Two questions considering the design:
|
Addressed them in the proposal - we will start with 10 as the max number of participating pubkeys and will be easy to increase in the future. This implementation does not allow updating since it is pinned to the address. If we consider account abstraction in the future, we will share a separate design. |
Main changes are in `multisig.rs`, `signature.rs` `crypto.rs` Design doc: #7187 See test: https://gist.github.com/joyqvq/5febd8deb5cacc6f47afa1253224b7da Next step: - [ ] Typescript util to compute multisig address - [ ] Typescript util to combine partial sigs - [ ] Explorer rendering of multisig
Dear team! I see this feature is supported on CLI. But how about Typescript SDK ? I can't see it! |
Motivation
Currently, Sui supports single signature for executing transaction with supported scheme
Ed25519, Secp256k1, Secp256r1
. This RFC provides standard for signatures format for multisig and address encoding. This benefits wallet providers and custody applications with more complex authorization path for transactions with native multisig support.Goals
Ed25519, Secp256k1, Secp256r1
).Non-Goals
Current Implementation (for Single Signature)
scheme || signature || pubkey
via [endpoint](https://docs.sui.io/sui-jsonrpc#sui_executeTransactionSerializedSig)scheme || sig || pubkey
Proposal: Mixed-Signing-Scheme Weighted Multisig
We want to support multisig that individual signature uses different signing schemes where each signature corresponds to a weight.
Example: A 2-of-3 multisig can have one signature is provided as
Secp256r1
(issued from the user device enclave) and another one signature is provided asEd25519
issued from a trusted custodian.Client Side
The types are defined as:
The verification algorithm
len(pks) > len(sigs) > k > 0
If not, fail to verify.flag_i || sig_i
use bitmap to find its verifying public keyi
Ifpk_i.verify(sig_i, msg)
passes, add weight to sum.Multisig Address
A k-of-n Multisig address is the first 20 bytes of SHA3-256 of
k || pk_1 || weight_1 || ... || pk_n || weight_n
of all participating public keys and its weight.Serialization
[struct MultiSignature] is serialized as the multisig flag (0x03) concat with the bcs serialized bytes of [struct MultiSignature] i.e.
flag || bcs_bytes(multisig)
.The serialization for [enum Signature] (i.e. single signature) is unchanged, ported from
ToFromBytes impl
forenum Signature
asflag || sig || pk
.Rationale
Due to the incompatibility of [enum Signature] (which dispatches a trait that assumes signature and pubkey bytes for verification), we add a wrapper enum where member can just implement a lightweight [trait AuthenticatorTrait]. This way Multisig (and future novel Authenticators) can implement its own
verify
without worrying abouttrait SuiSignature
andtrait SuiSignatureInner
that are specific to single signature verification.CLI Utility
execute_transactionSerializedSig
because it can understand the generic signature for both multisig and single sig and runsverify_secure_generic
.Improvements
Instead of sending all pubkeys when combining signatures, store all pubkeys in an immutable object onchain as a state. This is considered to save payload, but veto-ed for now to avoid a stateful implementation.
Consider Account Abstraction for new authentication schemes such that
verify
is ran via the MoveVM. So new authentication schemes can be implemented on-chain. This way we can enable updates to a multisig participating parties (add/remove pubkeys, update weights and threshold etc). We can also meters gas cost for verification accurately. This is out of scope here and deserves a design doc by its own in the future.Add typescript support same as the CLI.
With this implementation the signature length and verification time grows linearly with the number of users in the subgroup.
Main implementation: #7110
The text was updated successfully, but these errors were encountered: