<oembed><type>rich</type><version>1.0</version><title>jaonoctus wrote</title><author_name>jaonoctus (npub170…0chu7)</author_name><author_url>https://yabu.me/npub170d8w0jjdcjuh70lq5ppr0pcy7cfuxj6hpr00tm4et3v53j8pvrqj0chu7</author_url><provider_name>njump</provider_name><provider_url>https://yabu.me</provider_url><html>Cashu is simple. Don&#39;t trust, verify:&#xA;&#xA;MATH TIME LFG&#xA;&#xA;Alice generate random values x, and r.&#xA;&#xA;She then calculate public keys from this secrets&#xA;&#xA;Y=h&#39;(x)&#xA;R=rG&#xA;&#xA;Now she do a aggregate public key, by adding the previous two public keys together. x is the secret and r is called private blinding factor.&#xA;&#xA;T = Y + R&#xA;&#xA;Then she sends T to Bob, the mint. He cannot tell how T was generated because he doesn&#39;t know the other values and multiplication in a elliptic curve is what we call &#34;a random walk&#34;. This mathematical puzzle is known as Discrete Logarithm Problem (DLP).&#xA;&#xA;Bob has a special keyring, holding private and public key pairs, one for each amount power of 2. Let&#39;s say Alice is minting 1 sat so than Bob pick the 1-sat-key-pair.&#xA;&#xA;B=bG&#xA;&#xA;Now he mix his private key with the public key he just received.&#xA;&#xA;Q = bT&#xA;&#xA;And then he sends back to Alice this new point on the curve.&#xA;&#xA;But look! She knows T already, right? She can do a process that we call unbliding, by subtracting the mix of the little r and Bob&#39;s public key.&#xA;&#xA;Z = Q - rB&#xA;&#xA;Let&#39;s replace the variables here to know what the result of this means:&#xA;&#xA;Z = bT - rB&#xA;Z = bT - rbG&#xA;Z = b(Y + R) - rbG&#xA;Z = bY + bR - rbG&#xA;Z = bY + brG - rbG&#xA;&#xA;So, we actually have the same number here, brG equals rbG, cancelling each other. So then&#xA;&#xA;Z = bY&#xA;&#xA;Now Alice holds a value that means Y multiplied by Bob&#39;s private key. Alice have no idea what little b is and Bob have never seen Y!!! B.D.H.K.E. is really cool, huh?&#xA;&#xA;How Alice knows for sure that Y is mixed with bob&#39;s private key tho, because she can&#39;t see little b, remember, DLP?&#xA;&#xA;Bob will also send a fiat-shammir commitment for Alice, that is a schnorr signature. &#xA;&#xA;---&#xA;Pause to talk about schnorr signatures.&#xA;&#xA;signature = private  nonce + commitment * private key.&#xA;&#xA;P = dG &#xA;&#xA;Where little d is the private key, P is the public key&#xA;&#xA;J = jG&#xA;&#xA;Where little j is the private nonce, J is the public nonce&#xA;&#xA;So we have&#xA;&#xA;s = j + ed&#xA;&#xA;Where little e is the hash of the stuff we want to &#34;prove&#34; against our private key&#xA;&#xA;e = h(J|P|m)&#xA;&#xA;Where m would be any message.&#xA;&#xA;How do we verify that is is a valid signature? We know that the public key is the little private key d times the generator point G.&#xA;&#xA;P = dG&#xA;&#xA;So, what if the verifier do the same math but with the public key instead? Let&#39;s multiply everything by G then.&#xA;&#xA;sG = jG + edG&#xA;sG = J + eP&#xA;&#xA;If the left side of the equation is equal to the right side, everything is good. You just did the same math that the signer did, but with public information!&#xA;---&#xA;&#xA;Back to Bob now!&#xA;&#xA;He wants to prove to Alice that he actually did Q = bT, without showing to her his private key, little b. What if he do a signature?&#xA;&#xA;s = j + eb&#xA;&#xA;mmmmm 🤔 this proves shit, nothing. BUT WAIT. do you see that little b is in the formula? And we want bT. Right? What if we multiply everything by T then?&#xA;&#xA;sT = jT + ebT&#xA;sT = jT - eQ&#xA;&#xA;Cool. Let&#39;s call J1 = jG and J2 = jT&#xA;&#xA;Could Alice recompute both values with public information? Yes!&#xA;&#xA;if J1 is j multiplied by G, then&#xA;&#xA;s = j + eb&#xA;- j = -s + eb&#xA;j = s - eb&#xA;jG = sG - ebG&#xA;J1 = sG - eB&#xA;&#xA;What about J2? Same as above, but multiplying everything for T.&#xA;&#xA;j = s - eb&#xA;jT = sT - ebT&#xA;J2 = sT - eQ&#xA;&#xA;Now, if&#xA;&#xA;sG = J1 + e(J1|J2|B|Q)Q&#xA;&#xA;Then she knows that Bob indeed used his private key little b. This is a zero knowledge proof, DLEQ (BIP374), because Bob was able to show to Alice he used the private key b without showing it to her.&#xA;&#xA;Now the final piece. If she wants to spend the token or sended to someone.. The person needs to show to Bob (x, Z)&#xA;&#xA;Bob will verify the following, does this value, used in the hash_to_curve function, combined with my private key, equals the proof Z?&#xA;&#xA;h&#39;(x) * b = Z&#xA;Yb = Z&#xA;&#xA;If so, I&#39;ve mixed this value I&#39;ve never seen with my private key?? Yes. Wuuut.&#xA;&#xA;So Bob will accept this as a valid token, marking it as spend (or, now seen). He has no idea that the T has any relation with this (x, Z)&#xA;&#xA;e-Cash solves privacy, not custody/trust.&#xA;&#xA;Math is beautiful and privacy is not a crime. &#xA;&#xA;</html></oembed>