The Simplest Multisig Wallet — Part 2

This is a continuation of The Simplest Multisig Wallet Part1. In that article I introduced the idea of a multisig wallet and showed how to configure a sample wallet. Here I will walk you through the steps of approving your first transaction. If you’re asking yourself why you would ever want to use a multisig wallet, then I recommend that you read part 1.

Review

The multiSig wallet that we are using is the Simple-Multisig-Wallet. The Ethereum contract was written by Christian Lundkvist. You can refer to this article by Alex Miller to see why this is an exceptionally secure contract. The UI that we are using to deploy and access the contract was written by Pratyush Bhatt, and it is hosted at https://riverdimes.io/wallet courtesy of the Riverdimes organization. Both the contract and the User Interface are open source and free to use (source code is available on github here and here).



In part 1 of this article I walked you through the process of setting up a multisig wallet with 2 owners, me and my partner, Sal, configured such that each transaction requires approval from both of us. This kind of wallet is handy, for example, in a partnership where both partners want to be involved in every expenditure from a joint account.

Locating the Wallet

Since I was the one who created the sample wallet, I already had the wallet address, 0xe78a0f7e…. I sent the address to my partner, Sal, in a regular old email. That’s where we left off; now to continue the process, Sal browses to https://riverdimes.io/wallet, and clicks on the Import-Wallet button. He enters the wallet address and a descriptive name for the wallet, and clicks Load-Wallet.

Sal loading the wallet at a specified address

Once Sal loads the wallet he can enter descriptive names for the owner

accounts and then save the wallet, as below:

After the wallet has been loaded

Sal has entered names for the owner-accounts and is saving the wallet

Viewing the Wallet

Now we can view the wallet by clicking on the View-Wallet button. Anyone can fund the wallet by sending Ether to the wallet address; and either Sal or I can create a transaction (but both of us need to approve the transaction before it actually executes). For this example I funded the sample wallet by sending it 10 ETH. The image below shows how the wallet appears to Sal when he clicks the View-Wallet button:

This is what Sal see when he clicks the View-Wallet button

Creating a Transaction

In the image below I am creating a transaction to transfer 1 ETH to address 0x22d491bde…. Note that there is no requirement for this address to belong to either me or Sal. The UI tells me that the current nonce for the wallet is 0. You will generally want to use the current nonce when you create a transaction. The only exception would be if you were creating multiple transactions, in which case you would use incrementing nonces for each transaction. But if you’re going to do that then beware, because the transactions will need to be executed in order.

Creating a transaction to transfer 1 ETH

Signing the Transaction

Now that I’ve created the transaction I’ll need to approve, or “sign” it. The wallet account-owners can sign transactions in any order. As a matter of fact, the signatures actually are not sent to to the wallet contract until all of them have been assembled, and then someone presents them, by clicking the Execute-This-Transaction button. For now, since I just created the transaction, and I already have my MetaMask account open, I’ll generate my signature by clicking the Sign-This-Transaction button.

When you sign a transaction you’ll be presented with a scary-looking warning from MetaMask, because it doesn’t understand what you’re signing. Lucky for us, Christian Lundkvist and other Ethereum mavins looked over this contract very carefully… so we’re pretty confident that there is nothing amiss. (If you want to convince yourself that everything is kosher, then you can examine the contract at the destination address shown in the MetaMask dialog using etherscan.io; then you can assure yourself that the contract matches Christian Lundkvist’s original source).

Scary message from MetaMask when I sign a transaction

After I sign the transaction, it looks like this:

Transaction with my signature

Sending My Signature to the Other Account Owner

One of the things that makes the Simple Multisig Wallet so simple is that it doesn’t try to do more than its fundamental function. Case in point, there is no built-in function to communicate transactions to the other signers. But this is a relatively straight-forward task. In the images below you can see that I’m just highlighting all the relevant transaction information, so that I can copy and send it to Sal in an email (which I clean up a bit vis-a-vis whitespace, and adding a little blather).

Copying the Transaction and Signature

My Note to Sal…

Countersigning the Transaction

When Sal clicks the Transaction button he see the following:

Sal’s view before he enters the transaction data

And after copying the transaction information from my email he sees this:

Sal Enters the Transaction Info Including My Signature

If Sal approves of the transaction then all he needs to do is sign it by clicking

on the Sign-This-Transaction button. When Sal signs the transaction, he’ll also get the scary warning from MetaMask:

Sal adding his signature to the transaction

The image below shows the transaction, which has now been signed by both me and Sal:

The transaction is now signed by all account owners

Executing the Transaction

Since we’ve collected the requisite number of signatures, all that remains is to execute the transaction. Executing the transaction entails sending the transaction together with all the signatures to the wallet contract. In the images you can see what Sal sees as he executes the transaction. In the last image you may note that 1 ETH has been deducted from the wallet.

The MetaMask transaction being sent to the wallet contract

Waiting for the transaction to vomplete

The transaction is complete

Summary

david.rosen@xirrus.comIn this article I walked you through the process of creating a multisig transaction, collecting signatures and executing the transaction. It’s all quite simple, but it’s nice to see it every step of the way — especially if you’re going to be dealing with significant sums. In an upcoming article I’ll walk you through the process of using a multisig wallet for other sorts of transactions.



I’d like to thank Christain Lundkvist for writing the Simple Multisig Wallet contract, and Pratyush Bhatt for creating the user interface. I’m convinced that Ethereum’s greatest asset is the prevalence of so many talented and idealistic developers who contribute projects like this.