--- tags: proposal, tech, cosmos title: Multisig / wormhole --- ## Multisig Improvemnts - [GH5661](https://github.com/cosmos/cosmos-sdk/issues/5661) / (wormhole) > STATUS: WIP The issue cosmos-sdk/GH5661 (former gaia/GH290) is about how to make the multisig process more accessible for the users. ### Summary We propose to use a modified magic-wormhole implementation as an input to the SPAKE2 protocol and as a network transport layer to provide a more convenient way for exchanging transactions and signature in a multisig context. ### Execution The multisigning session initiator shares a weak session key to all signing peers. The weak session key looks like this: `revolver` (OpenIssue #1). A Cosmos address and a generated channel id will be transparently added to this session key before deriving the stronger session key for communication with the signing peer via SPAKE2. This allows the multisigning session initiator to keep track of only 1 weak session key, but still have different weak session keys per signing user. It also helps distinguish between multisigning sessions in the unlikely event that two signing parties initiate multisigning sessions independently. One caveat is that all signing parties must be online and use the same SPAKE2 method of signing the multisignature transaction. ### Interaction Given the accounts C1^k^~p~, C2^k^~p~, C3^k^~p~ and the multisig account CM^k^~p~, and assuming that CM^k^~p~ initiates the process for multisig we have the following interaction: CM^k^~p~ requests the multisignature generation using the command line client: ``` $ gaiacli tx multisign tx.json CMk C1p C2p C3p multisig session id: bookseller channel 312 open with C1p channel 1241 open with C2p channel 634 open with C3p ... ``` the commmand will create 3 channels (as much as public keys are required for the multisig), and will print the session ID for this interaction. the actual communication string will be composed of: ``` CHANNEL_ID-SESSION_ID-CXp ``` where - `CHANNEL_ID` is a random number generated using the signer key + the random selected word as a seed for a random number generator with range restricted to 65536 (Open Issue #1) - `SESSION_ID` random world choosen from the wormhole wordlist - `CXp` public key for the account CX The `SESSION_ID` must be communicated by the CM to the CX and it is the actual weak password. The signers (CX) will on the other side have to run the command line client for signing a transaction providing the `SESSION_ID`: ``` $ gaiacli tx sign sendtx2.json --from $ALICE --multisig=$MULTI --chain-id=$CHAINID --session-id=bookseller do you want to inspect the tx? [no] signature executed successfully do you want to save the signed tx? [no] $ ``` at this point the intiator of the multisig process will receive confirmations from the signer and will be able to verify the signatures: ``` $ gaiacli tx multisign tx.json CMk C1p C2p C3p multisig session id: bookseller channel 312 open with C1p channel 1241 open with C2p channel 634 open with C3p ... got valid signature from C1p got valid signature from C3p got valid signature from C2p ``` ### Required infrastructure The partecipant to the multisig need to connect to lighthouse/relay to communicate to each other. The lighthouse has to be hosted as a centralized service and provides websocket connectivity to the parties (Open Issue #2). ### OPEN ISSUES 1. How to choose the channel id and what is the format of the pre-shared password? the channel id is equivalent to a tcp port, it must be unique for each key exchange but for ease-of-use it needs to be deterministic so both parties can derive it. it cant be based only on the receiver public key since will preclude the possibility to have multiple sessions running. maybe CM~p~ + CX~p~ ? 2. where to host the lightouse service? explore the possibility to use lambda functions for this service. the urls could be something like: `lighthouse.multisig.cosomos.network` ### Resources - [PAKE](https://en.wikipedia.org/wiki/Password-authenticated_key_agreement) protocol - [magic wormhole](https://github.com/warner/magic-wormhole) original, python - [magic wormhole](https://github.com/psanford/wormhole-william#api-usage) go implementation - reference implementation (legacy): https://github.com/apeunit/cosmos-sdk/tree/feature/gh290-multisig