Skip to content

3-out-of-5 Threshold Signature#

Let's say you want to create a ring spending contract, where any member of a group can make a transaction from the same address, but you do not want anyone else to know which specific member is spending the funds. This is not possible with Bitcoin. While Ethereum can achieve this, it would be expensive and complicated – especially with a ring size of 10 or 20 members, which might be required for robust privacy.

With Ergo, this kind of application can be created quickly, thanks to the integration of Sigma protocols in the core. This enables self-sovereign application-level privacy: trustless scripts that can be used to access mixers or other functionality without requiring any third parties.

val ringScript = s"""
{
atLeast(
  3, 
  Coll(
    PK("9f8ZQt1Sue6W5ACdMSPRzsHj3jjiZkbYy3CEtB4BisxEyk4RsNk"), 
    PK("9hFWPyhCJcw4KQyCGu4yAGfC1ieRAKyFg24FKjLJK2uDgA873uq"), 
    PK("9fdVP2jca1e5nCTT6q9ijZLssGj6v4juY8gEAxUhp7YTuSsLspS"), 
    PK("9gAKeRu1W4Dh6adWXnnYmfqjCTnxnSMtym2LPPMPErCkusCd6F3"),
    PK("9gmNsqrqdSppLUBqg2UzREmmivgqh1r3jmNcLAc53hk3YCvAGWE")
  )
)
}

The above is an example of a 3-out-of-5 threshold signature script, which can be compiled to a Pay-to-Script (P2S) address.

Sending Ergs to the resulting address locks them under the protection of this threshold signature contract.

Here is a good introduction to making a signature.