Skip to content

Latest commit

 

History

History
129 lines (103 loc) · 1.33 KB

weighted-multi-sig.md

File metadata and controls

129 lines (103 loc) · 1.33 KB

Weighted Multi-Signature

We can express a weighted n-of-m voting by duplicating keys and signatures.

Regular Multi-Sig

Regular 3-of-5 example:

3 
<pub_key_1> 
<pub_key_2>
<pub_key_3>
<pub_key_4>
<pub_key_5>
5
OP_CHECKMULTISIG

Redeem example:

<sig_1> <sig_2> <sig_5>

Weighted Multi-Sig 3-of-5

Weighted 3-of-5 with pub_key_1 having up to two votes:

OP_IF
 OP_DUP
OP_ENDIF

3 
<pub_key_1>
OP_DUP
<pub_key_2>
<pub_key_3>
<pub_key_4>
5
OP_CHECKMULTISIG

Redeem example:

0 <sig_2> <sig_3> <sig_4>

or

1 <sig_1> <sig_4>

Weighted Multi-Sig 4-of-7

Weighted 4-of-7 with pub_key_1 having exactly three votes:

OP_DUP
OP_DUP

4
<pub_key_1>
OP_DUP
OP_DUP
<pub_key_2>
<pub_key_3>
<pub_key_4>
7
OP_CHECKMULTISIG

Redeem example:

<sig_1> <sig_2>

or

<sig_1> <sig_3>

Improved Weighted MultiSig

Every person of the weighted MultiSig can have an explicit weight. This scripts checks that the sum of the participants is greater than the threshold.

IF
   <key_personA>
   CHECKSIGVERIFY
   <weightA>
ELSE
   0
ENDIF
TOALTSTACK

IF
   <key_personB>
   CHECKSIGVERIFY
   <weightB>
ELSE
   0
ENDIF
TOALTSTACK

IF
   <key_personC>
   CHECKSIGVERIFY
   <weightC>
ELSE
   0
ENDIF
TOALTSTACK

...



FROMALTSTACK
FROMALTSTACK
FROMALTSTACK

...

ADD
ADD
ADD
<threshold>
GREATEREQUAL
VERIFY