[Ethereum] How multiple people signing works

contract-developmentofflinesignaturesolidity

I had created a DAO smart contract where around 20 people vote for proposals. They each make new Tx.

Offline signing is nice to minimize gas cost. Wondering how offline signing works with contract functions, that too with multiple people signing different votes?

I heard that multiple people signs their balance in lighting network channel state.

Best Answer

You use signing in the same way that you would if one person was signing. Each person will have to pay the transactions costs needed to submit their signature. However you could create a single function that will automatically parse all signed messages for slightly cheaper than if you were to submit a new transaction to parse each signed message. You could potentially implement something like merkle airdrops (https://blog.ricmoo.com/merkle-air-drops-e6406945584d)

There are a few gotchas that come with verifying signed messages, I have a set of contracts and python signer program which demonstrate the workflow needed to sign messages:

When signing messages they get prepended with the following data: https://github.com/postables/Postables-Payment-Channel/blob/7d2f91bb060f80b139cab72b5fdff79d116f6210/solidity/ChannelsV4.sol#L12

I also have a python script which can be used to sign messages: https://github.com/postables/Postables-Payment-Channel/blob/develop/python/signer.py

The following solidity function details how to verify the ORIGINAL message that was signed, along with the signer of the signed message: https://github.com/postables/Postables-Payment-Channel/blob/7d2f91bb060f80b139cab72b5fdff79d116f6210/solidity/ChannelsV4.sol#L257

The following solidity function details how to verify the signer of a message: https://github.com/postables/Postables-Payment-Channel/blob/7d2f91bb060f80b139cab72b5fdff79d116f6210/solidity/ChannelsV4.sol#L192

Related Topic