Make Multisig transactions with Beem without spending all day in the transaction builder.

This is in response to @timcliff's bounty post and @crokkon's initial solution. While Crokkon's solution is a good one and he got there first, I think it has some usability issues that are fairly easily resolved, so I thought I would write them up.

This tutorial requires the tools Beem and Beempy by @holger80, for which installation instructions can be found here.

Setting up our multiauth account

Beempy makes this surprisingly easy. We need to have the active key for the target account imported into the wallet, but then we can do this easily from the command line with the allow command, which takes several arguments. The generic form of the command is:

allow -a [Target account] --permissions [Permission] --weight [Weight] --threshold [Threshold] [Authorized account or public key]

I used the heron-themed accounts I have, with @green-heron the account being saddled with multi-sig permissions. The goal was to have two accounts with 25% weight, and five accounts with 10% weight, with a final required weight of 40%.

beempy allow -a green-heron --permission active --weight 25 tcpolymath
beempy allow -a green-heron --permission active --weight 25 herons-unlimited
beempy allow -a green-heron --permission active --weight 10 great-blue-heron
beempy allow -a green-heron --permission active --weight 10 night-heron
beempy allow -a green-heron --permission active --weight 10 goliath-heron
beempy allow -a green-heron --permission active --weight 10 snowy-egret
beempy allow -a green-heron --permission active --weight 10 --threshold 40 whistling-heron

Saving the threshold value for last is necessary because we're using the active key and also setting it to multi-auth; if we set the threshold beforehand we'll have to either import the owner key for the account or set up a multi-auth transaction in order to make the new authorizations.

This isn't necessary for setting up multi-auth on the posting key, which can be done simply by removing the "--permission active" option from the commands.

Using our multi-auth account to send transfers algorithmically

Here we do need Beem's transaction builder, but we can be fairly simple about it. First we load the required functions, initialize the Steem instance, and begin a transaction:

from beem import Steem
from beem.transactionbuilder import TransactionBuilder
from beembase.operations import Transfer

stm=Steem()
tx = TransactionBuilder(steem_instance=stm)

Then we build our basic transfer transaction and add it to the transaction object, which Beem makes very easy and self-explanatory:

transfer={"from": "green-heron", "to": "tcpolymath", "amount": "1 STEEM", "memo": "multisig transaction example"}
tx.appendOps(Transfer(transfer))

After this, we need to get the signatures, and sign the transaction. If we have them all available in our Beem wallet this is again very simple:

tx.appendSigner('herons-unlimited', 'active')
tx.appendSigner('great-blue-heron', 'active')
tx.appendSigner('night-heron', 'active')

As long as we're signing things algorithmically, where the same program would be attaching all of the signatures - say, for instance, we're a front end collecting signatures from the users - this method works well even when we pass the transaction object tx throughout our program and sign it at different times. It is possible to pass the transaction manually between humans in different locations extremely clumsily by exporting the signed transaction as a JSON and having each person sign it individually, but practically it's hard to see a real-life application for that process. It would be easier to spin up a simple web front end to get the necessary signatures than to do the manual process more than about three times.

However we've acquired the necessary signatures, once we have them we simply sign and broadcast the transaction:

tx.sign()
tx.broadcast()

And then we're done. It's actually surprisingly easy. You can see my example transaction here.

Steem.png

H2
H3
H4
3 columns
2 columns
1 column
10 Comments
Ecency