<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by AlphaSwap on Medium]]></title>
        <description><![CDATA[Stories by AlphaSwap on Medium]]></description>
        <link>https://medium.com/@alphaswapdex?source=rss-9e1e07d8dc11------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*IdlmJyWUEHD_9LIn_859lA.jpeg</url>
            <title>Stories by AlphaSwap on Medium</title>
            <link>https://medium.com/@alphaswapdex?source=rss-9e1e07d8dc11------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 16:09:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alphaswapdex/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Part III The technical architecture of the Aleo blockchain (AHP)]]></title>
            <link>https://alphaswapdex.medium.com/part-iii-the-technical-architecture-of-the-aleo-blockchain-ahp-977bbbecbe28?source=rss-9e1e07d8dc11------2</link>
            <guid isPermaLink="false">https://medium.com/p/977bbbecbe28</guid>
            <category><![CDATA[aleo]]></category>
            <dc:creator><![CDATA[AlphaSwap]]></dc:creator>
            <pubDate>Thu, 14 Mar 2024 06:35:40 GMT</pubDate>
            <atom:updated>2024-03-14T06:35:40.757Z</atom:updated>
            <content:encoded><![CDATA[<h3>AHP</h3><p>AHP (Algebraic Holographic Proof) is essentially evolved from IOP (Interactive Oracle Proof). The distinction between AHP and IOP lies in the division of the verifier’s verification process into two phases: offline and online. The offline algorithm is known as the indexer algorithm, which can be understood as involving multiple rounds of interaction between the prover and the verifier. Additionally, the verifier can access the indexer oracle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WIVubtWPJbecEY3j" /></figure><h4>1. R1CS</h4><p>R1CS primarily involves instance-witness pairs ((𝐴,𝐵,𝐶), (𝑥,𝑤)), where 𝐴,𝐵,𝐶 are matrices, and (𝑥,𝑤)∈ \𝑚𝑎𝑡ℎ𝑏𝑏{𝐹} satisfy (𝐴𝑧)∘(𝐵𝑧)=𝑐𝑧; 𝑧=(1,𝑥,𝑤). For a detailed explanation of R1CS, please refer to this <a href="https://tlu.tarilabs.com/cryptography/rank-1">example</a>. We will not delve into further details here. If we use Lagrange interpolation to construct three univariate polynomials, \ℎ𝑎𝑡{𝑧}𝐴(𝑋), \ℎ𝑎𝑡{𝑧}𝐵(𝑋), \ℎ𝑎𝑡{𝑧}𝐶(𝑋), on a subgroup 𝐻 from the three sets of vectors 𝐴𝑧, 𝐵𝑧, 𝐶𝑧, then R1CS needs to prove the following:</p><ul><li>entry-wise product：∀ 𝜅∈ 𝐻, \ℎ𝑎𝑡{𝑧}𝐴(𝜅)\ℎ𝑎𝑡{𝑧}𝐵(𝜅)-\ℎ𝑎𝑡{𝑧}𝐶(𝜅)=0</li><li>linear relation：∀ 𝑀∈ \{𝐴,𝐵,𝐶\},∀ 𝜅∈ 𝐻, \ℎ𝑎𝑡{𝑧}𝑀(𝜅)=\𝑠𝑢𝑚𝑖\𝑖ₙ 𝐻𝑀[𝜅,𝑖]\ℎ𝑎𝑡{𝑧}(𝑖)，meaning it needs to be proven that 𝐴𝑧, 𝐵𝑧, 𝐶𝑧 are indeed derived from the same linear combination 𝑧 of matrices 𝐴,𝐵,𝐶.</li></ul><p>The entry-wise product can be easily proven using the aforementioned zeroTest, while the linear relation requires the use of the sumCheck protocol for proof.</p><h4>2. Lemma</h4><p>Lemma 1 (<a href="https://eprint.iacr.org/2018/828.pdf">Univariate Sumcheck for Subgroups</a>): Given a multiplicative subgroup 𝑆⊂\𝑚𝑎𝑡ℎ𝑏𝑏{𝐹}, for a polynomial 𝑓(𝑋), the sum \𝑠𝑢𝑚𝜅\𝑖ₙ 𝑆𝑓(𝜅) = 𝜎. If and only if 𝑓(𝑋) can be represented as 𝑓(𝑋)=ℎ(𝑋)∙ 𝑣𝑆(𝑋)+𝑋∙ 𝑔(𝑋) + 𝜎/|𝑆|, where 𝑣𝑆(𝑋) is the vanish polynomial over subgroup 𝑆, and 𝑆 denotes the number of elements in the subgroup 𝑆. This lemma is derived from the paper <a href="https://eprint.iacr.org/2018/828.pdf">Aurora: Transparent Succinct Arguments for R1CS</a>, and we will not delve into a detailed explanation of this lemma here.</p><h4>3. AHP for R1CS</h4><p><strong>3.1. Offline: Index Algorithm</strong></p><p>Due to the verification process of zk-SNARKs typically requiring “reading the description of the computation, in order to know what statement is being verified,” and the large computational load involved, which means the verification time is proportional to the computational effort, Marlin’s approach splits the verification process into two phases:</p><ul><li>Offline phase: Produces a short summary for the given circuit, consisting of coefficient matrices (index).</li><li>Online phase: Uses this short summary to verify the proof, called instance.</li></ul><p>The offline algorithm in Marlin is known as the indexer algorithm, which encodes the coefficient matrices.</p><p>The indexer 𝐼(\𝑚𝑎𝑡ℎ𝑏𝑏{𝐹}; (𝐻, 𝐾)⊂ \𝑚𝑎𝑡ℎ𝑏𝑏{𝐹}; (𝐴,𝐵,𝐶)∈ \𝑚𝑎𝑡ℎ𝑏𝑏{𝐹}𝐻× 𝐻), |𝐾| \𝑔𝑒 𝑚𝑎𝑥\{||𝐴||, ||𝐵||, ||𝐶||\}→\{\ℎ𝑎𝑡{𝑟𝑜𝑤}𝑀(𝑋), \ℎ𝑎𝑡{𝑐𝑜𝑙}𝑀(𝑋), \ℎ𝑎𝑡{𝑣𝑎𝑙}𝑀(𝑋)\}𝑀\𝑖ₙ \{𝐴,𝐵,𝐶\}, outputs nine univariate polynomials.</p><p>Based on the non-zero elements of matrices 𝐴,𝐵,𝐶, these non-zero elements are mapped into three vectors: row, col, val, and then polynomialized on subgroup 𝐻 using Lagrange interpolation. These nine univariate polynomials have degrees less than |𝐾| and ensure that the bivariate polynomial \ℎ𝑎𝑡{𝑀}(𝑋,𝑌) is a low-degree extension of 𝑀.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/0*sf2jzMXowPnqu1rz" /></figure><p>Matrix 𝑀 corresponds to the row, col, and val matrices of all non-zero elements in matrices 𝐴,𝐵,𝐶. For example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dcIUGbvp3TlkCL9y8cCImw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AkQ_4DsQrTtO_kC-" /></figure><p>Based on the diagram, let’s briefly introduce the calculation process for 𝑟𝑜𝑤(𝜅): Essentially, it involves converting high-degree polynomials over the group 𝐾 into more low-degree polynomials over the group 𝐻 through mapping. This means calculating nine low-degree polynomials for 𝑟𝑜𝑤𝐴,𝐵,𝐶, 𝑐𝑜𝑙𝐴,𝐵,𝐶, 𝑣𝑎𝑙𝐴,𝐵,𝐶 on 𝐻.</p><ul><li>Assume the subgroup 𝐻=\{ℎ₁,ℎ₂,\𝑙𝑑𝑜𝑡𝑠,ℎₙ\} has an order 𝑜𝑟𝑑(𝐻)=|𝐻|=𝑛, which is related to the constraints and the number of instances and witnesses. In the given example, 𝑛=6 corresponds to the number of columns in row, col, val, but for ease of FFT transformations, 𝑛=²³=8.</li><li>The subgroup 𝐾=\{𝑘₁,𝑘₂,\𝑙𝑑𝑜𝑡𝑠, 𝑘ₘ\} has an order 𝑜𝑟𝑑(𝐾)=|𝐾|=𝑚, which relates to the number of non-zero entries in the matrix 𝑀. In the example above, the total number of non-zero entries in matrices 𝐴,𝐵 𝑎𝑛𝑑 𝐶 is 14, but for FFT convenience, 𝑚=²⁴=16.</li><li>𝑟𝑜𝑤(𝜅): Let 𝜅 = 𝑘𝑗, then 𝜙𝐾(𝜅)=𝑗, and 𝑡𝜅 is the row index of the 𝑗th non-zero entry in matrix 𝑀, assumed to be 𝑖, hence 𝑟𝑜𝑤(𝜅)=𝜙𝐻⁻¹(𝑖)=ℎ𝑖. Using Lagrange interpolation based on (𝑥=𝜅=𝑘𝑗, 𝑦=𝑟𝑜𝑤(𝜅)=ℎ𝑖), the polynomial \ℎ𝑎𝑡{𝑟𝑜𝑤𝑀}(𝑋) can be derived.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*520hp7vOwCU2g31Q" /></figure><p><strong>3.2. Online: Proving and Verifying Algorithms</strong></p><p>Let 𝑝𝑝=[\𝑚𝑎𝑡ℎ𝑏𝑏{𝐹}; (𝐻, 𝐾)⊂ \𝑚𝑎𝑡ℎ𝑏𝑏{𝐹}; (𝐴,𝐵,𝐶)∈ \𝑚𝑎𝑡ℎ𝑏𝑏{𝐹}𝐻× 𝐻), with |𝐾| \𝑔𝑒 𝑚𝑎𝑥\{||𝐴||, ||𝐵||, ||𝐶||\}].</p><p><strong>Prover(</strong>𝑝𝑝, 𝑥, 𝑤<strong>):</strong> The prover’s inputs are an instance 𝑥∈\𝑚𝑎𝑡ℎ𝑏𝑏{𝐹}𝐻[\𝑙𝑒 |𝑥|] and a witness 𝑤∈\𝑚𝑎𝑡ℎ𝑏𝑏{𝐹}𝐻[\𝑔𝑒 |𝑥|].</p><p><strong>Verifier(</strong>𝑝𝑝, 𝑥<strong>, indexer)</strong>: The verifier’s inputs are an instance 𝑥∈\𝑚𝑎𝑡ℎ𝑏𝑏{𝐹}𝐻[\𝑙𝑒 |𝑥|] and access to the indexer oracle.</p><p><strong>(1) Round 1 — Prover</strong></p><ul><li>Assume the multiplicative subgroup 𝐻=\{ℎ₁, ℎ₂,\𝑙𝑑𝑜𝑡𝑠, ℎₙ\}, define the instance polynomial \ℎ𝑎𝑡{𝑥}(𝑋), 𝑥∈ 𝐻[\𝑙𝑒 |𝑋|]=\{ℎ₁, ℎ₁,\𝑙𝑑𝑜𝑡𝑠,ℎ|ₓ|\}.</li><li>Define the shifted witness polynomial \ℎ𝑎𝑡{𝑤}(𝑋) such that for 𝑋∈ 𝐻[\𝑔𝑒 |𝑋|]=\{ℎ|ₓ|₊₁,\𝑙𝑑𝑜𝑡𝑠, ℎₙ\}, its corresponding value is \𝑓𝑟𝑎𝑐{𝑤(𝛾)-\ℎ𝑎𝑡{𝑥}(𝛾)}{𝑣𝐻[\ₗₑ|ₓ|](𝛾)}, 𝛾∈ 𝐻[\𝑔𝑒 |𝑋|]. This construction is utilized because 𝑧=(𝑥,𝑤).</li><li>Let 𝑧=(𝑥;𝑤)∈ \𝑚𝑎𝑡ℎ𝑏𝑏{𝐹}𝐻, construct \ℎ𝑎𝑡{𝑧}𝐴(𝑋), \ℎ𝑎𝑡{𝑧}𝐵(𝑋), \ℎ𝑎𝑡{𝑧}𝐶(𝑋)∈\𝑚𝑎𝑡ℎ𝑏𝑏{𝐹}&lt;|𝐻|⁺𝑏[𝑋] based on the linear combination 𝑧𝐴=𝐴𝑧, 𝑧𝐵=𝐵𝑧,𝑧𝐶=𝐶𝑧 on subgroup 𝐻.</li><li>ZeroTest: Calculate the polynomial ℎ₀(𝑋) 𝑠.𝑡. \ℎ𝑎𝑡{𝑧}𝐴(𝑋)∙ \ℎ𝑎𝑡{𝑧}𝐵(𝑋)-\ℎ𝑎𝑡{𝑧}𝐶(𝑋)=ℎ₀(𝑋)∙ 𝑣𝐻(𝑋).</li><li>Note: \ℎ𝑎𝑡{𝑧}(𝑋)=\ℎ𝑎𝑡{𝑤}(𝑋)𝑣𝐻[\ₗₑ|ₓ|](𝑋)+\ℎ𝑎𝑡{𝑥}(𝑋) can also be directly constructed based on 𝑧=(𝑥;𝑤) in group 𝐻.</li><li>Construct a random polynomial 𝑠(𝑋)∈\𝑚𝑎𝑡ℎ𝑏𝑏{𝐹}&lt;²|𝐻|⁺𝑏⁻¹[𝑋] and \𝑠𝑢𝑚𝜅\𝑖ₙ 𝐻𝑠(𝜅)=𝜎₁, also known as the mask polynomial, to satisfy the zero-knowledge property of the univariate sumcheck.</li><li>The prover sends \ℎ𝑎𝑡{𝑤}(𝑋), \ℎ𝑎𝑡{𝑧}𝐴(𝑋), \ℎ𝑎𝑡{𝑧}𝐵(𝑋), \ℎ𝑎𝑡{𝑧}𝐶(𝑋), ℎ₀(𝑋), 𝑠(𝑋), 𝜎₁.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XkcM0kZ9O4ePcR9s" /></figure><p><strong>(2) Round 1 — Verifier</strong></p><p>Randomly sends 𝛼, 𝜂𝐴,𝜂𝐵,𝜂𝐶∈\𝑚𝑎𝑡ℎ𝑏𝑏{𝐹}, where 𝛼 is to reduce the linear check problem to a sumcheck problem, and 𝜂𝐴,𝜂𝐵,𝜂𝐶 is to bundle three sumcheck problems into one.</p><p><strong>(3)Round2-Prover</strong></p><blockquote>&gt; reduce lincheck problem to a sumcheck problem: the verifier samples a random element α ∈ \𝑚𝑎𝑡ℎ𝑏𝑏{𝐹} and sends it to Prover. Indeed, letting 𝑟(𝑋, 𝑌) = 𝑢𝐻(𝑋,𝑌).</blockquote><blockquote>&gt; Prover is left to convince Verifier that the following univariate polynomial sums to 0 on 𝐻.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AN4NgtimEL4PILtJ" /></figure><p>Following the provided reference, if it can be proven that the sum of polynomial 𝑞₁(𝑋) over 𝐻 equals 𝜎₁, then it demonstrates a linear relation between 𝑓₁(𝑋) and 𝑓₂(𝑋).</p><p>The polynomial 𝑞₁(𝑥)=𝑠(𝑋)+𝑟(𝛼,𝑋)𝑓₁(𝑋) -𝑟𝑀(𝛼, 𝑋)𝑓₂(𝑋) where 𝑓₁(𝑋)=𝜂𝐴∙ \ℎ𝑎𝑡{𝑧}𝐴(𝑋)+𝜂𝐵∙ \ℎ𝑎𝑡{𝑧}𝐵(𝑋)+𝜂𝐶∙ \ℎ𝑎𝑡{𝑧}𝐶(𝑋)𝑓₂(𝑋)=\ℎ𝑎𝑡{𝑧}(𝑋)</p><p>Next, the prover needs to demonstrate to the verifier the following polynomial \𝑠𝑢𝑚𝜅\𝑖ₙ 𝐻𝑞₁(𝜅)=𝜎₁, indicating that the value within the red box is zero, which corresponds to the linear relation that needs to be proven.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6A4snuBC-vqgISjL" /></figure><p>𝑟𝑀(𝛼, 𝑋)=\𝑠𝑢𝑚𝜅\𝑖ₙ 𝐻𝑟(𝛼,𝜅) \ℎ𝑎𝑡{𝑀}(𝜅, 𝑋)</p><p>𝑞₁(𝑋)=𝑠(𝑋)+\𝑓𝑟𝑎𝑐{𝑣𝐻(𝛼)-𝑣𝐻(𝑋)}{𝛼-𝑋}∙(𝜂𝐴∙ \ℎ𝑎𝑡{𝑧}𝐴(𝑋)+𝜂𝐵∙ \ℎ𝑎𝑡{𝑧}𝐵(𝑋)+𝜂𝐶∙ \ℎ𝑎𝑡{𝑧}𝐶(𝑋))- \{\𝑠𝑢𝑚𝜅\𝑖ₙ 𝐻[𝜂𝐴∙ 𝑟(𝛼,𝜅)∙\ℎ𝑎𝑡{𝐴}(𝜅, 𝑋)+𝜂𝐵∙ 𝑟(𝛼,𝜅)∙\ℎ𝑎𝑡{𝐵}(𝜅, 𝑋)+𝜂𝐶∙ 𝑟(𝛼,𝜅)∙\ℎ𝑎𝑡{𝐶}(𝜅, 𝑋)]\}∙ \ℎ𝑎𝑡{𝑧}(𝑋)</p><p>Note:</p><ul><li>The bivariate polynomial 𝑟(𝑋,𝑌)=𝑢𝐻(𝑋,𝑌)=\𝑓𝑟𝑎𝑐{𝑣𝐻(𝑋)-𝑣𝐻(𝑌)}{𝑋-𝑌}, where 𝑣𝐻(𝑋) is the vanishing polynomial on 𝐻.</li><li>If 𝐻 is a multiplicative subgroup, then 𝑢𝐻(𝑋,𝑌)=\𝑓𝑟𝑎𝑐{𝑣𝐻(𝑋)-𝑣𝐻(𝑌)}{𝑋-𝑌}=\𝑓𝑟𝑎𝑐{𝑋|𝐻|-𝑌|𝐻|}{𝑋-𝑌}; 𝑢𝐻(𝑋,𝑋)=|𝐻|𝑋|𝐻|⁻¹=𝑛𝑋ⁿ⁻¹.</li></ul><p>Next, the prover needs to prove to the verifier the following polynomial \𝑠𝑢𝑚𝜅\𝑖ₙ 𝐻𝑞₁(𝜅)=𝜎₁, in accordance with the lemma mentioned in section 5.2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9-JeXhZlL_YlaBXZ" /></figure><p><strong>(4) Round 2 — Verifier</strong></p><p>Randomly selects 𝛽₁∈ \𝑚𝑎𝑡ℎ𝑏𝑏{𝐹}\𝐻.</p><p><strong>(5) Round 3 — Prover: Sumcheck</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WcwIaGKwI6fcUbap" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VEDW2yQSCDTA79lf" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2P_5CQqC8n4nxc2Y" /></figure><p>𝜎₂=\𝑠𝑢𝑚𝜅\𝑖ₙ 𝐻𝑞₂(𝜅) requires finding polynomials ℎ₂(𝑋),𝑔₂(𝑋).</p><p><strong>(6) Round 3 — Verifier</strong></p><p>Randomly selects 𝛽₂∈ \𝑚𝑎𝑡ℎ𝑏𝑏{𝐹}\𝐻.</p><p><strong>(7) Round 4 — Prover: Sumcheck</strong></p><p>Using the calculation formula for \ℎ𝑎𝑡{𝑀}(𝑋,𝑌):</p><ul><li>𝑓₃(𝑋)=𝑋𝑔₃(𝑋)+𝜎₃/|𝐾|, this equation proves that 𝑓₃ sums to 𝜎₃ over 𝐾.</li><li>𝑎(𝑋)-𝑏(𝑋)𝑓₃(𝑋)=ℎ₃(𝑋)𝑣𝐾(𝑋), this equation demonstrates that 𝑓₃ agrees with the correct addends over 𝐾.</li></ul><p>These two equations can be combined into one: ℎ₃(𝑋)𝑣𝐾(𝑋)=𝑎(𝑋)-𝑏(𝑋)(𝑋𝑔₃(𝑋)+𝜎₃/|𝐾|).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bgWBFhoLACNqiKBD" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vbgfyyOkNi6nyKXt" /></figure><p><strong>(8)Round4-Verifier</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*K6l9tabnrWFXBMit" /></figure><p><strong>Summary:</strong></p><ul><li><strong>Offline</strong>: 9 univariate polynomials define the low-degree extension of matrix $$M$$, leading to the output of 9 polynomial commitments.</li><li><strong>Online</strong>: The verifier queries each of the 9 indexer polynomials and 12 prover polynomials at exactly one location, which amounts to 21 queries.:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BPdatey1w6Tj-JAcKBqMdA.png" /></figure><ul><li>The prover outputs 12 commitments, 21 evaluations, and 3 evaluation proofs.</li><li>12 commitments:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Px5Dz12QCoC-Mal9jU9xzw.png" /></figure><ul><li>At point 𝛽₁: \ℎ𝑎𝑡{𝑤}, \ℎ𝑎𝑡{𝑧𝐴},\ℎ𝑎𝑡{𝑧𝐵},\ℎ𝑎𝑡{𝑧𝐶}, ℎ₀, 𝑠, ℎ₁,𝑔₁</li><li>At point 𝛽₂: ℎ₂, 𝑔₂</li><li>At point 𝛽₃: ℎ₃,𝑔₃, \ℎ𝑎𝑡{𝑟𝑜𝑤}𝑀,\ℎ𝑎𝑡{𝑐𝑜𝑙}𝑀, \ℎ𝑎𝑡{𝑣𝑎𝑙𝑀}, 𝑀∈\{𝐴,𝐵,𝐶\}.</li><li><strong>Overall</strong>: 27 \𝑚𝑎𝑡ℎ𝑏𝑏{𝐺}₁ + 24\𝑚𝑎𝑡ℎ𝑏𝑏{𝐹}𝑞.</li></ul><h4>4. Optimizations for AHP</h4><ol><li><strong>Elimination of ℎ₀ and \ℎ𝑎𝑡{𝑧𝐶}:</strong></li></ol><ul><li>Research indicates it’s possible to omit proving the zeroTest, simply by replacing \ℎ𝑎𝑡{𝑧𝐶}(𝑋) directly with \ℎ𝑎𝑡{𝑧𝐴}(𝑋)∙\ℎ𝑎𝑡{𝑧𝐵}(𝑋) in subsequent proofs.</li></ul><p><strong>2. Minimal Zero Knowledge Query Bound:</strong></p><ul><li>Set the coefficient 𝑏=1 directly within the mask polynomial.</li></ul><p><strong>3. Eliminating 𝜎₁:</strong></p><ul><li>Construct a special mask polynomial that sums to zero over 𝐻, rather than 𝜎₁.</li></ul><p><strong>4. A More Efficient Holographic Lincheck</strong>:</p><ul><li>Based on existing theoretical proofs, it is possible to reduce one round of interaction, specifically by eliminating one round of the sumcheck.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9tb6rzQPSXdgeB3U" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*00lVgMuG9qP_3rcY" /></figure><ul><li>The use of polynomial commitments to commit and prove the values mentioned above.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*a7SdNCxUOtsf0IgH" /></figure><p><a href="https://github.com/arkworks-rs/marlin/blob/master/diagram/diagram.pdf">https://github.com/arkworks-rs/marlin/blob/master/diagram/diagram.pdf</a></p><h4>5. References</h4><ul><li><a href="https://eprint.iacr.org/2019/1047">Preprocessing zkSNARKs with Universal and Updatable SRS</a></li><li><a href="https://github.com/AleoHQ/snarkVM/blob/testnet3/algorithms/src/snark/varuna/varuna.rs">Aleo Varuna Code</a></li><li><a href="https://github.com/arkworks-rs/marlin">Marlin Code</a></li><li><a href="https://eprint.iacr.org/2011/587.pdf">PST13</a></li><li><a href="https://www.youtube.com/watch?v=NVvNHe_RGZ8">The Evolution of Polynomial Commitments</a></li><li><a href="https://eprint.iacr.org/2022/586.pdf">A Survey of Elliptic Curves for Proof Systems</a></li><li><a href="https://eprint.iacr.org/2018/828.pdf">Aurora: Transparent Succinct Arguments for R1CS</a></li></ul><h3>About AlphaSwap</h3><p>AlphaSwap (previously AleoSwap) offers private, secure, and smooth trading experience on the Aleo blockchain.</p><p><a href="https://aleoswap.org/"><strong>Official Website</strong></a><strong> | </strong><a href="https://twitter.com/AlphaSwap_dex"><strong>Twitter</strong></a><strong> | </strong><a href="https://discord.com/invite/J55JReFSmR"><strong>Discord</strong></a><strong> | </strong><a href="https://t.me/alphaswapofficial"><strong>Telegram</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=977bbbecbe28" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part II The technical architecture of the Aleo blockchain (Marlin and Varuna)]]></title>
            <link>https://alphaswapdex.medium.com/part-ii-the-technical-architecture-of-the-aleo-blockchain-marlin-and-varuna-71c6d48eb355?source=rss-9e1e07d8dc11------2</link>
            <guid isPermaLink="false">https://medium.com/p/71c6d48eb355</guid>
            <dc:creator><![CDATA[AlphaSwap]]></dc:creator>
            <pubDate>Wed, 21 Feb 2024 03:33:38 GMT</pubDate>
            <atom:updated>2024-02-21T03:33:38.446Z</atom:updated>
            <content:encoded><![CDATA[<h3>Marlin and Varuna</h3><h4>1. Overview of Zero-Knowledge Proof Technology</h4><p>Zero-knowledge proofs are widely applied in blockchain applications and have become crucial tools for privacy and scalability. Among these, zk-SNARKs (succinct non-interactive arguments of knowledge) are favored for their short proof size and efficient verification. In practice, the efficiency of verification is significantly determined by the proof’s length/computational complexity, which is associated with the application’s circuit size. A typical SNARK protocol includes the following processes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*FwOk74pZj0B1yGbluCy2CA.png" /></figure><p>In general, the length of a SNARK proof has a sublinear relationship with the witness (the prover’s private input). Verifiers need to review the instance and circuit information during proof verification, making the verification complexity related to the instance length and the size of the circuit. Achieving succinct proofs and efficient verification ultimately boils down to the preprocessing setup, specifically the setup process illustrated above.</p><ul><li><strong>Proof Conciseness: </strong>To achieve shorter proofs, where the proof length is logarithmically related to the circuit gate size 𝑙𝑒𝑛(𝜋)=𝑂𝜆 (log (|𝐶|))</li><li><strong>Verification Efficiency:</strong> If verifiers do not have time to review circuit-related information, the setup algorithm generates a verification key (vk), usually a short summary of the circuit.</li></ul><p>In the specific schemes of zk-SNARKs widely used today, such as Groth16, Sonic, and Plonk, as well as optimized implementation protocols like Halo2 and Marlin, all these specific zero-knowledge proof schemes have a preprocessing setup process. During this process, some public parameters (common reference string, CRS) are secretly generated. These parameters will be involved in the subsequent proof generation and verification processes. The term “secret” here refers to the issue of “toxic waste” introduced during the generation of these public parameters. Anyone who can access this toxic waste could potentially forge proofs, making the management of this toxic waste especially critical. After the CRS is generated, it needs to be immediately destroyed to prevent misuse. Nowadays, MPC algorithm can avoid these problems.</p><p>Currently, there are three main types of preprocessing setup:</p><ul><li>trusted setup per circuit: A representative scheme is Groth16. In this type of setup, each circuit has a corresponding toxic waste random number, which is crucial and must be permanently discarded after one use. Otherwise, if a prover gains access to this toxic waste, they could forge proofs. Therefore, any change in the circuit requires the regeneration of both the proving and verification parameters (pp and vp). Generating the Common Reference String (CRS) consumes a significant amount of computational and human resources, making this approach more suited for static, unchanging application scenarios. For instance, Zcash implements this scheme to facilitate privacy-preserving transactions based on the UTXO model.</li></ul><blockquote>𝑆(𝑐𝑖𝑟𝑐𝑢𝑖𝑡; 𝑟)</blockquote><ul><li>universal (updatable) setup: Sonic and Plonk are typical examples of this setup, with Plonk being an optimized scheme of Sonic. In such setup, the random number r/toxic waste is only involved in the generation of global parameters and is independent of the circuit; this algorithm runs only once. The algorithms for generating proving and verification parameters (pp and vp) are deterministic, depending on the global parameters (gp) and the circuit. For different circuits, it is only necessary to run this deterministic algorithm each time. Therefore, a universal SRS (Structured Reference String) can support a broader and more diverse range of application scenarios. Although a universal setup is more expensive and generates larger proofs compared to a circuit-specific setup, its ability to accommodate more complex and diverse application scenarios makes it more popular among users.</li></ul><blockquote>𝑆=(𝑆𝑖ₙ𝑖ₜ, 𝑆𝑖ₙ𝑑ₑₓ): 𝑆𝑖ₙ𝑖ₜ(𝜆 ,𝑟)→ 𝑔𝑝, 𝑆𝑖ₙ𝑑ₑₓ(𝑔𝑝, 𝐶𝑖𝑟𝑐𝑢𝑖𝑡)→ (𝑝𝑝,𝑣𝑝)</blockquote><ul><li>transparent setup: This setup does not contain any secret randomness, meaning there is no trusted setup process. The proving and verification parameters (pp and vp) it generates are only related to the circuit. A representative protocol is Bulletproofs, which are used for range proofs.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/0*KskrZ0K_UxgOMq2C" /></figure><p>Aleo uses the Varuna scheme, which is an improved version of the Marlin scheme. The main difference between Varuna and Marlin is that Marlin’s arithmetic language only allows R1CS, while Varuna can support both R1CS and custom gates and lookups(custom constraints lookup arguments), such as Plonkish. This means that in the arithmetic representation of circuits, Marlin is limited to three matrices, whereas Varuna can utilize a greater number of matrices, offering better extensibility. Beyond addition and multiplication circuits, Varuna can support various types of arithmetic circuits with corresponding distinct construction methods, referred to as generalized R1CS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EharcbLaqcZrY_8H" /></figure><p>We will give a detailed introduction to the Marlin scheme.</p><h4>2. Overview of the Marlin Protocol</h4><p>The Marlin protocol encompasses three main processes: updatable setup, Prove, and Verify.</p><p><strong>(1) Updatable Setup mainly includes two algorithms:</strong></p><ul><li><a href="https://github.com/arkworks-rs/marlin/blob/master/src/lib.rs">Setup Algorithm</a>: A deterministic algorithm used for generating SRS, based on different polynomial commitment schemes and security assumptions. This algorithm, which needs to run only once and is independent of the circuit, can be found in Marlin’s GitHub repository. For detailed information, refer to <a href="https://github.com/arkworks-rs/poly-commit/tree/master/poly-commit">marlin-poly-commit</a>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NQSShO1lorNYmZS3" /></figure><ul><li><a href="https://github.com/arkworks-rs/marlin/blob/master/src/ahp/indexer.rs">Index Algorithm</a>: Based on the SRS generated above and different circuits, it generates a provingKey and a verifierKey. This deterministic algorithm can be run by anyone.</li></ul><p><strong>(2) Prove: The process where the prover generates a proof using the provingKey, instance, and witness.</strong></p><p><a href="https://github.com/arkworks-rs/marlin/blob/master/src/ahp/prover.rs">https://github.com/arkworks-rs/marlin/blob/master/src/ahp/prover.rs</a></p><p><strong>(3) Verify: The process where the verifier uses the verifierKey and instance to verify the proof.</strong></p><p><a href="https://github.com/arkworks-rs/marlin/blob/master/src/ahp/verifier.rs">https://github.com/arkworks-rs/marlin/blob/master/src/ahp/verifier.rs</a></p><p>Constructing an effective SNARK for a general circuit typically requires two main components:</p><ul><li><strong>Polynomial Commitment Scheme</strong></li><li><strong>IOP (Interactive Oracle Proof):</strong> Essentially a multi-round interactive protocol where the verifier sends a challenge in each round, and the prover responds with an oracle. Through this oracle, the verifier can make queries/inquiries.</li></ul><p>The Marlin protocol discusses various polynomial commitment schemes under different security models, including:</p><ul><li>Opening multiple polynomials with the same degree bound at a single point</li><li>Opening multiple polynomials with multiple degree bounds at a single point</li><li>Opening multiple polynomials with multiple degree bounds at multiple points</li></ul><p>Let’s dive into a few specific schemes.</p><h4>3. Polynomial Commitment Schemes</h4><p><strong>3.1. Definition of Polynomial Commitments</strong></p><p>A polynomial commitment allows a prover to generate a commitment to a polynomial and later open this commitment at a specific point, producing a proof that the opened value matches the committed polynomial. The most straightforward method would be to send the polynomial to the verifier for direct validity verification, but this approach scales linearly with the polynomial’s degree(𝑑), which is impractical for polynomials of billion-degree (𝑑) magnitudes in real applications. Instead, the goal is to construct proofs that are both succinct and efficiently verifiable.</p><p>The polynomial commitment process involves the following algorithms:</p><ul><li>𝐾𝑒𝑦𝐺𝑒𝑛/𝑠𝑒𝑡𝑢𝑝(1𝜆 )→ 𝑔𝑝: Generates a public key, public parameters, or a common reference string. This is represented directly by 𝑔𝑝 (global parameters).</li><li>𝑐𝑜𝑚𝑚𝑖𝑡(𝑔𝑝, 𝑓)→ 𝑐𝑜𝑚𝑓: Given the 𝑔𝑝(global parameters) and a polynomial, the prover can compute a commitment to the polynomial.</li><li>𝑒𝑣𝑎𝑙(𝑔𝑝, 𝑓, 𝑧)→ (𝑣, 𝜋): The prover computes the value 𝑣 of the polynomial at a point 𝑧, along with the proof 𝜋.</li><li>𝑣𝑒𝑟𝑖𝑓𝑦(𝑔𝑝, 𝑐𝑜𝑚𝑓, 𝑧, 𝑣, 𝜋) → 𝑎𝑐𝑐𝑒𝑝𝑡 ~ 𝑜𝑟~ 𝑟𝑒𝑗𝑒𝑐𝑡: The verifier checks the correctness of the value $$v$$computed by the polynomial at point 𝑧.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ClK2j-b77PuOFiG3" /></figure><p><strong>3.2. KZG Polynomial Commitment Scheme</strong></p><p>This section details the specific algorithms of the KZG polynomial commitment scheme.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0GwwcsB-6P7XCzGN" /></figure><ul><li>setup: \𝑚𝑎𝑡ℎ𝑏𝑏{𝐹}ₚ is a finite field of prime order 𝑝, and \𝑚𝑎𝑡ℎ𝑏𝑏{𝐺} is a cyclic group with a generator 𝐺. In this algorithm, 𝛽 represents the toxic waste that must be permanently destroyed. In practice, Multi-Party Computation (MPC) is introduced to generate this value. In actual schemes, particularly in universal setup zero-knowledge proof schemes, this algorithm functions as 𝑆𝑖ₙ𝑖ₜ, participating only in the generation of 𝑔𝑝 and being independent of the circuit. The size of 𝑔𝑝 is linearly related to 𝑑, where 𝑑 is typically on the order of billions, implying that 𝑔𝑝 is very large.</li><li>commit: Making a commitment to a polynomial involves calculating the value of the polynomial at 𝛽, even though the value of 𝛽 is not known. However, this calculation can be performed using 𝑔𝑝.</li><li>eval: The computational effort required for the prover to calculate the quotient polynomial 𝑞(𝑋) is substantial, as the degree 𝑑 of this polynomial is typically very large, often on the order of billions. After calculating the quotient polynomial, a commitment to this polynomial must be made. This means that the computational effort for proof is very large. How to optimize this in practice will be discussed later.</li><li>verify: The verification equation (𝛽 — 𝑧)∙ 𝑐𝑜𝑚𝑞 = 𝑐𝑜𝑚𝑓 — 𝑣∙ 𝐺 involves the toxic waste 𝛽, but the verifier cannot know the information about 𝛽. Therefore, it is necessary to introduce bilinear mapping/pairing for the final verification step.</li></ul><p><strong>3.3. MarlinKZG10</strong></p><p>In the <a href="https://github.com/arkworks-rs/poly-commit/tree/master/poly-commit">marlin-poly-commit</a> repository, several polynomial commitment schemes are implemented, including:</p><ul><li><a href="https://eprint.iacr.org/2020/499">Inner-product-argument Polynomial Commitment (PC)</a></li><li>Marlin variant of the Kate-Zaverucha-Goldberg (KZG) Polynomial Commitment: marlinKZG10</li><li>Sonic/AuroraLight variant of the KZG Polynomial Commitment</li><li>Marlin variant of the Papamanthou-Shi-Tamassia multivariate Polynomial Commitment: Marlin-PST13</li></ul><p>This article will not detail every scheme but will focus on some of the representative ones.</p><p>Marlin requires polynomial commitment schemes to satisfy:</p><ul><li>Extractability: A stronger notion than binding.</li><li>Efficiency:</li></ul><p>(1) For the prover: The time to create a polynomial commitment should be short, implying the need to reduce the polynomial’s degree <em>d</em> (low-degree); the verification of proofs should be efficient, meaning the size of the generated proof/quotient polynomial commitment should be proportional to the polynomial’s degree, not to the highest degree <em>D</em>.</p><p>(2) For the verifier: the commitment size, proof size, time to verify an opening must be independent of the claimed degrees for the polynomials</p><ul><li>hiding：commitments and proofs of evaluation reveal no information about the committed polynomial beyond the publicly stated degree bound and the evaluation itself.</li></ul><p>To meet the functional and security requirements specified in the Marlin project, Marlin employs an extended Kate-Zaverucha-Goldberg (KZG) polynomial commitment scheme, achieving extractability within the algebraic group model (AGM).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UtNhfgKGID6RYDKA" /></figure><p><strong>(1) Setup</strong> In the code, g = G, gamma_g = 𝛾 𝐺, where 𝛾 is introduced to provide the hiding feature for commitments. If the hiding feature is not considered, then the components marked in blue in the scheme are not necessary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NTXqxxr4mx-fOGBC" /></figure><p><strong>(2) Commit</strong></p><ul><li>The process of committing to a univariate polynomial is as follows: Normally, the commitment to a polynomial 𝑝(𝑋)=𝑎₀ + 𝑎₁𝑋+\𝑙𝑑𝑜𝑡𝑠+𝑎ₜ𝑋𝑡 would be 𝑐𝑜𝑚𝑚𝑖𝑡(𝑝(𝑋))=𝑝(𝛽)∙ 𝐺. However, this method does not offer the hiding property since it reveals the value of the polynomial at 𝛽. To ensure hiding, a random blinding polynomial, \𝑜𝑣𝑒𝑟𝑙𝑖𝑛𝑒{𝑝(𝑋)}, is added to the calculation. The final commitment is 𝑐𝑜𝑚𝑚𝑖𝑡(𝑝(𝑋))=𝑝(𝛽)∙ 𝐺+\𝑜𝑣𝑒𝑟𝑙𝑖𝑛𝑒{𝑝(𝛽)}∙𝛾 𝐺.</li><li>For multiple univariate polynomials, represented as [𝑝𝑖]𝑖₌₁ⁿ, to achieve hiding, it’s not necessary to add a random blinding polynomial \𝑜𝑣𝑒𝑟𝑙𝑖𝑛𝑒{𝑝𝑖(𝑋)} to every univariate polynomial. It depends on the randomly generated vector \𝑣𝑒𝑐{𝑤}=[𝑤𝑖]𝑖₌₁ⁿ.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sZv2M77sZB58U7w3" /></figure><p><strong>(3) Eval -&gt; </strong>(𝜋)</p><p>The open algorithm in the code, specifically the ‘compute_witness_polynomial &amp;&amp; open_with_witness_polynomial’, essentially generates a commitment/proof for the quotient polynomial/witness polynomial.</p><ul><li>For a univariate polynomial:</li></ul><p>(1) The witness polynomial 𝑤(𝑋)=\𝑓𝑟𝑎𝑐{𝑝(𝑋)-𝑝(𝑧)}{𝑋-𝑧}, and its proof is 𝑤(𝛽)∙ 𝐺.</p><p>(2) To maintain the hiding feature, \𝑜𝑣𝑒𝑟𝑙𝑖𝑛𝑒{𝑤(𝑋)}=\𝑓𝑟𝑎𝑐{\𝑜𝑣𝑒𝑟𝑙𝑖𝑛𝑒{𝑝(𝑋)}-\𝑜𝑣𝑒𝑟𝑙𝑖𝑛𝑒{𝑝(𝑧)}}{𝑋-𝑧}, and its proof is \𝑜𝑣𝑒𝑟𝑙𝑖𝑛𝑒{𝑤(𝛽)}∙𝛾 𝐺. Since the prover introduces a new polynomial, the value of this new polynomial at point 𝑧 cannot be obtained through SRS, thus the generated proof includes an extra term\𝑜𝑣𝑒𝑟𝑙𝑖𝑛𝑒 𝑣=\𝑜𝑣𝑒𝑟𝑙𝑖𝑛𝑒{𝑝}(𝑧).</p><ul><li>For multiple univariate polynomials, a linear combination is used with a value 𝜉 randomly chosen by the verifier.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dgHuz-rRVgDJgy7v" /></figure><p><strong>(4) Verify</strong></p><ul><li>For a single variable polynomial, the verification algorithm is consistent with KZG and is not further derived here.</li><li>For multiple univariate polynomials, the verification method is a batch check, which essentially introduces 𝜉 for a linear combination.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JhBhLfkXx_e0413s" /></figure><p><strong>3.4. Marlin-PST13</strong></p><p>The KZG polynomial commitment scheme is not only applicable to univariate polynomials but also to multivariate polynomials and supports batch proofing. The <a href="https://eprint.iacr.org/2011/587.pdf">PST13</a> scheme, utilizing KZG for multivariate 𝑘-𝑣𝑎𝑟𝑖𝑎𝑡𝑒 polynomial commitments, achieves batch proofs.</p><ul><li>Assume the verifier has commitment values 𝑐𝑜𝑚𝑓₁,\𝑙𝑑𝑜𝑡𝑠,𝑐𝑜𝑚𝑓ₙ.</li><li>The prover aims to prove 𝑓𝑖(𝑢𝑖,𝑗=𝑣𝑖,𝑗), 𝑖∈[1,𝑛],𝑗∈[1,𝑚], and can generate a batch proof 𝜋, which requires only a single group element.</li></ul><h4>4. Proof Properties of Polynomial Commitments</h4><p>Combining polynomials commitment with Interactive Oracle Proofs (IOP), they are frequently used in protocols like zeroTest, sumcheck, and productCheck. The proof system in Marlin mainly utilizes the zeroTest and sumcheck protocols. Before introducing these protocols, it’s necessary to discuss the concept of vanishing polynomials.</p><p><strong>4.1. Vanishing Polynomial</strong></p><p>In a prime field \𝑚𝑎𝑡ℎ𝑏𝑏{𝐹}ₚ, let 𝜴 be a subgroup of the field with order 𝑘. A vanish polynomial 𝑍𝜴(𝑋)<em> </em>takes the value 0 for all elements of 𝜴. If the subgroup is a cyclic group generated by 𝜴, and if 𝜴=\{1,𝜴, \𝑙𝑑𝑜𝑡𝑠, 𝜴𝑘⁻¹\}, the vanishing polynomial 𝑍𝜴(𝑋)=(𝑋-1)(𝑋-𝜔)(𝑋-𝜔²)\𝑙𝑑𝑜𝑡𝑠(𝑋-𝜔𝑘⁻¹)=𝑋𝑘 — 1. The definition of a vanishing polynomial plays a significant role here. Instead of calculating the product of 𝑘 polynomials, one only needs to compute 𝑋𝑘-1. For 𝑧∈ \𝑚𝑎𝑡ℎ𝑏𝑏{𝐹}ₚ , computing 𝑍𝜴(𝑟) requires ≤ 2log₂ 𝑘 field operations.</p><ul><li>If 𝜴 is a multiplicative subgroup, then 𝑍𝜴(𝑋)=𝑥𝑘-1.</li><li>If 𝜴 is a 𝜉-𝑐𝑜𝑠𝑒𝑡 of some multiplicative subgroup 𝜴₀, then 𝜴=𝜉 𝜴₀, 𝑍𝜴(𝑋)=𝑋𝑘 — 𝜉𝑘</li></ul><p><strong>4.2. ZeroTest on 𝜴</strong></p><p>The prover has a polynomial 𝑓(𝑋) and needs to prove that 𝑓(𝑋) equals 0 over the entire multiplicative subgroup 𝜴, which essentially means proving that 𝑓(𝑋) can be divided by the vanishing polynomial of the multiplicative subgroup 𝑍𝜴(𝑋)=𝑋𝑘 — 1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JYv-7tUUObX2XrHm" /></figure><p>For this protocol:</p><ul><li>verifier time: 𝑂(𝑙𝑜𝑔 (𝑘)) and two poly queries (but can be done in one)</li><li>Prover time: dominated by the time to compute 𝑞(𝑋) and then commit to 𝑞(𝑋).</li></ul><p><strong>4.3. SumCheck Protocol</strong></p><p>The prover needs to prove to the verifier that the value of a multivariate polynomial 𝑔(𝑏₁,\𝑙𝑑𝑜𝑡𝑠, 𝑏\𝑒𝑙𝑙) is 𝐶₁. The specific method is as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0y7dL801O9XS2Bg6" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*azN7-FQaJIqhQ832" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*u6if72K-nDoHiNoE" /></figure><h3>5. References</h3><ul><li><a href="https://eprint.iacr.org/2019/1047">Preprocessing zkSNARKs with Universal and Updatable SRS</a></li><li><a href="https://github.com/AleoHQ/snarkVM/blob/testnet3/algorithms/src/snark/varuna/varuna.rs">Aleo Varuna Code</a></li><li><a href="https://github.com/arkworks-rs/marlin">Marlin Code</a></li><li><a href="https://eprint.iacr.org/2011/587.pdf">PST13</a></li><li><a href="https://www.youtube.com/watch?v=NVvNHe_RGZ8">The Evolution of Polynomial Commitments</a></li><li><a href="https://eprint.iacr.org/2022/586.pdf">A Survey of Elliptic Curves for Proof Systems</a></li><li><a href="https://eprint.iacr.org/2018/828.pdf">Aurora: Transparent Succinct Arguments for R1CS</a></li></ul><h3>About AlphaSwap</h3><p>AlphaSwap (previously AleoSwap) offers private, secure, and smooth trading experience on the Aleo blockchain.</p><p><a href="https://aleoswap.org/"><strong>Official Website</strong></a><strong> | </strong><a href="https://twitter.com/AlphaSwap_dex"><strong>Twitter</strong></a><strong> | </strong><a href="https://discord.com/invite/J55JReFSmR"><strong>Discord</strong></a><strong> | </strong><a href="https://t.me/alphaswapofficial"><strong>Telegram</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71c6d48eb355" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AlphaSwap Tutorial]]></title>
            <link>https://alphaswapdex.medium.com/alphaswap-tutorial-c1d96eb43931?source=rss-9e1e07d8dc11------2</link>
            <guid isPermaLink="false">https://medium.com/p/c1d96eb43931</guid>
            <category><![CDATA[aleo]]></category>
            <dc:creator><![CDATA[AlphaSwap]]></dc:creator>
            <pubDate>Tue, 06 Feb 2024 03:45:12 GMT</pubDate>
            <atom:updated>2024-02-06T03:45:12.129Z</atom:updated>
            <content:encoded><![CDATA[<h3>Preparing Your ALEO Wallet</h3><p>You’ll need to get the Leo Wallet specifically designed for the Aleo testnet, which can be downloaded from the official website.</p><p><a href="https://leo.app/">https://leo.app/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FoMttOazgtuD51iK" /></figure><p>After installation, you can follow the official guide to create your testnet wallet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/0*UHbfzGH2Ul3jX79O" /></figure><p>Additionally, AlphaSwap supports Fox Wallet and Soter Wallet, which can also be downloaded and used from their respective official websites.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/0*f0DpyVm6Tw8BZ1sU" /></figure><h3>Claiming Aleo Test Credits</h3><p>New users can claim Aleo Test Credits daily by visiting the official Aleo faucet.</p><p><a href="https://faucet.aleo.org/">https://faucet.aleo.org/</a></p><p>Follow the prompts to send a text message and receive your test credits. Moreover, you can directly claim 5 Aleo Test Credits through the AlphaSwap faucet.</p><p><a href="https://app.alphaswap.pro/faucet">https://app.alphaswap.pro/faucet</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/0*1ZPEJdAsCqp-0-yC" /></figure><h3>AlphaSwap experience</h3><h4>Homepage Features</h4><p>Visit the AlphaSwap homepage to access various functions such as Assets, Swap, Pools, Faucet, and Info. There are also options to adjust settings and connect your wallet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zIsSBKGAkVExatUl" /></figure><h4>Wallet Connection and Settings</h4><p>To connect your wallet on AlphaSwap, click on the ‘Connect Wallet’ button located in the top right corner of the interface. After signing in, your Aleo testnet wallet will be connected, and the interface will display your wallet address. This allows the platform to interact with your wallet for transactions and asset management.</p><p>The settings button allows you to adjust the allowable slippage for transactions, with a default set at 0.5%. You can select any value you’re comfortable with to manage the degree of price change you’re willing to accept during your trade execution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/0*sJLREAEzF0-d5y_2" /></figure><h4>Faucet</h4><p>Due to the absence of a unified token protocol on Aleo, to explore AlphaSwap, users must claim the platform’s own test tokens. This can be done through the Faucet feature accessible via the navigation bar. After clicking the claim button and signing with your wallet, the test tokens will be allocated. It’s important to note that due to Aleo’s slower network confirmation times, receiving these tokens might take a few minutes. These tokens are solely for testing purposes and hold no real value or efficacy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WZgkDYxImYotHmZG" /></figure><h4>Wrap/Unwrap</h4><p>AlphaSwap introduces the Wrap/Unwrap feature to support the ARC20 token protocol within the Aleo ecosystem, enabling the trading of ARC20-compliant tokens. For instance, Aleo Credits must be wrapped into WALEO before they can be traded on the AlphaSwap platform. Users can also unwrap WALEO back into Aleo Credits at any time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*k_Rskh1xngtRsw09" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/0*x9wrxb_SYt4LEycG" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/0*x3P9cLb2KeJ959yI" /></figure><p>Notably, the Wrap function is designed for the privacy-focused conversion of Aleo Credits; publicly received Aleo Credits through the faucet need to be privatized using wallet tools before wrapping. For example, Leo Wallet allows for the conversion between public and private states of Aleo Credits.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/0*8gtxg7vbAfFwwlbT" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/0*72Fdgdqreop9bWy5" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/0*_ZXFVZuA3Hoq-dJR" /></figure><h4>Asset Management</h4><p>Accessing the Assets feature allows you to view all AlphaSwap assets in your wallet. For privacy protection, private assets are not displayed by default but can be revealed by opting to “Manage my private token.” Furthermore, tokens can be toggled between public and private states, enhancing user control over asset privacy. Detailed steps for this process are provided in tutorial section 7.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/0*sQdHjMKVnxMWEziP" /></figure><h4>Swap Functionality</h4><p>Currently, AlphaSwap has launched its public trading feature (Basic Swap), offering a trading experience similar to Uniswap. Users select the token pair they wish to exchange, enter the amount, and confirm the swap by signing the transaction with their wallet. This process awaits confirmation before the trade is finalized.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/0*9u2RjDb4MK8evcDV" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/0*HCDq-DXJe6cxqhBa" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/0*V50M0Wr15gFQtBsx" /></figure><p>In the future, AlphaSwap plans to introduce private trading functionality. This will allow users to execute transactions without disclosing their address information, enhancing privacy protection during trades.</p><h4>Liquidity Pool</h4><p>AlphaSwap currently offers public Liquidity Pools, allowing users to select two types of tokens to add liquidity and earn fees from traders’ transactions. Adding liquidity is straightforward: click “Add Liquidity,” select the desired tokens and amount, and confirm by signing with your wallet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/0*gBshgeKy0HmCd9Uy" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/0*VTQ8xYGNv40jEJoq" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/0*HYNOx1wSn6cOtx2F" /></figure><p>Your liquidity assets (LP Tokens) can be managed in the “My Pool” section, where you can also remove liquidity to reclaim the original tokens.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/0*F3GSus7KMptB18jh" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/0*28Iqh7zRajmHNI7u" /></figure><p>Future updates will introduce private Liquidity Pool features, enabling liquidity provision without exposing your address, thereby enhancing privacy and potential earnings.</p><h4>Privacy Conversion</h4><p>Our product will support Aleo blockchain’s privacy trading features, requiring users to manage private tokens. This function allows the privatization of any number of public tokens, making them unassociated with your address. You can also re-publicize these private tokens at any time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/0*5-gZj7aS6f7o9_PT" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/0*WXdhEu6t3Sisgf-V" /></figure><p>Note that due to the token’s privacy nature, managing private tokens requires a signature to access your wallet’s private token balance. You can switch tokens between public and private states based on on-screen prompts, enhancing your asset privacy management.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/468/0*QcGV7H5WFOZL3IKq" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/0*pUApxeVbUwrT7qSZ" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/0*kgQHBAiZOAVScjO-" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/0*ILwWQ2Thm5nQXu1F" /></figure><h4>Private Swap Experience</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/0*8OKHLUBSipRySIEd" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/0*h2pQZjS0OYXPw-fZ" /></figure><p>To engage in private swaps on AlphaSwap, ensure your wallet contains private tokens, which can be managed following the guide in section 6.</p><p>When initiating a private swap, selecting the input and output tokens and specifying the amount will display the expected outcome. The complexity of private swaps due to implementation mechanics warrants attention to several factors that could impact the transaction.</p><p>1) Due to the UTXO (Unspent Transaction Output) model, it’s often not possible to trade the entire balance of private tokens in a single transaction. The platform will display the maximum amount that can be input for the transaction, requiring multiple transactions to move all intended private tokens.</p><p>2) In private swaps, it’s not always possible to receive the full amount in private tokens. A portion of the output tokens might be public, sent to an address specified by the user.</p><p>3) Price impact refers to how a trade affects the token’s price, particularly noticeable when the liquidity pool is small and the trade volume large. Traders should be cautious of this as it can significantly affect transaction costs.</p><p>4) The “Wear Ratio” indicates the acceptable level of slippage for a private swap, akin to the slippage in public swaps but compensated through public tokens to ensure the transaction’s success. A portion of public tokens is reserved to mitigate potential slippage, with unspent public tokens potentially returned to the user, necessitating a designated address for these returns. The platform suggests a default wear ratio of 0.5%, suitable for the majority of trade scenarios.</p><p>5) The refund address feature in privacy swaps allows users to choose whether to receive unspent public tokens. Enabling this feature requires specifying a separate address for returns to maintain transaction privacy. Disabling it means forgoing any unspent tokens, prioritizing privacy over token recovery. Careful selection is advised due to the privacy implications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/0*b6VODRLhOOfyoKSQ" /></figure><p>Once you’ve entered all the necessary information for a private swap, click on the “Private Swap” button to submit your transaction. Then, patiently wait for the transaction to be successfully completed to view the updated balance in your wallet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/0*OVhJfWXrPsyR5pQM" /></figure><h3>Conclusion</h3><p>AlphaSwap stands as the inaugural DEX built on the Aleo blockchain, melding the traditional features of Uniswap, such as token swapping and liquidity pools, with Aleo’s privacy-preserving technology. It brings forth innovative solutions for trading and providing liquidity with privacy tokens, enhancing users’ privacy without compromising on capital efficiency. AlphaSwap is committed to further advancing in the Aleo DEX space, promising to deliver more cutting-edge and user-friendly functionalities in the future.</p><h3>About AlphaSwap</h3><p>AlphaSwap (previously AleoSwap) offers private, secure, and smooth trading experience on the Aleo blockchain.</p><p><a href="https://aleoswap.org/"><strong>Official Website</strong></a><strong> | </strong><a href="https://twitter.com/AlphaSwap_dex"><strong>Twitter</strong></a><strong> | </strong><a href="https://discord.com/invite/J55JReFSmR"><strong>Discord</strong></a><strong> | </strong><a href="https://t.me/alphaswapofficial"><strong>Telegram</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c1d96eb43931" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part I Aleo Technical Introduction]]></title>
            <link>https://alphaswapdex.medium.com/part-i-aleo-technical-introduction-c7b2d486b8bd?source=rss-9e1e07d8dc11------2</link>
            <guid isPermaLink="false">https://medium.com/p/c7b2d486b8bd</guid>
            <category><![CDATA[aleo]]></category>
            <dc:creator><![CDATA[AlphaSwap]]></dc:creator>
            <pubDate>Tue, 16 Jan 2024 00:21:45 GMT</pubDate>
            <atom:updated>2024-01-16T00:21:45.384Z</atom:updated>
            <content:encoded><![CDATA[<h3>1. Aleo Overview</h3><p>Blockchain is a distributed system where data is transparent and open for anyone to view, exposing users’ private information. Protecting the privacy of data has become an urgent issue in blockchain. Zerocash, a privacy transaction protocol based on Bitcoin’s UTXO model, and Zether, a privacy transaction protocol based on Ethereum’s account model, use zero-knowledge proof technology to some extent to protect the privacy of transaction data, achieving complete concealment of transaction senders, receivers, and amounts. However, these protocols fall short of providing privacy at the smart contract/function level.</p><p>Aleo is a privacy-focused blockchain platform dedicated to offering highly privacy-protected smart contracts and decentralized applications. By utilizing cryptographic technologies such as zero-knowledge proofs, Aleo allows users to verify the validity and integrity of private data without revealing the original data. It achieves off-chain zero-knowledge proof generation and efficient verification of zero-knowledge proofs (transaction simplicity) on the blockchain.</p><p>Aleo mainly consists of the following major modules:</p><ul><li>Smart Contracts: Similar to platforms like Ethereum, Aleo supports the development and execution of smart contracts. The key difference lies in Aleo’s emphasis on providing a higher level of privacy.</li><li>Leo Language: Aleo introduces a programming language called Leo, which is designed specifically for privacy protection. The Leo language enables developers to create smart contracts that support privacy while ensuring data integrity.</li><li>Aleo Instructions: Aleo provides a set of instructions, offering developers an easy-to-use environment to write programs supporting privacy and integrity.</li></ul><h3>2. Account Model</h3><p>Similar to the Ethereum account, Aleo’s account manages the user’s private key, from which the public key(address) can be derived and publicly disclosed. Any user can transact with others using their public key. Through the private key, users can access and control their funds. Therefore, the security of the private key is crucial; once lost, control over the account’s funds is forfeited.</p><p>The account is responsible for signature and encryption processes. Aleo’s account mainly includes privateKey, viewKey, and address. The following diagram illustrates the relationship between account keys.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oChTgOxUW6vNYgSL" /></figure><h4>2.1 privateKey</h4><p>Aleo’s privateKey represents the user’s unique identity and plays a crucial role in:</p><ul><li>Deriving the public key</li><li>Participating in transaction signing, i.e., authorizing the execution of a transaction with a zero-knowledge proof</li><li>Engaging in certain cryptographic algorithm operations.</li></ul><p>The privateKey mainly consists of three parts:</p><ul><li>seed: A randomly generated number from the domain. Its length depends on the domain size, usually 256 bits. It is a crucial seed for the private key.</li><li><em>sksig:</em> Used for signing transaction information (Schnorr Signature) and participating in address calculation.</li></ul><pre>hash_to_scalar_psd2(EncodeToField(&quot;AleoAccountSignatureSecretKey0&quot;), seed)</pre><ul><li><em>rsig</em>​: Temporary private key (random number) randomizes <em>sksig</em>. The design concept is that the viewKey serves as the decryption key for the Record ciphertext. Even with knowledge of the viewKey, no information about the private key <em>sksig</em> can be obtained.</li></ul><pre>hash_to_scalar_psd2(EncodeToF(&quot;AleoAccountSignatureRandomizer0.0&quot;), seed)</pre><h4>2.2 computeKey</h4><p>The computeKey is calculated from the privateKey using the generator of the elliptic curve group, denoted by G. This computeKey is a component of the signature structure and is used to generate and verify signatures for transactions made by the user. For more information, please refer to section 2.6.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*znRg2IOWzPa1x06it3bbuQ.png" /></figure><h4>2.3 viewKey</h4><p>The viewKey of an Aleo account is derived from its privateKey and is primarily used for encrypting and decrypting Aleo blockchain transaction input/output data. Refer to the Record model section for specific details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v6nmrqjl89ui2l2irn0UpA.png" /></figure><h4>2.4 Address</h4><p>In Aleo, the address is the only public identity of a user. It is used to receive and send official tokens (Aleo credits) and interact with other users or applications. There are several ways to calculate the address:</p><ul><li>privateKey -&gt; address: This method is self-explanatory and will not be elaborated.</li><li>computeKey -&gt; address:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*SxwLxHknja7lyuBP3i8HMA.png" /></figure><ul><li>viewKey -&gt; address:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/267/1*ftM_Emgexj8CbOZ5fKA9UA.png" /></figure><h4>2.5 graphKey</h4><p>The graphKey is a value calculated from the viewKey. Its purpose is to generate a commitment/tcm (transaction commitment) tag for transactions. This tag is involved in generating the commit by privacy input/output, record.private. The tag is used to quickly verify the accuracy of the commit to the record.</p><blockquote><em>tag = Hash(graphKey, commit(record{owner, data, nonce}))</em></blockquote><pre>graphKey = sk_tag = hash_psd4(&quot;AleoGraphKey0&quot;,view_key, Field::zero())</pre><h4>2.6 Signature Algorithm</h4><p>Interaction between users requires confirmation of the sender’s identity. The role of the signature is to confirm the sender’s identity and the integrity of the message content. Therefore, Aleo introduces the Schnorr signature algorithm for signing transactions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hpcxxtLo21i1r6AB" /></figure><p>The signature algorithm typically consists of four primary algorithms:</p><ul><li><em>Setup</em>(1<em>λ</em>)→<em>ppsig</em>​: Primarily generates public parameters, including group construction parameters and cryptographic functions like hash functions.</li><li><em>KeyGen</em>(<em>ppsig</em>​)→(<em>sk</em>,<em>pk</em>): Key generation, including public and private keys. In Aleo, due to its account construction, its key generation differs slightly from the Schnorr signature key generation.</li></ul><pre>sk=privateKey, pk= (computeKey, address)</pre><ul><li><em>Sign</em>(<em>sk</em>,<em>message</em>)→<em>σ</em>: Signature algorithm. Aleo uses <em>sksig</em>​ from the privateKey to sign the message <em>σ</em>=(<em>s</em>,<em>e</em>) , and the signature algorithm aligns with the Schnorr signature algorithm.</li><li><em>Verify</em>(<em>σ</em>,<em>pk</em>,<em>message</em>)→<em>b</em>: Verification algorithm, verifying the legitimacy of the signature.</li></ul><h4>2.7 Encryption Storage of Private Key</h4><p>Similar to mnemonic words, the private key is of utmost importance to users, granting absolute control over the account. Once lost, recovery becomes impossible. Based on Aleo’s private key derivation algorithm, the seed is identified as crucial. The core of the privateKey lies in this random seed; with possession of the seed, one can fully generate the account’s <em>sksig</em>​,<em>rsig</em>​.</p><p>Typically, when creating an account, the generated private key is stored locally. For security reasons, the private key undergoes encryption during storage. The specific algorithm is illustrated in the diagram. The core idea is to introduce randomness to conceal/blind the seed, then employ a PRF to generate multiple random numbers deterministically. Each element in plaintext fields is further subjected to randomization/encryption processing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hBUseEMM0YcqoDPG" /></figure><h3>3. Record Model</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IW8wJj46v3RJ1jRz" /></figure><p>In a transaction, there are many inputs and outputs, and both inputs and outputs can be of the record type. The record is private by default. The Aleo record is similar to UTXO. If a record is used as an input to a function, it implies that the record will be consumed and cannot be used again, i.e., its unique identifier serial number (sn) is disclosed. In most cases, a function’s output will create a new record.</p><h4>3.1 Plaintext Fields of Record</h4><p>Record is a crucial data structure in Aleo used to encode user assets and status data. It includes the following three fields:</p><ul><li>owner: The owner of the record.</li><li>data: The data of the program.</li><li>nonce: A unique identifier for a record, ensuring uniqueness for each record. Therefore, nonce values are unique.</li></ul><p>An example is illustrated in the diagram below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ueLZ9GLC7euL7Xtx" /></figure><pre>Record::from_str(&amp;format!(&quot;{{ <br>        owner: {caller}.private, <br>        token_amount: 100u64.private, <br>        _nonce: 0group.public}}&quot;</pre><h4>3.2 Encrypted Fields of Record</h4><p>In Aleo, records are consumed and created through state functions, and a transaction contains multiple state transition functions. By default, records are private, meaning all fields within the record are encrypted. Before introducing the encryption algorithm for records, understanding the key-sharing protocol is essential.</p><p><strong>3.2.1 Key-Sharing Protocol</strong></p><p>The following describes how User A generates information that only User B can decrypt:</p><ul><li>User A obtains the public address of message recipient B (publicly available).</li><li>User A generates temporary private and public keys and shares the public key with User B.</li><li>User B can calculate a shared key, K_B.</li><li>User A can also calculate a shared key, K_A.</li></ul><p>Calculation reveals that K_A is equal to K_B. Thus, User A and User B do not disclose any privacy information during their interaction but achieve a shared session key. This is crucial for record encryption.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7CGofMmRkORBQ-11" /></figure><p><strong>3.2.2 Record Encryption</strong></p><p>Assuming User A wants to create an encrypted Record for User B, using the key-sharing protocol mentioned earlier:</p><ul><li>User A generates a temporary public key for User B, which is used as a nonce and made public.</li><li>User A generates a shared key, K, and uses it as an input for a pseudorandom function (PRF) to generate multiple random values.</li><li>The random values generated by the PRF are used to randomize/encrypt the private fields in the Record.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*igvaf0illXYAlERO" /></figure><p>Once this Record is signed and added to the blockchain as an output of a transaction, it remains in ciphertext form. Only the owner, User B, can decrypt and view the data.</p><ul><li>User B uses his viewKey and the nonce value from the Record to calculate the shared key, K.</li><li>By using PRF(K), User B can generate multiple random values and decrypt the original plaintext data of the Record.</li></ul><h4>3.3 Commitment of Record</h4><p>During transaction signing, all inputs and outputs, categorized as constant, public, private, or Record types, undergo processing as the message for the signature. For Record types, both inputs and outputs go through commit processing, resulting in the generation of commit, gamma, serialNumber, and tag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/0*9LjULye7IWfRV2jo" /></figure><h3>4. Aleo Transactions</h3><p>This section provides a brief introduction to several transaction types in Aleo’s credits.aleo. Before delving into transactions, we’ll briefly introduce some Aleo Programs.</p><h4>4.1 Program</h4><p>In Aleo, zero-knowledge programs can be written in two languages:</p><ul><li>Leo: Similar to Ethereum’s Solidity, Leo is a high-level language for developing various privacy applications in Aleo. Programs are then compiled into Aleo.VM-readable instructions (Aleo instructions/bytecode) using a compiler.</li><li>Aleo Instructions: Aleo Instructions is a statically typed language used to write private applications. Through zero-knowledge proof technology, Aleo achieves off-chain computation and on-chain verification of computation consistency.</li></ul><pre>// Leo language<br>program helloworld.aleo {<br>  transition hello(public a: u32, b: u32) -&gt; u32 {<br>      let c: u32 = a + b;<br>      return c;<br>  }<br>}<br><br>// The Leo code above compiles to the following Aleo instructions<br>program helloworld.aleo;<br>function hello:<br>    input r0 as u32.public;<br>    input r1 as u32.private;<br>    add r0 r1 into r2;<br>    output r2 as u32.private;</pre><p>Programs offer:</p><ul><li>Extensibility: Users can define their programs freely.</li><li>Isolation: Malicious programs won’t affect honest programs.</li><li>Inter-process communication: Program functions can interact.</li></ul><h4>4.2 Overview of Aleo’s ZK Protocols</h4><p>In recent years, zero-knowledge proofs have been widely applied to blockchains, becoming a crucial tool for privacy and scalability. They find applications in verifiable outsourced computation, anonymous credentials, range proofs, privacy-preserving cryptocurrencies, and extensive use of Layer 2 solutions. As client transactions are frequent, deploying efficient and practical zero-knowledge proof protocols requires proofs that are sufficiently small and verification that is highly efficient (small proof size and fast verification).</p><p>Aleo achieves privacy features through the use of zero-knowledge proof technology, primarily utilizing the Marlin protocol, a specific instance of the zk-SNARKs protocol. Based on whether there is a trusted setup, zk-SNARKs constructions can be briefly categorized into the following types:</p><ul><li>Trusted-Setup: Represented by Groth16, it uses the KZG polynomial commitment scheme. This scheme introduces a trusted CRS that needs to be regenerated for different application scenarios. It is more suitable for a single immutable application scenario. Zcash, for example, uses this technology to implement privacy transaction proofs based on the UTXO model.</li><li>Updatable SRS: Represented by Plonk, this protocol is currently the most widely used. Essentially, it also requires a trusted public reference string setup. However, the global public parameters only need to be generated once, and they can be updated for different application scenarios. Therefore, it can be applied to various scenarios.</li><li>No Trusted Setup: The typical protocol represented by Bulletproofs does not require a trusted parameter setup. However, its proof generation and verification are relatively slower than the two mentioned above.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kZjp1fAyl4CJfitS" /></figure><p>Aleo uses the Marlin protocol, and its difference from Plonk lies in Marlin’s arithmetic language being R1CS, while Plonk is plonkish (custom gate + lookup). Additionally, Aleo implements a layer of recursive zero-knowledge proofs for detailed protocols, to be elaborated later.</p><h4>4.3 Aleo Credit Transactions</h4><p>Aleo deployed the native token contract credits.aleo. This contract implements privacy transfer functionality. The contract mainly defines two data structures: record credits and mapping accounts. Record credits are used to record private states, while mapping accounts are used to record public states. The contract supports the following types of transactions:</p><ul><li>transfer_private: Implements a completely private transfer transaction between the sender and receiver. This involves mutual transfers using private records. For example, User 1 consumes two records, record 1 and record 2 (similar to UTXO), and generates a new record 3 for User 2. The encryption method for records is detailed in the previous Section 3.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VPT6JB26cIUf11vi" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*27r5b71-ucU0YMAd" /></figure><ul><li>transfer_private_to_public: Implements the functionality of a private sender transferring funds to a public receiver. For example, User1 consumes two records, record3, and record4, and initiates a transfer to the public user3. Since user3 is public, the transaction will record the state of user3 using a mapping account.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*u2B61u9UIoQ1LPJQ" /></figure><ul><li>transfer_public: Represents a completely open and transparent transaction.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*02ineg4mRHwPxpol" /></figure><ul><li>transfer_public_to_private: Implements the functionality of a public sender transferring funds to a private receiver.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*19hm5WjnOELZ9jq3" /></figure><h3>About AlphaSwap</h3><p>AlphaSwap (previously AleoSwap) offers private, secure, and smooth trading experience on the Aleo blockchain.</p><p><a href="https://aleoswap.org/"><strong>Official Website</strong></a><strong> | </strong><a href="https://twitter.com/AlphaSwap_dex"><strong>Twitter</strong></a><strong> | </strong><a href="https://discord.com/invite/J55JReFSmR"><strong>Discord</strong></a><strong> | </strong><a href="https://t.me/alphaswapofficial"><strong>Telegram</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7b2d486b8bd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rebranding Announcement: AleoSwap Transforms into AlphaSwap]]></title>
            <link>https://alphaswapdex.medium.com/rebranding-announcement-aleoswap-transforms-into-alphaswap-b336ce5d1ee4?source=rss-9e1e07d8dc11------2</link>
            <guid isPermaLink="false">https://medium.com/p/b336ce5d1ee4</guid>
            <dc:creator><![CDATA[AlphaSwap]]></dc:creator>
            <pubDate>Tue, 09 Jan 2024 09:32:27 GMT</pubDate>
            <atom:updated>2024-01-09T09:32:27.385Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wnhSrW39S8SqGEAUbasn9Q.jpeg" /></figure><p>We are delighted to share a significant step in our evolution. With a commitment to clarity and community engagement, we are excited to announce the rebranding of <strong>AleoSwap </strong>to <strong>AlphaSwap</strong>.</p><h3>Reasons for the Rebrand:</h3><h4>Enhancing Community Clarity</h4><p>To ensure clear distinctions between Aleo and AleoSwap, avoiding any potential confusion within our community, we have decided to initiate a brand separation.</p><h4>Expanding Horizons</h4><p>By transcending current brand boundaries and liberating ourselves from dependencies on specific ecosystems, we are dedicated to fostering increased innovation in zk applications. This strategic shift empowers us to focus on a broader landscape, opening the doors for future expansion into multi-chain, multi-ecosystem environments.</p><h4>Alpha as a Catalyst</h4><p>Alpha, symbolizing the genesis of our innovation in zk applications, marks an exciting beginning. Importantly, AlphaSwap is just the starting point. Anticipate forthcoming developments as we progress beyond AlphaSwap. Join us in exploring the abundant possibilities within the zk ecosystem.</p><p>We appreciate your continuous support and look forward to embarking on this transformative journey with all of you. The future of AlphaSwap holds limitless potential, and we can’t wait to explore it together.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b336ce5d1ee4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[2023 Year-End Reflection: Unveiling AleoSwap’s Triumphs]]></title>
            <link>https://alphaswapdex.medium.com/2023-year-end-reflection-unveiling-aleoswaps-triumphs-856aa13ecb6a?source=rss-9e1e07d8dc11------2</link>
            <guid isPermaLink="false">https://medium.com/p/856aa13ecb6a</guid>
            <category><![CDATA[aleo]]></category>
            <category><![CDATA[aleoswap]]></category>
            <dc:creator><![CDATA[AlphaSwap]]></dc:creator>
            <pubDate>Thu, 04 Jan 2024 02:41:01 GMT</pubDate>
            <atom:updated>2024-01-04T02:41:01.284Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EwmM8V2IrS0sXNNFU3pnTQ.png" /></figure><h3>🚀 A Journey of Innovation</h3><h4><strong>June</strong></h4><p><strong>Inception: </strong>AleoSwap’s odyssey begins with a vision, assembling a passionate development team.</p><h4>July</h4><p><strong>Laying the Foundation:</strong> The AleoSwap platform takes shape, the first strokes of a groundbreaking creation.</p><h4>August</h4><p><strong>Launch Day Extravaganza:</strong> AleoSwap debuts, introducing pivotal features:</p><ol><li>Public trading and liquidity infusion</li><li>Token mode conversion, offering users unprecedented flexibility</li><li>A test token faucet, igniting exploration.</li></ol><h4>September</h4><p><strong>Evolution Unleashed: AleoSwap DEX evolves:</strong></p><ol><li>Private Trading Emergence: Enabling secure private token swaps.</li><li>WearRatio Introduction: A groundbreaking concept to enhance private swaps’ success.</li><li>Token Launch Feature: Empowering users to materialize their token dreams.</li></ol><p><strong>Community Embrace:</strong> Discord OG Role unveiled, recognizing and cherishing early supporters.</p><p><strong>Global Presence:</strong> AleoSwap team graces ZKDay at Token2049 Conference.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uaqX2VQGOzCuiIaD" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lXiex-q9D-jjqfXC" /></figure><p><strong>Galxe Unveiling:</strong> The ‘Discover AleoSwap’ campaign captivates 500+ users on Galxe.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*png_LhwL9p024guM" /></figure><h4>October</h4><p><strong>Triumph in Deploy Incentives: </strong>AleoSwap claims the 4th spot among Aleo’s Top 10 Deploy Incentive Winners.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*4B6FTALm2lgFCVY4" /></figure><h4>November</h4><p><strong>AleoSwap Credits Campaign:</strong> Unleashing a wave of excitement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tvtNOLy3w9Mv_2h_" /></figure><p><strong>Aleo Foundation Grant:</strong> $9500 secured for groundbreaking initiatives.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/0*XFy7E4A0je9pnq1w.png" /></figure><p><strong>Istanbul Chronicles:</strong> AleoSwap team dazzles at Devconnect, pitching Zero-Knowledge Proofs at zkHouse.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1Q97k18LLwFCDaoN" /></figure><p><strong>Token Symphony: </strong>AleoSwap ARC20 launch campaign captivates the community.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*A5DgZtlnvmfMWyCq" /></figure><h4>December</h4><p><strong>Aleo Global Synergy:</strong> Collaborating on a co-marketing campaign, fostering a sense of togetherness.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*g4196VkGLbde0BBf" /></figure><p><strong>Strategic Alliances:</strong> AleoSwap forges partnerships with Ola and Fox Wallet teams.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nL2HkVEQEM4gT1SR" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NkVGcll4uggr-8zm" /></figure><h3>2023 in Numbers</h3><h4>Community Growth</h4><ul><li><strong>Twitter Enthusiasts:</strong> Surpassing 21K in numbers.</li><li><strong>Discord Alcove:</strong> Flourishing with over 20K members.</li><li><strong>Telegram Haven: </strong>Welcoming over 10K eager participants.</li></ul><h4>Blockchain Brilliance</h4><ul><li><strong>TVL (Aleo):</strong> 121,766, a testament to the platform’s resilience.</li><li><strong>Trading Volume:</strong> A staggering total trading volume of 22,846,997.</li><li><strong>Transaction Numbers:</strong> Weaving together a total of 498,804 transactions.</li><li><strong>Token Issued:</strong> Unleashing 9,272 unique tokens into the crypto sphere.</li><li><strong>Liquidity Pools :</strong> A vibrant ecosystem boasting 1,624 pools.</li></ul><p>In this tapestry of accomplishments, each thread represents a shared journey. Here’s to the community, the innovation, and the boundless possibilities that lie ahead! 🎉🌐</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=856aa13ecb6a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing AleoSwap: The First DEX on Aleo]]></title>
            <link>https://alphaswapdex.medium.com/introducing-aleoswap-0b2f5ea74222?source=rss-9e1e07d8dc11------2</link>
            <guid isPermaLink="false">https://medium.com/p/0b2f5ea74222</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[aleo]]></category>
            <category><![CDATA[privacy]]></category>
            <dc:creator><![CDATA[AlphaSwap]]></dc:creator>
            <pubDate>Thu, 07 Dec 2023 04:20:24 GMT</pubDate>
            <atom:updated>2023-12-07T04:20:24.165Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5k4AXcuW7T7bVeUW" /></figure><p><strong>🚀 AleoSwap: Self Custody, Privacy-Centric, Fully Decentralized</strong></p><p>AleoSwap pioneers decentralized exchanges (DEX) on the privacy-centric Aleo blockchain, offering users a unique blend of self-custody, privacy, and full decentralization. Elevating the trading experience with a focus on security and low-slippage, AleoSwap is reshaping the landscape of decentralized finance.</p><h3>Key Features</h3><ol><li><strong>Security without Compromise:</strong></li></ol><ul><li>AleoSwap’s noncustodial solution ensures users’ assets remain in their wallets, prioritizing complete security.</li></ul><p><strong>2. Innovative Private Trading:</strong></p><ul><li>AleoSwap introduces private trading to maximize user privacy, allowing them to execute trades without revealing their addresses.</li></ul><p><strong>3. Market Making for Profits:</strong></p><ul><li>Active market making is supported, enhancing capital efficiency and providing users with opportunities to earn extra income.</li></ul><p><strong>4. Better User Experience:</strong></p><ul><li>Utilizing an Automated Market Maker (AMM) trading model, AleoSwap provides lightning-fast confirmations, high capital efficiency, and low slippage, ensuring a smooth and efficient trading experience.</li></ul><h3>Roadmap: Building the Future of AleoSwap</h3><h3>2023 Q1-Q2</h3><ul><li><strong>Project Inception: </strong>Kickstart the AleoSwap project and assemble a dedicated development team.</li><li><strong>Testnet Development: </strong>Construct a decentralized exchange (DEX) based on the proven Uniswap V2 model on the Aleo testnet.</li><li><strong>Token Conversion Features: </strong>Launch the token Private/Public conversion feature.</li><li><strong>Faucet and Incentives: </strong>Introduce a faucet for users to claim test tokens, facilitating exploration. Participate in the Aleo Deploy Incentives Program.</li></ul><h3>2023 Q3-Q4</h3><ul><li><strong>Private Trading Launch: </strong>Unveil the private trading function, enhancing user privacy.</li><li><strong>Private Market Making: </strong>Introduce private market-making, allowing users to form Liquidity Pools (LP) with private tokens.</li><li><strong>Mainnet Deployment: </strong>Deploy AleoSwap to the mainnet upon the successful launch of the Aleo mainnet.</li></ul><h3>2024 Q1</h3><ul><li><strong>Experience Enhancement: </strong>Continuously refine private trading and market-making experiences based on user feedback.</li><li><strong>AleoSwap V2 Development: </strong>Initiate the development of AleoSwap V2, incorporating a new AMM trading model.</li><li><strong>Stablecoin Trading: </strong>Launch stablecoin trading, offering reduced slippage for users. Support both public and private trading for stablecoins.</li><li><strong>Exploration of Innovative Features: </strong>Explore and implement innovative DEX features, such as perpetual contracts and leveraged trading, expanding AleoSwap’s capabilities.</li></ul><h3>Achievements</h3><ul><li><strong>Sep 2023: AleoSwap team attended the ZKDay at Token2049 Conference.</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dmLSV0F842ckIT3f" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WbL5p5aVxQC1hpJ4" /></figure><ul><li><strong>Sep 18, 2023: AleoSwap launched the ‘Discover AleoSwap’ campaign on Galxe, with 500+ users participating.</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wyuLYGyReWTq8qpL" /></figure><ul><li><strong>Oct 31, 2023: AleoSwap team secured the 4th spot in Aleo’s Top 10 Deploy Incentive Winners.</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*4GVMF5pqtZtymTrj" /></figure><ul><li><strong>Nov 8, 2023: AleoSwap launched the AleoSwap Credits Campaign.</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xyr8uUrCxdmAmziC" /></figure><ul><li><strong>Nov 18, 2023: AleoSwap team secured a $9500 grant from the Aleo Foundation for the Snark Tank.</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*2pJPfqdVuslFgRISUisRCQ.png" /></figure><ul><li><strong>Nov 18, 2023: AleoSwap team attended the Devconnect in Istanbul, pitching the prowess of Zero-Knowledge Proofs in blockchain at zkHouse.</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VTtLNwMd2Gk_xWY6" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aZuW3qKLWLca4CiA" /></figure><ul><li><strong>Nov 22, 2023: AleoSwap team launched the AleoSwap ARC20 token launch campaign.</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BDW1NbSlaf_K3HWe" /></figure><ul><li><strong>Dec 3, 2023: AleoSwap team collaborated with Aleo Global community and launched a co-marketing campaign on Galxe.</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2ZCz5Xgq9RYoOtcN" /></figure><p>AleoSwap is not just a decentralized exchange; it’s a journey toward a new era of privacy-centric and user-centric decentralized finance. Join us on this exciting adventure, and together, let’s shape the future of decentralized trading!</p><p><strong>Follow us for updates: </strong><a href="https://twitter.com/AleoSwap_dex"><strong>@AleoSwap_dex</strong></a><strong> | </strong><a href="https://www.aleoswap.org/"><strong>Official Website</strong></a><strong> | </strong><a href="https://app.aleoswap.org/assets/tokens"><strong>App</strong></a><strong> | </strong><a href="https://discord.com/invite/J55JReFSmR"><strong>Discord</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0b2f5ea74222" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>