This page implemenents a range proof using the Borromean Ring Signature (BRS) method [here] for a range of 0 to \(u^l\). With the Borromean Ring signer method, we can create a number of rings, and then sign a message with one of the private keys on each of the rings. In this case, we will create one ring with three keys and another ring with three keys, and we will then sign with one key from each ring. This should be verified. We will then replace one of the private keys so that there will be no public key on the rings, and which should negatively verify. A Borromean ring, in maths, is defined as three closed curves that cannot be separated from each other but can be unknotted when one of the rings is cut or removed.
Range Proof with Borromean Ring Signature (BRS) for a range from 0 to \(u^l\) |
Ring signatures
And so there has been a leak of information at the White House. Donald Trump calls in his Cyber Security leads, and tells them, “I know one of you leaked the information, but I can’t tell which one”. How can Donald tell that one of his leads has leaked the information, but not know which one? Well, this can be achieved with a ring signature, and which provides anonymity, unforgivably and collusion resistance.
A ring signature is a digital signature that is created by a member of a group that each have their own keys. It is then not possible to determine the person in the group who has created the signature. The method was initially created by Ron Rivest, Adi Shamir, and Yael Tauman in 2001, and in their paper, they proposed the White house leak dilemma.
Creating the ring
In a ring signature, we define a group of entities who each have their own public/private key pairs of \((P_1, S_1), (P_2, S_2), …, (P_n, S_n)\). If we want an entity i to sign a message (message), they use their own secret key (\(s_i\)), but the public keys of the others in the group (\(m,s_i,P_1...P_n\)). It should then be possible to check the validity of the group by knowing the public key of the group, but not possible to determine a valid signature if there is no knowledge of the private keys within the group.
So let’s say that Trent, Bob, Eve and Alice are in a group, and they each have their own public and secret keys. Bob now wants to sign a message from the group. He initially generates a random value \(v\), and then generates random values (\(x_i\)) for each of the other participants, but takes his own secret key (\(s_i\)) and uses it to determine a different secret key, and which is the reverse of the encryption function.
Borromean ring signing
With the Borromean Ring signer method, we can create a number of rings, and then sign a message with one of the private keys on each of the rings. In this case, we will create one ring with three keys and another ring with three keys, and we will then sign with one key from each ring. This should be verified. We will then replace one of the private keys so that there will be no public key on the rings, and which should negatively verify.
Ring signatures have been used in a range of cryptocurrency application, and are used to anonymise the sender and the recipient of a transaction. This overcomes the problem of Bitcoin, which only does pseudo-anonymity.
Coding
The following is some simple coding to prove the method:
package main import ( "fmt" "math/big" "os" "strconv" "math" "github.com/blockchain-research/crypto/brs" "github.com/btcsuite/btcd/btcec" ) func GetBigInt(value string) *big.Int { i := new(big.Int) i.SetString(value, 10) return i } func powInt(x, y int) int { return int(math.Pow(float64(x), float64(y))) } func main() { xval := 7 a := 2 b := 3 argCount := len(os.Args[1:]) if argCount > 0 { xval, _ = strconv.Atoi(os.Args[1]) } if argCount > 1 { a, _ = strconv.Atoi(os.Args[2]) } if argCount > 2 { b, _ = strconv.Atoi(os.Args[3]) } h := GetBigInt("18560948149108576432482904553159745978835170526553990798435819795989606410925") curve := btcec.S256() hx, hy := curve.ScalarBaseMult(h.Bytes()) br := brs.SetupUL(int64(a), int64(b)) //range should be within [0,u^l), [0,10^2) x := new(big.Int).SetInt64(int64(xval)) // Generate proof for value proof, rsum := br.ProveUL(x) // Compute Commitment cmx1, cmy1 := brs.Commit(x, rsum, hx, hy) //verify proof result := br.VerifyUL(proof, cmx1, cmy1) if result == true { fmt.Printf("Verification. %d is between 0 and %d\n", xval, powInt(a, b)) fmt.Printf("Proof: C=%v\n", proof.C) fmt.Printf("Verfication: cmx1=%v\n", cmx1) fmt.Printf("Verfication: cmy1=%v\n", cmy1) } else { fmt.Printf("No verification. %d is not between 0 and %d", xval, powInt(a, b)) } }
A sample run is:
Verification. 54 is between 0 and 243 Proof: C=[[113753976595824139106847729527612404984193536309387661733544557855090100941380 49704350862069682507333390099500344808224662375865172571834952302823703187226] [44132788630552368824702818647405520276854471082681621183903059164673148453409 112657428173711757619335890179844033349042944849902694787235847608514501843406] [52452370281191851376137816637221205089673851614356566817625613050006752482651 26095884236216696716580985911448489366340587283313030963467652662661218687401] [38999714362692500644515725532625384429326142472225179478472958705100481149829 97281927999034188696117227831994295123966596543465085276245298943223822158312] [56713049156232941875526987754177683047257784872751007115880183444449896674824 57441451640577174448163019277766892409802826143730188598380570618727364418730]] Verfication: cmx1=31898815640990248918016416243147760064413228226691848701658981147561996974896 Verfication: cmy1=12671447146411625797483012721123908722197979907030180782218801345466075069509
and for:
No verification. 54 is not between 0 and 27
Reference
[1] Poelstra, A., Back, A., Friedenbach, M., Maxwell, G., & Wuille, P. (2018, February). Confidential assets. In International Conference on Financial Cryptography and Data Security (pp. 43–63). Berlin, Heidelberg: Springer Berlin Heidelberg..