[{"data":1,"prerenderedAt":791},["ShallowReactive",2],{"docs-\u002Fdocs\u002Fcore-tech\u002Flelantus-mw":3,"docs-surround-\u002Fdocs\u002Fcore-tech\u002Flelantus-mw":782},{"id":4,"title":5,"body":6,"description":12,"extension":774,"image":775,"meta":776,"navTitle":775,"navigation":777,"path":778,"seo":779,"stem":780,"__hash__":781},"docs\u002Fdocs\u002Fcore-tech\u002FLelantus-MW.md","Lelantus MW",{"type":7,"value":8,"toc":758},"minimark",[9,13,24,29,38,41,46,49,67,70,81,84,87,114,117,120,127,130,134,140,152,170,174,177,184,195,198,201,230,233,260,263,266,282,286,289,300,303,352,356,359,368,371,375,378,385,392,395,412,422,432,448,451,490,494,500,503,516,523,541,544,563,575,578,604,607,610,657,660,714,719,722,726,748,752,755],[10,11,12],"p",{},"Linkability is the Achilles' heel of MW.",[10,14,15,16,23],{},"Beam has several ",[17,18,22],"a",{"href":19,"rel":20},"https:\u002F\u002Fgithub.com\u002FBeamMW\u002Fbeam\u002Fwiki\u002FTransaction-graph-obfuscation",[21],"nofollow","improvements"," to the original MW to obfuscate the transaction graph. Now we're building a hybrid, of MW and Lelantus, which should be a huge step forward in this direction.",[25,26,28],"h2",{"id":27},"disclaimer","Disclaimer",[10,30,31,32,37],{},"The ",[17,33,36],{"href":34,"rel":35},"https:\u002F\u002Flelantus.io\u002F",[21],"Lelantus protocol"," is the work of Zcoin's cryptographer Aram Jivanyan as part of its research to improve its privacy protocol.",[10,39,40],{},"Our design and implementation are based on the publicly-available Lelantus scientific paper. All our code was developed from scratch based on this paper alone.",[42,43,45],"h1",{"id":44},"our-design","Our design",[10,47,48],{},"To fit our needs and utilize the full power of MW we made several modifications to the original protocol.",[50,51,52,61,64],"ol",{},[53,54,55,56,60],"li",{},"Instead of focusing on transaction types described in the paper (Mint, Spend, Joint-Split) we implement this in terms of ",[57,58,59],"em",{},"primitives",", which can be combined and used in various transaction types.",[53,62,63],{},"Minted\u002Fspent values are never revealed.",[53,65,66],{},"We use other technique to prove the transaction balance. We removed the balance proof from the original Lelantus protocol, hence it's now closer to the original Sigma protocol by Jens Groth.",[10,68,69],{},"MW blockchain consists of the following objects (primitives):",[50,71,72,75,78],{},[53,73,74],{},"Inputs - references to existing UTXOs, that are being spent",[53,76,77],{},"Outputs",[53,79,80],{},"Transaction kernels",[10,82,83],{},"Our design, which we call Lelantus-MW, keeps this structure, and the Balance-to-zero principle also holds.\nAll those 3 object types, however, are modified to support Lelantus.",[10,85,86],{},"We use the following notation in the code:",[88,89,90,97,103],"ul",{},[53,91,92,96],{},[93,94,95],"strong",{},"G"," - generator (nothing-up-my-sleeve EC point) multiplied by UTXO blinding factor",[53,98,99,102],{},[93,100,101],{},"H"," - generator multiplied by UTXO Value",[53,104,105,108,109,113],{},[93,106,107],{},"J"," - generator multiplied by UTXO 2",[110,111,112],"sup",{},"nd"," blinding factor (i.e. double-blinded commitment).",[25,115,77],{"id":116},"outputs",[10,118,119],{},"Normal MW output consists of a Pedersen commitment (EC point) and the Bulletproof signature. After validation it's added to the UTXO set, and later can be referenced as inputs in consequent blocks\u002Ftransactions.",[10,121,122,123,126],{},"The modified output, used in Lelantus, is called ",[57,124,125],{},"Shielded"," output. Unlike normal output, shielded output is double-blinded, hence its bulletproof is (slightly) extended.",[10,128,129],{},"After validation it's added to the Shielded pool (rather than UTXO set).",[25,131,133],{"id":132},"kernels","Kernels",[10,135,136,137,139],{},"As we said, shielded outputs are double-blinded. Hence, in order to keep the balance-to-zero principle, transaction kernels can optionally contain the 2",[110,138,112],{}," blinding factor excess as well. So that transactions are allowed to have excess of both blinding factors, but not the value (obviously).",[10,141,142,143,147,148],{},"Such kernels are signed by ",[144,145,146],"u",{},"generalized Schnorr's signature"," (rather than normal Schnorr's signature), to prove that their revealed commitment is indeed of the form ",[149,150,151],"code",{},"k*G + s*J",[10,153,154,158,159,162,163,166,167,169],{},[155,156,157],"b",{},"Note:"," the generalized Schnorr's signature does not reveal which part of the kernel commitment is due to each of the blinding factors. I.e. the attacker can't split it into ",[149,160,161],{},"k*G"," and ",[149,164,165],{},"s*J",". This is important, as the 2",[110,168,112],{}," blinding factor (a.k.a. serial number) eventually gets revealed, there is still no way to identify its corresponding transaction kernel.",[25,171,173],{"id":172},"inputs","Inputs",[10,175,176],{},"Normal inputs are just commitments (EC points) that correspond to previous outputs that must be in the current UTXO set.",[10,178,179,180,183],{},"Shielded inputs, in addition to the commitment, have the ",[144,181,182],{},"Spend Proof",", which proves that:",[88,185,186,189,192],{},[53,187,188],{},"A valid shielded element is being-spent",[53,190,191],{},"No double-spend",[53,193,194],{},"The specified input commitment encodes the value equal to the one being spent (with different blinding factor though).",[42,196,182],{"id":197},"spend-proof",[10,199,200],{},"In the original Lelantus paper the proof idea is the following:",[88,202,203,209,215,222],{},[53,204,205,206],{},"Convert the revealed public Spend Key into serial number ",[149,207,208],{},"s",[53,210,211,212,214],{},"Subtract (methodically) ",[149,213,165],{}," from each commitment in the referenced anonymity set (a.k.a. cmList)",[53,216,217,218,221],{},"Prove the knowledge of the opening of one of the elements in the form of ",[149,219,220],{},"k*G + v*H",", i.e. without the serial number",[53,223,224,225],{},"Additionally prove that the revealed being-extracted value corresponds to the value of that element\n",[88,226,227],{},[53,228,229],{},"For this the original Sigma protocol was modified",[10,231,232],{},"We modified it into the following:",[88,234,235,239,249,255],{},[53,236,205,237],{},[149,238,208],{},[53,240,241,242,245,246,248],{},"Prove that the revealed commitment ",[149,243,244],{},"C"," is of the form ",[149,247,220],{},", i.e. does not conceal additional serial number",[53,250,211,251,254],{},[149,252,253],{},"s*J + C"," from each commitment in the referenced anonymity set",[53,256,217,257,259],{},[149,258,161],{}," only, i.e. without the serial number or additional value",[10,261,262],{},"In such a scheme there is no need to provide additional balance proof, since the value of extracted commitment should be the same as of the element being-spent. Because of this there is also no need to prove the value is non-negative (by bulletproof), as it was already proven when the element was added to the shielded pool.",[10,264,265],{},"So, the whole Spend proof, in addition to the commitment being-extracted, contains the following:",[88,267,268,273,276],{},[53,269,270,271],{},"Generalized Schnorr's proof that this commitment is of the form ",[149,272,220],{},[53,274,275],{},"Public spend key, and the whole spend proof is signed by the appropriate private key",[53,277,278,279,281],{},"Standard 1-out-of-N Sigma protocol in terms of a single ",[149,280,95],{},"-generator only.",[25,283,285],{"id":284},"compared-to-original-lelantus-paper","Compared to original Lelantus paper",[10,287,288],{},"What is similar:",[88,290,291,294,297],{},[53,292,293],{},"Shielded outputs are double-blinded, with the appropriate (extended) bulletproof signature",[53,295,296],{},"To spend a shielded element the public Spend Key must be revealed, and the Spend Proof must be signed by the appropriate private key",[53,298,299],{},"Spend proof is also based on the 1-out-of-N Sigma protocol (by Jens Groth)",[10,301,302],{},"What is different:",[88,304,305,327,330,333],{},[53,306,307,308],{},"Rather than specifying transactions, Lelantus-MW is formulated in terms of inputs and outputs (i.e. MW-style). Hence:\n",[88,309,310,313,316],{},[53,311,312],{},"Just a single type of shielded input and output primitive is enough",[53,314,315],{},"Transactions are easily merged (as usual)",[53,317,318,319],{},"Despite better size and verification time, we don't implement multi-input spend proofs.\n",[88,320,321,324],{},[53,322,323],{},"Limiting all the inputs to the same anonymity set seems to be practically restricting",[53,325,326],{},"This also potentially reveals their linkability",[53,328,329],{},"Added\u002Fspent values are never revealed",[53,331,332],{},"Separate balance proof is not required: it's an inherent part of each MW block\u002Ftransaction.",[53,334,335,336],{},"Spend proof is improved\n",[88,337,338,341,344],{},[53,339,340],{},"Implemented in terms of classical (unmodified) Sigma protocol",[53,342,343],{},"Significantly smaller size",[53,345,346,347],{},"Better verification time\n",[88,348,349],{},[53,350,351],{},"Significant in batch mode, when all the proofs refer to the same anonymity set",[42,353,355],{"id":354},"direct-anonymous-payments","Direct anonymous payments",[10,357,358],{},"In classical MW payments are interactive, and this is unavoidable: payment means creating an UTXO for someone else, however in order to create such an UTXO and its bulletproof the creator needs its blinding factor, hence it owns it, means it must be the payee.",[10,360,361,362,367],{},"We ",[17,363,366],{"href":364,"rel":365},"https:\u002F\u002Fgithub.com\u002FBeamMW\u002Fbeam\u002Fwiki\u002FOne-side-payments",[21],"designed"," a mechanism to allow one-side payments after initial setup (currently fully supported in Node, but not in the wallet), however it's less anonymous, and the functionality is limited.",[10,369,370],{},"Lelantus doesn't have this limitation. It's possible to create a shielded output, such that the creator itself can't spend (thanks to the idea with Spend pubkey). What's remaining is the \"coloring\" scheme of the shielded output, i.e. how to make it distinguishable to the payee only, but not to others, including those that pay to the same payee.",[25,372,374],{"id":373},"standard-bulletproof-coloring-scheme","Standard bulletproof coloring scheme",[10,376,377],{},"(based on the coloring scheme used by secp256k1 library)",[10,379,380,381,384],{},"Our standard UTXO coloring scheme allows to embed an arbitrary 255-bits long description. In practice we use 24-byte description, which we call ",[57,382,383],{},"Coin ID",".",[10,386,387,388,391],{},"During bulletproof construction various nonces are generated. Those nonces are generated in a deterministic way from the public (visible) UTXO commitment, and a secret ",[57,389,390],{},"coloring seed"," (not necessarily the one used to generate the blinding factor).",[10,393,394],{},"In particular the following is performed",[88,396,397,400,403,406],{},[53,398,399],{},"α - generated nonce",[53,401,402],{},"ρ - generated nonce",[53,404,405],{},"x - challenge",[53,407,408,409],{},"Revealed: ",[149,410,411],{},"μ = α + ρ*x",[10,413,414,415,418,419,384],{},"In order to embed meta-data into UTXO, the creator converts it into a scalar ",[149,416,417],{},"β"," (possible for every 255-bit data), and adds it to the originally-generated nonce ",[149,420,421],{},"α",[10,423,424,425,428,429,384],{},"So, the revealed ",[149,426,427],{},"μ"," is calculated as: ",[149,430,431],{},"μ = α + β + ρ*x",[10,433,434,435,437,438,440,441,444,445,447],{},"In order to recognize such an UTXO one needs the same secret ",[57,436,390],{},". It generates the same ",[149,439,421],{},", ",[149,442,443],{},"ρ",", and then recovers ",[149,446,417],{}," and the embedded parameters:",[10,449,450],{},"The recognition process goes as following:",[88,452,453,463,470,476,482,487],{},[53,454,455,456,440,458,460,461],{},"Generate ",[149,457,421],{},[149,459,443],{}," from the UTXO commitment and the ",[57,462,390],{},[53,464,465,466,469],{},"Calculate the challenge ",[149,467,468],{},"x"," (from the revealed bulletproof transcript)",[53,471,472,473],{},"Calculate ",[149,474,475],{},"β = μ - α - ρ*x",[53,477,478,479,481],{},"Decode the ",[57,480,383],{},", see if this makes sense (in particular it may have only 24 trailing non-zero bytes)",[53,483,484,485],{},"Recreate the UTXO commitment from the master secret and the extracted ",[57,486,383],{},[53,488,489],{},"Check if the obtained commitment is correct",[25,491,493],{"id":492},"advanced-coloring","Advanced coloring",[10,495,496,497,499],{},"So far the above scheme is suitable for coloring the shielded double-blind UTXO, but it's not anonymous: anyone with the same ",[57,498,390],{}," can identify such an UTXO",[10,501,502],{},"To overcome this limitation we use an additional step. We'll encode the embedded meta-data using the Diffie-Hellman encoding scheme.",[10,504,505,506,509,510,513,514,384],{},"The payee creates a private\u002Fpublic key pair, which we call ",[57,507,508],{},"encoding key",". The ",[57,511,512],{},"encoding pubkey"," is given to the payer, along with the ",[57,515,390],{},[10,517,518,519,522],{},"During the bulletproof construction, among other things, the creator reveals the ",[149,520,521],{},"T1"," commitment, which is used to hide the blinding factors. In case of double-blinded bulletproof it's calculated as:",[88,524,525,530],{},[53,526,527],{},[149,528,529],{},"T1 = n1 * G + n2 * J",[53,531,532,440,535,538,539],{},[149,533,534],{},"n1",[149,536,537],{},"n2"," - nonces, generated deterministically from the UTXO commitment and the ",[57,540,390],{},[10,542,543],{},"Now we'll add another nonce to this:",[88,545,546,551],{},[53,547,548],{},[149,549,550],{},"T1 = (n1 + n3) * G + n2 + J",[53,552,553,556,557,560,561],{},[149,554,555],{},"n3"," - ",[93,558,559],{},"random"," nonce, i.e. can't be recovered from the ",[57,562,390],{},[10,564,565,566,568,569,571,572,384],{},"So, using the ",[57,567,390],{}," it's not possible to recover ",[149,570,555],{},", but it's possible to obtain ",[149,573,574],{},"n3 * G",[10,576,577],{},"Finally, both payer and payee calculate the same secret:",[88,579,580,592],{},[53,581,582,583],{},"Payer:\n",[88,584,585],{},[53,586,587,589,590],{},[149,588,555],{}," * ",[57,591,512],{},[53,593,594,595],{},"Payee:\n",[88,596,597],{},[53,598,599,589,601],{},[149,600,574],{},[57,602,603],{},"encoding private key",[10,605,606],{},"Finally the scheme goes as following:",[10,608,609],{},"Payer:",[88,611,612,617,623,638,646,654],{},[53,613,614,615],{},"Generate random nonce ",[149,616,555],{},[53,618,619,620],{},"Calculate shared secret point ",[149,621,622],{},"S = n3 * encoding pubkey",[53,624,625,626,629,630,633],{},"Convert X-coordinate of ",[149,627,628],{},"S"," to a scalar ",[149,631,632],{},"γ",[88,634,635],{},[53,636,637],{},"If it's too large and can't be converted (highly unlikely) - retry with different nonce",[53,639,640,641,643,644],{},"Add ",[149,642,632],{}," to the encoded meta-data ",[149,645,417],{},[53,647,640,648,650,651,653],{},[149,649,555],{}," to ",[149,652,534],{}," for the rest of the protocol",[53,655,656],{},"The rest is straight-forward",[10,658,659],{},"Payee:",[88,661,662,669,674,682,687,698,704,712],{},[53,663,664,665,440,667],{},"Generate the nonces ",[149,666,534],{},[149,668,537],{},[53,670,671,672],{},"Calculate the \"unmodified\" ",[149,673,521],{},[53,675,676,677,679,680],{},"Subtract it from the revealed ",[149,678,521],{}," to obtain ",[149,681,574],{},[53,683,619,684],{},[149,685,686],{},"n3 * G * encoding private key",[53,688,625,689,629,691,693],{},[149,690,628],{},[149,692,632],{},[88,694,695],{},[53,696,697],{},"If it's too large - skip the rest",[53,699,700,701,703],{},"Recover encoded meta-data ",[149,702,417],{}," (as usual)",[53,705,706,707,709,710],{},"Subtract ",[149,708,632],{}," from ",[149,711,417],{},[53,713,656],{},[715,716,718],"h3",{"id":717},"what-about-shielded-inputs","What about shielded inputs?",[10,720,721],{},"They are identified by the revealed Spend pubkey. The payee should track all the Spend pubkeys for shielded outputs it detected, and realize the spending once it sees the shielded input from the same Spend pubkey.",[715,723,725],{"id":724},"payee-address","Payee address",[10,727,728,729,731,732,734,735,737,738,740,741,743,744,747],{},"So far the payer needs the ",[57,730,390],{}," and the ",[57,733,512],{},". But they don't have to be different: a payee can provide the ",[57,736,512],{},", and the ",[57,739,390],{}," may be generated from it in a deterministic way.\nMoreover, since the ",[57,742,512],{}," is fully controlled by the payee - it can always make sure its ",[149,745,746],{},"Y","-coordinate is odd\u002Feven (by just negating the private key), hence providing only X-coordinate (32 bytes) is enough.",[715,749,751],{"id":750},"multiple-address","Multiple address?",[10,753,754],{},"Although in the above scheme a payer can not identify payments of others to the same payee, it may still be necessary to have multiple addresses. For instance, if payers share information, it may be necessary to conceal the fact that they pay to the same payee.",[10,756,757],{},"The above scheme is possible to extend to multiple addresses, they payee can generate arbitrary number of addresses. However there is no unified way for the payee to identify the payments: it needs to scan all the shielded outputs by all its generated addresses.",{"title":759,"searchDepth":760,"depth":760,"links":761},"",2,[762,763,764,765,766,767,768],{"id":27,"depth":760,"text":28},{"id":116,"depth":760,"text":77},{"id":132,"depth":760,"text":133},{"id":172,"depth":760,"text":173},{"id":284,"depth":760,"text":285},{"id":373,"depth":760,"text":374},{"id":492,"depth":760,"text":493,"children":769},[770,772,773],{"id":717,"depth":771,"text":718},3,{"id":724,"depth":771,"text":725},{"id":750,"depth":771,"text":751},"md",null,{},true,"\u002Fdocs\u002Fcore-tech\u002Flelantus-mw",{"description":12},"docs\u002Fcore-tech\u002FLelantus-MW","TN9a6qqdytv7FBhrpa9g74mjR3KWWvJYSsVj9hDm6JY",[783,787],{"title":784,"path":785,"stem":786,"description":759,"children":-1},"Lelantus CLI (historical, Below V60)","\u002Fdocs\u002Fcore-tech\u002Flelantus-cli-(historical-below-v6.0)","docs\u002Fcore-tech\u002FLelantus-CLI-(historical,-below-v6.0)",{"title":788,"path":789,"stem":790,"description":759,"children":-1},"Lightning Network","\u002Fdocs\u002Fcore-tech\u002Flightning-network","docs\u002Fcore-tech\u002FLightning-Network",1783006071349]