<?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 Geoff Lamperd on Medium]]></title>
        <description><![CDATA[Stories by Geoff Lamperd on Medium]]></description>
        <link>https://medium.com/@glamperd?source=rss-f84346f1066d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*TfIv1a50CUanIZCUNkXR9g.jpeg</url>
            <title>Stories by Geoff Lamperd on Medium</title>
            <link>https://medium.com/@glamperd?source=rss-f84346f1066d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 14:55:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@glamperd/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[Trusted Setup UI Update]]></title>
            <link>https://medium.com/privacy-scaling-explorations/trusted-setup-ui-update-f8f95fc17a37?source=rss-f84346f1066d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8f95fc17a37</guid>
            <category><![CDATA[zkp]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[zero-knowledge-proofs]]></category>
            <category><![CDATA[trusted-setup]]></category>
            <dc:creator><![CDATA[Geoff Lamperd]]></dc:creator>
            <pubDate>Thu, 29 Jul 2021 10:10:23 GMT</pubDate>
            <atom:updated>2021-07-29T10:14:44.140Z</atom:updated>
            <content:encoded><![CDATA[<p><em>TL;DR: if you want to run a user friendly phase 2 ceremony, consider using our UI with new features</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p0fBmW-bKOXD9vr_s8MGtw.png" /></figure><h3>What is this project about?</h3><p>The goal of a trusted setup is to securely generate zk-SNARK parameters. As long as one party in the ceremony behaves honestly and is not compromised, the entire setup is trustworthy. The computation can be split up into two phases. In the first phase (see <a href="https://medium.com/coinmonks/announcing-the-perpetual-powers-of-tau-ceremony-to-benefit-all-zk-snark-projects-c3da86af8377">Perpetual Powers of Tau</a>) participants generate powers of a secret (tau) on an ongoing basis. In the second phase, participants take the output of phase one and apply it to a specific circuit. Projects that want to conduct a trusted setup can reduce their work as only the (circuit specific) second phase needs to be performed.</p><p>Our goal is to make it easy for projects to run a user friendly public phase 2 trusted setup without having to develop their own infrastructure. We successfully performed a ceremony for <a href="https://medium.com/privacy-scaling-explorations/zkopru-trusted-setup-ceremony-f2824bfebb0f">zkopru</a> with a first version of the UI and applied learnings from this process. If you want to learn more check out the <a href="https://github.com/glamperd/setup-mpc-ui">repo</a> and join our <a href="https://t.me/trustedsetup">telegram channel</a>.</p><h3>New Features</h3><p>Some improvements to the Trusted Setup UI have been released. The key new features are:</p><ul><li>Much faster contributions</li><li>Segregated ceremony spaces with a common back end.</li><li>Automatic public archive site generation</li><li>GitHub authorisation options</li></ul><h3>Faster Contributions</h3><p>The trusted setup is based on the <em>snarkjs</em> library . We updated to the most recent version snarkjs, which has some changes that significantly speed up contributions. Our tests indicate that a typical user will now see an almost 8-fold improvement in contribution speed. Some other benefits came along with this. The back-end processes that validate contributions are also faster, so the overall ceremony is more streamlined and less prone to queue hold-ups.</p><p><em>Snarkjs</em> tends to be optimised for command-line operation. Some changes were implemented to make a little friendlier in the browser environment, such as a callback to report progress.</p><p>These speed improvements mean that the UI can now feasibly support larger circuits. Circuit sizes of over 1 million constraints would have previously been unviable, but now they can be considered.</p><h3>Project-Specific Ceremonies</h3><p>Setting up a trusted setup ceremony entails a certain amount of effort, and this is even more so in our case, where we have automated queue management. It involves setting up a database, servers to store data, back-end services to validate the contributions, and a front-end site to provide the UI. Many ZK projects would prefer to be putting their efforts towards getting their product to release rather than setting up the infrastructure for a MPC.</p><p>To that end, a feature we now have is the ability to have a common back end servicing multiple separate ceremonies. A project can prepare its circuits and add them to the ceremony, recruit contributors, and run the ceremony independently of other projects running on the common infrastructure.</p><p>This feature also makes it possible for us to run a generic pool of circuits, such that a project could simply add circuits to the pool, and the ceremony would run any circuits in the pool, which may include circuits for other projects.</p><h3>Archive Site</h3><p>It is useful to make ceremony data available to the public so that contributors can validate their own contributions and ensure they’re contained in the finalised ceremony files, and interested observers can verify and track progress. This has previously been provided with a site built after the ceremony has finalised.</p><p>The ceremony will now automatically build as it progresses. Contributions will be visible a short time — within a minute or so — after the contribution is submitted. The files available from the site will include the <em>zkey </em>file (The snarkjs contribution file) and a log of the server’s verification. Instructions will be provided to enable an independent verification of the contribution.</p><h3>Attestation Options</h3><p>Public attestation of contribution hashes helps ensure that the contributions are not being falsified or censored. The UI encourages the creation of a gist that includes the hashes for each of the user’s contributions. The gist is created under the user’s GitHub profile, providing a defence against falsification or substitution of the contribution.</p><p>The UI previously requested access to the contributor’s GitHub profile, sufficient to automatically create the gist. GitHub’s authorisation mechanism is not particularly fine-grained, and the permission required to write to a gist also included permission to read gists, even private ones. The new option available to users allows them to opt out of automatic gist creation. We ask contributors to continue to create the gist in this case, and the UI will make it easy — paste from the clipboard, then another couple of clicks. This way, it is done under the contributor’s own GitHub login, and doesn’t require giving the UI app permission for gists.</p><p>We also encourage tweeting a link to the gist. In the case of automatically created gists, the UI will have a link to the gist, and can populate a tweet using a standard template. In the case of manually created gists, users should copy the URL to the gist and create the tweet themselves.</p><p>To opt out of automatic gists, before logging in, click the hamburger menu, the Options, then check the option.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8f95fc17a37" width="1" height="1" alt=""><hr><p><a href="https://medium.com/privacy-scaling-explorations/trusted-setup-ui-update-f8f95fc17a37">Trusted Setup UI Update</a> was originally published in <a href="https://medium.com/privacy-scaling-explorations">Privacy &amp; Scaling Explorations</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Notebook Approach to Ethereum UI Development]]></title>
            <link>https://medium.com/@glamperd/a-notebook-approach-to-ethereum-ui-development-48a978539731?source=rss-f84346f1066d------2</link>
            <guid isPermaLink="false">https://medium.com/p/48a978539731</guid>
            <category><![CDATA[d3js]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[dapps]]></category>
            <dc:creator><![CDATA[Geoff Lamperd]]></dc:creator>
            <pubDate>Fri, 29 May 2020 00:07:21 GMT</pubDate>
            <atom:updated>2020-05-29T02:22:49.370Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*uR_YRQnCkhCT93nuF2S9bA.png" /><figcaption>Uniswap Transactions: an example application</figcaption></figure><h3>dApp prototyping using Observable notebooks</h3><p>The intention of this article is to explain how to build an application based on Ethereum using Observable notebooks. This approach allows applications to be built and released to the public in a fraction of the time that would be taken using more conventional methods.</p><h3>Why Observable notebooks?</h3><p>Notebook-style development offers the convenience of breaking your application down to small steps, with the results of each step being available for inspection. Jupyter notebooks are popularly used in the Python community. <a href="https://observablehq.com/">Observablehq.com</a> provides a platform for browser-based notebook building. Developers can simplify the stack, avoiding node.js, npm, React, and the other usual suspects of JavaScript-based dApp development, while working in an environment that supports immediate feeback and sharing of components among other advantages. This all takes place without the need for command-lines. Notebooks are automatically saved, and can be made public at the click of a button.</p><p>In short, the notebook approach gives us the basis for rapid dApp development, well suited for prototypes, hackathon projects or similar.</p><h3>How are applications built?</h3><ul><li>Observable notebooks are made of cells. Each cell contains an instruction or a code block.</li><li>Cells may generate results, or conclude with a named result, which may then be used in other cells. A chain of dependencies is thus built.</li><li>The end result is typically visualisation of the results. Most of the applications on the Observable platform are data visualisation exercises, often quite complex, and often calling on d3.js. I suggest that this doesn’t need to be the case. Even if the application simply retrieves a brief chunk of data and presents it using some basic markdown, there is still much to be gained by adopting the notebook approach.</li><li>Nor does the app need to be focussed on retrieval and presentation. An app that collects some user input and invokes a smart contract method is a perfectly good use case. Controls for user interaction are provided within the Observable ecosystem.</li><li>Cell operations are inherently asynchronous. Each cell that refers to results from other cells will listen for changes, and will update its own results in response to changes.</li><li>A notebook will typically be based on imports of JavaScript libraries. Cells may also import from other notebooks.</li></ul><p>There’s plenty of available help for Observable, so I won’t go in to further detail. <a href="https://observablehq.com/@observablehq/a-taste-of-observable">https://observablehq.com/@observablehq/a-taste-of-observable</a> is a good place to start.</p><h3>An example</h3><p>Follow <a href="https://observablehq.com/@glamperd/uniswap-transactions">this link</a> for an annotated example of a working application.</p><p>The notebook retrieves data (Uniswap transactions) from an Ethereum smart contract (Uniswap v1) and presents it in the cell at the top. The flow is generally from the cells at the bottom to the cell at the top. The order is not critical, since cells listen to their dependent cells regardless of their placement, but it makes the notebook more readable.</p><p>One cell to note is the one returning the named variable, <em>query</em>. This is the GraphQL query that retrieves the transactions. The query is executed in the cell returning <em>queryResults</em>, a small function that runs the query every 10 seconds. A little processing is done on the raw results, including a lookup of the Uniswap exchange data via another GraphQL query.</p><p>The final results are yielded in an array named <em>transactions</em>. Now that we have the data in the desired format, we can put together the presentation aspects of the app. D3.js is used to draw the transactions as SVG elements in the <em>chart</em> cell. Given that the data set will change every 10 seconds or so, d3’s data join methods are employed to react to updates when they arise. Also, animations using transitions avoid abrupt changes. Not all applications will require these methods. To learn more about them, see the <a href="https://observablehq.com/@d3/learn-d3">Learn D3</a> tutorials.</p><p>As a simple demonstration of capturing user input, the cell yielding <em>timeSpan</em> shows a slider bar. Many alternative input controls are available, such as input boxes, buttons, and drop-downs. See <a href="https://observablehq.com/@jashkenas/inputs">this notebook</a>, which allows controls to be imported and easily customised.</p><h3>Retrieving data</h3><p>This example retrieves data using GraphQL queries developed and served by <a href="https://thegraph.com/">Graph Protocol</a>. This approach makes it easy to query data, and avoids the need to deal with contract ABIs, addresses, node connections, and such details.</p><p>It won’t always be possible to take this approach, and it is possible to build with notebooks interacting with Ethereum using those lower level components. I hope to provide some examples soon.</p><h3>Getting started</h3><p>To get started with your own notebook, go through the formalities to set up as an Observable user. You can then fork the example notebook, or another candidate, use it as a template, and adapt it, or you can start a new notebook, import the basic cells you need, and build from there.</p><p>Developers may find this approach much faster and more satisfying way to achieve a good-looking and functional application.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=48a978539731" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Developments in Zero Knowledge Cryptography]]></title>
            <link>https://medium.com/@glamperd/developments-in-zero-knowledge-cryptography-6873427ebe?source=rss-f84346f1066d------2</link>
            <guid isPermaLink="false">https://medium.com/p/6873427ebe</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[zcash]]></category>
            <category><![CDATA[zero-knowledge-proofs]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Geoff Lamperd]]></dc:creator>
            <pubDate>Mon, 15 Jul 2019 05:24:25 GMT</pubDate>
            <atom:updated>2019-07-15T07:43:34.257Z</atom:updated>
            <content:encoded><![CDATA[<p>This post covers some of the developments presented at Zcon1. We saw zero knowledge technology spreading into clients, side-chains, and generic computation environments; new formulations and techniques; and new applications being developed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0MuvP7wg9vLlQz2PkhD8bw.jpeg" /><figcaption>Zcon1, in Split, Croatia</figcaption></figure><h3>Lightweight clients in TEE</h3><p>Karl Wüst of ETH Zurich presented ZLITE, a client that receives shielded Zcash transactions in lightweight clients. The clients use SPV (Simplified Payment Verification), a method to allow light clients in bitcoin-based blockchains. Clients operate in a TEE (Trusted Execution Environment), using secure enclaves in the underlying hardware.</p><p>This challenge is fraught with difficulties: Condensing the data and processing into a constrained environment; defending against attacks that try to steal private keys (e.g. <a href="https://foreshadowattack.eu/">Foreshadow</a>); and avoiding leakage so as to maintain the privacy guarantees that Zcash promises.</p><p><a href="https://youtu.be/tN_CwuYBu_k">Watch the talk here</a></p><h3>FlyClient/NiPoPoWs — Benedict Bünz</h3><p>Blockchain full nodes are big. SPV light clients, which download block headers only, were foreseen by Satoshi in the Bitcoin white paper. But even downloading the headers only, the size can be significant, and ever-growing. Benedict Bünz presented a method by which clients can be super-light and static in size.</p><p>A full node accumulates proof-of-work hashes from successive blocks into a merkle tree. Over time, as that tree fills it is merged into a higher-order merkle tree. The full structure has been dubbed a merkle mountain range.</p><p>The method is known as NiPoPoWs : non-interactive proof of proof-of-work. A light client needs to sample blocks randomly, but with a well-defined strategy, to guarantee authenticity.</p><p>The result is FlyClient, a super-light client that can potentially run in resource-constrained environments such as mobile and IoT devices.</p><p><a href="https://nipopows.com/">Non-Interactive Proofs of Proof-of-Work</a></p><p><a href="https://youtu.be/vuzYwutBqjY">Watch the video here</a>.</p><h3>SONICs</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/1*llQbxNouRyEnYYpAkUF2jA.jpeg" /><figcaption>Sean Bowe</figcaption></figure><p>Sean Bowe, of the Electric Coin Company, spoke about SONICs, a recent construction for SNARKs that he has been collaborating on.</p><p>SNARK implementations currently in use have a trusted setup phase. The setup is particular to the circuit used in the SNARK, so every new circuit requires a new setup, and any update to the circuit requires the setup to be rerun. The setup must be run by a trusted party, as it involves computing intermediate results that would compromise the protocol if they were leaked. An alternative is to generate the setup parameters in a multi-party computation, in which each party injects some randomness. Parties could collude to reveal the sensitive intermediate result (the toxic waste), but provided the collusion does not include every member the result will be genuinely random and secure. The choice is either the complication of an MPC or trust the party performing the setup.</p><p>SONICs provide some relief from this dilemma. They have a universal setup, which removes the dependency on the particular circuit. A setup performed once can be used globally. In addition, the common reference string (CRS) that results from the setup may be updated from time to time, which augments the randomness of the setup.</p><p>SNARKs are one protocol in the landscape of zero-knowledge proofs. They have very good performance characteristics, but the trusted setup is a downside that weighs against their use in some circumstances. Other protocols, such as STARKs, which don’t require that setup phase, provide an alternative at the expense of performance in some areas. The future will see progress on all these fronts. SONICs are a step forward in the evolution of SNARKs.</p><p><a href="https://youtu.be/oTRAg6Km1os">Watch the presentation here</a></p><p><a href="https://eprint.iacr.org/2019/099.pdf">The SONIC paper</a></p><h3>STARKs and STARKDex</h3><p>Eli Ben Sasson and Lior Goldberg</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*TPajg-Tk35CMrq4lJ1rGtQ.jpeg" /><figcaption>Lior Goldberg, Eli Ben Sasson</figcaption></figure><p>zkSTARKs have achieved maturity, and are now being used in applications. StarkWare Industries, under Eli Ben Sasson and Allessandro Chiesa, has been spearheading their development. Unlike SNARKs, they don’t require a trusted setup. Proof sizes are larger than those for SNARKs, and verification time varies with the number of constraints, in contrast with SNARKs. But speed and message transfer has improved to the point where verification can be carried out in an Ethereum smart contract.</p><p>STARKs have other advantages over alternatives. They are plausibly post-quantum secure. They are not restricted in the choice of finite field, lending them to use with a wide variety of cryptographic techniques. The specification of constraints is more flexible than R1CS (rank 1 constraint system, used in SNARKs). STARKs don’t yet have a DSL (domain-specific language) for constraint specification, of which SNARKs have several.</p><p>StarkWare has been concentrating on STARKs-for-scaling applications, in particular STARKDex, a decentralised exchange with Ethereum-based on-chain validation of off-chain order processing. By batching transactions, the cost per trade is around 6000 gas. In contrast, this trade using native Ethereum transactions might cost several hundred thousands in gas.</p><p>More efficiencies are coming soon, and are already being alpha-tested.</p><p><a href="https://youtu.be/vWqWM6Un48k">View the presentation here</a></p><h3>Allessandro Chiesa — Post-quantum SNARKS</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/1*XYLrt22yboS3rlCXiDCLVA.jpeg" /></figure><p>Allesandro Chiesa is treated as royalty at a Zcash conference, having written papers originating both zkSNARKs and the Zerocash protocol. He co-founded StarkWare Industries, and remains an assistant professor at U.C. Berkeley and a consultant to the Zcash foundation. He presented his research on a formulation for post-quantum SNARKS.</p><p>Cryptographic techniques that are expected to be retain their security in the advent of quantum computing at scale, are typically hedged using the phrase “<em>plausibly</em> post-quantum secure”. I presume this is to allow for capabilities of quantum computers that might surprise us. Some quantum computing characteristics are well understood, even with the technology in a nascent stage. Critically, it is expected that sufficiently advanced quantum computers will break the discrete logarithm problem, which is the key to the asymmetry behind elliptic curve keys: it is easy to calculate a public key if one knows the private key, but very, very difficult to do that calculation in the reverse direction. SNARKs, in the formulations used to date, rely on elliptic curve cryptography to disguise parameters that are passed between prover and verifier in the protocol. Cryptographers are therefore keen to find alternative formulations that will remain secure when quantum computing technology does catch up.</p><p>Chiesa goes back to the pre-cursor to SNARKS, the SNARG (Succinct non-interactive argument) construction by Silvio Micali. These have a hash-based construction, and don’t rely on elliptic curve cryptography, and therefore qualify as plausibly quantum-secure. However, the protocol is expensive in terms of computation and data communication cost. Chiesa proposes a new formulation, including a proof protocol dubbed <a href="https://eprint.iacr.org/2016/116.pdf">Interactive Oracle Proofs</a>. These involve multiple rounds of exchanges between prover and verifier to build a PCP (probabilistically-checkable proof).</p><p>This construction still has very long proofs, in contrast to SNARK proof which are a few hundred bytes in length. But like any new protocol, IOPs will mature, and potentially become comparable in performance to the protocols currently in use.</p><p>See also <a href="http://libiop.org/">libiop.org</a></p><h3>ZkVM</h3><p>This intriguing project provides a layer for smart contracts with their state rooted in a blockchain. Smart contracts have zero-knowledge privacy as a fundamental primitive. Smart contract instruction can include constraint statements, much as one would do if specifying a SNARK circuit. Constraints will be formed into proofs and validated using the Bulletproof protocol.</p><p>Smart contract state changes are handled in a UTXO model: a transaction has <em>m</em> inputs, from which rules are evaluated, generating <em>n</em> outputs. A merkle tree of the new state is calculated, and the root used to secure the new state on the blockchain.</p><p>Contracts use an <a href="https://en.wikipedia.org/wiki/Object-capability_model">OCAP</a> (Object-capabilities) model, which unlike simpler authorisation models, avoids the <a href="https://en.wikipedia.org/wiki/Confused_deputy_problem">confused deputy problem</a>.</p><p><a href="https://youtu.be/J9OGAwt_f_c">Watch the presentation here</a>. <a href="https://medium.com/stellar-developers-blog/zkvm-a-new-design-for-fast-confidential-smart-contracts-d1122890d9ae">Read more about ZkVM here</a></p><h3>ZEXE</h3><p>The ZEXE project aims to provide an environment for off-chain computation, with results committed to Ethereum and validated succinctly. The platform employs zkSNARKs, which provide a couple of benefits:</p><ul><li>Computations can be performed once, and a brief proof suffices to guarantee that the computation has been performed. It doesn’t need to be repeated by every validating node, the way regular smart contracts do.</li><li>Privacy can be preserved. Inputs do not need to be made public.</li></ul><p>ZEXE is a general-purpose computation framework, but as a reference implementation they’re building a decentralised exchange. The computation framework allows them to define the assets that will be traded, and to perform the order-matching and settlement logic within the framework, while keeping sender, receiver, value and assets private. They have a choice of implementations, one to maximise confidentiality, and another that prioritises resistance against front-running.</p><p><a href="https://youtu.be/fXWRJUsq8Ok">Watch Pratyush Mishra present here</a>.</p><p><a href="https://www.zeroknowledge.fm/85">Listen to Pratyush’s interview on the Zero Knowledge podcast</a>.</p><h3>Projects for Privacy in Ethereum</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*DDN1lMgLkCmYLRa6DHNlyw.jpeg" /></figure><p>The Ethereum ecosystem has a number of privacy projects presently under development. Barry Whitehat of the Ethereum Foundation is at the forefront of three such projects.</p><p><strong>Semaphore</strong> provides a platform for secretly sending messages, such that the message is public, the sender’s identity is private, but it guarantees that the sender is a member of an identified group. An example use case might be to enable whistle blowers to release information about an ethical or policy breach, for which they would suffer consequences if it were revealed they had leaked the information.</p><p>The Ethereum <strong>Mixer </strong>project aims to provide anonymous transfer from one account to another. The mixer essentially adapts the <a href="http://zerocash-project.org/how_zerocash_works">zerocash protocol</a> to Ethereum. Maximal anonymity will depend on having a large poll of user deposits, fixed denominations, long deposit times, and third parties to pay gas and obscure network-level identification.</p><p><strong>Anti-collusion voting </strong>is the latest project to be launched. It is inspired by a recent <a href="https://vitalik.ca/general/2019/04/03/collusion.html">post on the the topic</a> by Vitalik. On-chain voting provides some benefits that any good voting system should seek, such as guaranteed correct calculation and censorship resistance. In addition we can employ zkSNARKs to provide some protection against bribery and vote-selling.</p><p>Voting rights are allocated to eligible voters along with a key to be used to sign their votes. A voter must sign their vote and register it with an operator. The choice remains secret, but a voter can prove that they have voted. In fact, they can submit multiple signed votes, and they will be accepted, but only the first will count. This possibility means that a vote-buyer will never be sure they are getting a valid vote for their money. Thus, the incentives are weakened so as to discourage this kind of behaviour.</p><p><a href="https://youtu.be/gOub903iWFs">Watch Barry talk here</a>.</p><h3>Matter Labs — Layer 2 with Rollups</h3><p>Alex Gluchowski.</p><p>The team at Matter Labs has developed an Ethereum Layer 2 solution. Their design is a variation of Plasma, with SNARKs to prove off-chain transactions. The use of cryptographic proofs improves the security of the chain, compared with other plasma designs. It also makes a user’s exit from the side chain more certain, removing the liveness requirements inherent in other solutions.</p><p>The design has some challenges. Generating proofs is computationally expensive, and limiting factor for the number of transactions per second achievable. Data availability issues need to be addressed. Using SNARKs means the trusted setup needs to be addressed. The team have been working through these challenges, and have an alpha version capable of 500 transactions per second, and potentially thousands with future improvements.</p><p><a href="https://youtu.be/QyM9qdFKsEA">Watch the presentation here</a>.</p><p>Many other innovations were mentioned in passing at Zcon1. Some new variations on SNARKs are emerging: <a href="https://eprint.iacr.org/2018/828.pdf">Aurora</a> and <a href="https://dci.mit.edu/zksharks">zkSHARKs</a> (Succinct Hybrid Arguments of Knowledge) are new formulations that avoid the trusted setup. <a href="https://eprint.iacr.org/2012/095.pdf">Recursive SNARKs</a> promise to handle multiple times as many transactions without adding anything to the verification time.</p><p>A team working on interoperability between Zcash and Ethereum held a workshop. They needed to usher through an EIP for Ethereum to add a pre-compile. This is a common theme: a new pre-compile opens up a breakthrough in performance that enables innovations.</p><p>It still seems like early days in the field of zero-knowledge cryptography. Live, working applications are rarer than the technology’s potential would suggest. But we’re seeing some methods that have been around for a while come of age, and some new ideas arising.</p><p><em>The author’s attendance at Zcon1 was enabled by the Decentralised Future Fund DAO.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6873427ebe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Privacy on the Blockchain]]></title>
            <link>https://medium.com/@glamperd/privacy-on-the-blockchain-d9a5e1d9597a?source=rss-f84346f1066d------2</link>
            <guid isPermaLink="false">https://medium.com/p/d9a5e1d9597a</guid>
            <dc:creator><![CDATA[Geoff Lamperd]]></dc:creator>
            <pubDate>Thu, 04 Jul 2019 05:34:24 GMT</pubDate>
            <atom:updated>2019-07-04T05:34:24.247Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*LXWS1179tU56tnjSlgjkXg.jpeg" /><figcaption>Did you know? Zeal is a collective term for zebras</figcaption></figure><p>These reflections come in the wake of <a href="https://www.zfnd.org/zcon/">Zcon1</a>, held in Split, Croatia. The conference is the Zcash Foundation’s annual conference, and focuses on privacy in blockchains. Key themes in the conference are motivations, governance, and advances in the technology. Attendees and presenters include some of the most influential in the field of zero-knowledge cryptography.</p><h3>Twitter for your bank account</h3><p>A tagline adopted by Zcash is ‘HTTPS for cryptocurrency’. There’s a lot behind that phrase. It’s meaningful to us because nowadays we realise that HTTPS is important to our security. It wasn’t always this way. The internet was born with plain old HTTP. Early attempts at encrypting communications were resisted by the authorities, who claimed that they needed access to our communications to keep us safe. It turned out that the bigger threats to our prosperity came from the likes of criminal gangs trying to gain access to our accounts. HTTPS came to the rescue, and now it’s a natural habit to expect that padlock in your browser address bar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jsGtF3dxX_Mc44smPZ1Glw.jpeg" /><figcaption>Zcon1 gala dinner</figcaption></figure><p>Decentralised finance is now at a stage corresponding to the early internet. We’re seeing parallels in the attempts to shut down privacy in cryptocurrency. <a href="https://finance.yahoo.com/news/crypto-mixed-france-suggests-ban-224700766.html">France and Japan</a> have floated proposals to ban privacy coins. Privacy advocates will point out, in parallels with the history of web communications, that the downsides of unshielded transactions to everyday citizens outweigh the imagined dangers of secret transactions. In his <a href="https://www.youtube.com/watch?v=AJGLhaUV8QM&amp;list=PL40dyJ0UYTLLjPZaKjdhMoCNanb77_Ztj&amp;index=9">conference talk</a>, Ian Miers likened transparent blockchain transactions to displaying your phone calls on a billboard in Times Square. Another catchphrase that drives the message home is to call finance on blockchain “Twitter for your bank account”.</p><p>You should assume that your transactions on a pseudonymous blockchain are visible to:</p><ul><li>your business competitors</li><li>your creepy ex</li><li>government agencies</li><li>data-harvesting corporations</li></ul><p>A commentator from the <a href="https://www.youtube.com/watch?v=DWPELgmS2uA&amp;list=PL40dyJ0UYTLLjPZaKjdhMoCNanb77_Ztj&amp;index=23">privacy panel discussion with Monero</a> believes that the broad sweep in the history of money has taken a wrong turn. The progression has been from precious metals, to coins and notes, then to electronic transactions. The trouble is that along with the convenience of electronic transactions comes the ability to easily associate transactions with your identity, which then leads to data harvesting by corporations and governments — and not just data collection, but rent extraction, as all those little bites are taken from our transactions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*-RQ9CnKKsxd_scCf2uEdoQ.jpeg" /></figure><p>There’s a nice story from the panel discussion about a Croatian farmer selling his produce, encountered on the way to the conference, who would only accept payment in cash. Its an intuitive response to the inherent intrusive aspect of electronic payments. Why should that transaction involve a party other than the buyer and seller? The next step in money’s evolution will be based on distributed ledger, peer-to-peer technology. It’s a chance for us to course-correct, but only if privacy is enabled in its design.</p><p>Facebook’s announcement on Libra was fresh as the conference began. The judgement from conference speakers was unanimous. It’s a fail, on grounds that it doesn’t have a fundamental commitment to privacy, and doesn’t have real protection for consumers against use for data collection and manipulation.</p><h3><strong>Real-World Stories</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f9oGwxXnWuq1FNTyCBKOQQ.jpeg" /><figcaption>Venezuelan Bolivars have more value as handiwork than as money.</figcaption></figure><p>The need for privacy gains urgency when we consider those in places like Venezuela. One of the conference workshops was presented by Miguel Valencio from <a href="https://www.airtm.io/#/">Airtm</a>. With Venezuela in the grip of hyperinflation, a salary paid today could be worth a fraction as much by the end of the week. Venezuelans have taken to buying bags of sugar with their pay, then selling them to pay for daily expenses. Airtm provides an alternative — for peer-to-peer exchange from the local currency to crypto or hard fiat currencies. The government, which operates its own exchanges with deeply unfavourable rates, frowns upon such activities. ISPs offering exchange services are blocked. Expats working in-country for Airtm have been expelled, and the organisation now operates with local staff. The workshop featured a video call with one of them. He talked about the risks he ran in trying to stay under the radar. It’s also risky for the people he’s helping, but their desperate need for stable money makes it worthwhile. The role of blockchain here is twofold: it provides a stable currency, and with privacy coins, helps those operating out of the gaze of the government to remain private and safe.</p><p>Another topical issue mentioned by conference speakers was the plight of <a href="https://www.washingtonpost.com/world/asia_pacific/masks-cash-and-apps-how-hong-kongs-protesters-find-ways-to-outwit-the-surveillance-state/2019/06/15/8229169c-8ea0-11e9-b6f4-033356502dce_story.html?noredirect=on&amp;utm_term=.5f60605e8d1f">protesters in Hong Kong</a>. They used masks to avoid facial identification, and queued up to buy single-trip tickets rather than use stored-value cards which would trace their travel to the protests. Financial contributions to the protest movement would also be under scrutiny. With the massive data crunching power of the Chinese authorities, pseudonymous cryptocurrency transactions would not provide much protection.</p><p>And so, the motivations for building privacy into blockchain are clear. With SNARKs, STARKs, and the rest of the zero-knowledge toolset we have the building blocks. There are challenges. The technology needs to be more efficient, the user experience needs improvement, and adoption rates remain disappointing. If the brainpower and passion evident at Zcon1 is any guide, progress is all but inevitable.</p><p>I’ll follow up with a summary of the technical innovations presented at the conference.</p><p>Recommended watching:</p><p><a href="https://www.youtube.com/watch?v=AJGLhaUV8QM&amp;list=PL40dyJ0UYTLLjPZaKjdhMoCNanb77_Ztj&amp;index=10&amp;t=20s">The State of Privacy in Cryptocurrencies — Ian Miers</a></p><p><a href="https://www.youtube.com/watch?v=DWPELgmS2uA">Privacy panel, held jointly with Monero Konferenco</a></p><p><a href="https://www.youtube.com/watch?v=I3p4QttEOf0">Money at the Edge: How People Stay Afloat in Venezuela — Alejandro Machado</a></p><p><em>The author’s attendance at Zcon1 was enabled by the Decentralised Future Fund DAO.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9a5e1d9597a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ZK Poker — A Simple ZK-SNARK Circuit]]></title>
            <link>https://medium.com/coinmonks/zk-poker-a-simple-zk-snark-circuit-8ec8d0c5ee52?source=rss-f84346f1066d------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ec8d0c5ee52</guid>
            <category><![CDATA[zksnark]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[zero-knowledge-proofs]]></category>
            <dc:creator><![CDATA[Geoff Lamperd]]></dc:creator>
            <pubDate>Fri, 25 Jan 2019 01:28:15 GMT</pubDate>
            <atom:updated>2020-08-26T15:22:43.446Z</atom:updated>
            <content:encoded><![CDATA[<h3>ZK Poker — A Simple ZK-SNARK Circuit</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WcIi4QEeGRC0btw4nImRVQ.jpeg" /></figure><p>Zero-knowledge proofs are an important tool for us in decentralising ourselves. How do we maintain privacy when our platform stores data that’s globally transparent? What about scaling solutions that do work ‘off-chain’, which then needs to be confirmed by on-chain evidence? Zero-knowledge proofs play their part in solving problems such as these.</p><p>When it comes to writing code for ZK circuits, we have a number of libraries to choose from. I discovered <strong>circom </strong>and <strong>snarkjs </strong>from the team at <a href="https://iden3.io/">iden3</a>. It’s a good choice for newcomers to this area: circuits are easy to code, and they run with easy commands that don’t require exotic environments.</p><p>The <a href="https://iden3.io/blog/circom-and-snarkjs-tutorial2.html">tutorial</a> that’s provided for learning <strong>circom </strong>and <strong>snarkjs </strong>is really helpful. I found it very satisfying, and a great educational experience, to see the process unfold in front of you. This article aims to lead you a step beyond that introductory tutorial, and to explore a few additional aspects of <strong>circom</strong>. It’s based on a simple, modified version of poker in which a zero-knowledge proof plays a part.</p><h3>ZK Poker</h3><p>The rules of ZK Poker are a little simpler than other varieties of the game.</p><ul><li>Players are dealt 5 cards,</li><li>No card exchanges are allowed.</li><li>When ranking hands, only pairs count. Straights, flushes, full houses, and so on are ignored.</li><li>Options during a player’s turn are to fold, to see, or to raise.</li><li><em>Players must not bid when their hand does not contain a pair.</em></li></ul><p>That last rule — <em>no bluffing- </em>is the one that’s to be enforced by the ZK proof. The bidder can avoid having his or her cards disclosed, while still proving to other players that they are obeying the <em>no bluff</em> rule. We’ll ignore the mechanics of the game (evaluating the winner, assessing bids, etc) and simply concentrate on the circuit that will create the ZKP.</p><h3>The Circuit</h3><p>A rough outline of the circuit is:</p><ul><li>Collect inputs: the hand, and the player’s bid option</li><li>Look for at least one pair in the hand.</li><li>Evaluate the kind of bid (fold or play)</li><li>Set up a constraint to check that a choice has been made</li><li>Set up a constraint to check that the choice valid given the presence or otherwise of a pair.</li></ul><p>Let’s walk through the circuit code a few lines at a time, and see what we can learn at each point.</p><h4>Includes</h4><p>It starts with some <em>include </em>specifications:</p><pre>include “../node_modules/circomlib/circuits/gates.circom”;<br>include “../node_modules/circomlib/circuits/comparators.circom”;</pre><p>I should point out that my folder structure is:</p><p>&lt;<em>project root</em>&gt;\poker</p><p>So the include path I’ve specified works for this structure. You’ll need to install <strong>circomlib</strong>, which is an additional requirement to the introductory <strong>circom</strong>/<strong>snarkjs </strong>tutorial. Use this command, from the project root folder:</p><pre>npm install --save circomlib</pre><h4>Circuit Template</h4><pre>template Poker() {</pre><pre>   ... circuit body ...</pre><pre>}</pre><pre>component main = Poker();</pre><p>The structure is much the same as in the introductory tutorial. It’s a single class, and the entry point is declared. Nice and simple.</p><h4>Declaring Inputs, Outputs, and Intermediate Results</h4><pre>signal private input cards[5]; // Each 2..14<br> signal input isSee; // 1 or 0<br> signal input isFold; // 1 or 0<br> signal input raise; // int<br> signal output out; // 1 or 0<br> <br> // Intermediate results<br> signal isBid;<br> signal isRaise;<br> signal hasChosen;</pre><p>The hand of cards is declared as an array: cards[5]. Cards are simply represented by their face value. Suits are ignored. Ace =14; King=13; Queen=12; Jack=11; and so on, down to 2. The hand is a private input, indicating that it must remain a secret.</p><p>The bidding choice, of course, is public, since it will be stated openly to the other players. The <em>fold</em> and <em>see</em> choices are represented as booleans. Note that this is not (and can not be) explicitly declared. <strong>Circom</strong> is based on javascript, hence variable types are inferred from the data. (I should have issued a trigger warning for fans of robust data typing.) The <em>raise</em> input will be an integer, being the actual amount of the raise.</p><p>The only output is <em>out</em>, and will take a value of 1 for valid or 0 for not valid.</p><p>Some intermediate values are declared as <em>signals. </em>We’ll see them in action later.</p><h4>Counting the Pairs</h4><p>This block of code determines whether the hand contains a pair. Note that the code is a lot like plain javascript. It doesn’t contain any constraint declarations, nor any manipulation of signals.</p><p>There is an insight here into the way circuits work. A real-life circuit might involve some pre-processing or intermediate evaluation, but beware: such code is not part of the formal proof. Only the constraints are baked in at setup time, and confirmed via the proof/verify cycle. A dishonest prover might subvert the intermediate results to falsify the witness. I really should update the code so that constraints are build in to the pair evaluation.</p><p>As it stands, the pre-processing step results in a single variable, <em>numPairs</em>. That’s going to be used in subsequent steps.</p><p>The logic here is a nested loop that consider each card in turn, and compares each subsequent card to see if we have a pair. As soon as a pair is found, we add to <em>numPairs </em>and exit. We’re not interested in whether it’s actually part of a 3- or 4-of-a-kind, nor whether there’s a second pair. All of these possibilities count as a pair for the purpose of the constraint that we’ll evaluate. Also note that <em>break </em>doesn’t seem to be implemented in this trimmed-down version of javascript. This code simply triggers an exit by forcing the iterators high.</p><pre> // Count pairs<br> var numPairs = 0;<br> for (var i=0; i&lt;4; i++) {<br>    for (var j=i+1; j&lt;5; j++) {<br>       if (cards[i] == cards[j]) {<br>          numPairs++;<br>          // break doesn’t work. Just force j and i to exit<br>          j = 5;<br>          i = 5;<br>       }<br>    }<br> }</pre><h4>Constraints</h4><p>The introductory tutorial covers signal operations: &lt;--, --&gt;, &lt;==, ==&gt; , and === . What’s new in this block of code is <strong>components</strong>. A component is an instance of once of the classes imported, in this case, from the <strong>circomlib </strong>library. Note the way these are invoked. The input signals to the component (named a, b, in, etc.) are assigned using signal operators. The component’s output signal (often named <em>out</em>) can be similarly used.</p><p>Here, we’re using components for boolean operators. Check out the <a href="https://github.com/iden3/circomlib">circomlib code</a> to see what’s available. There’s a comprehensive library of functions, such as hashing operations, elliptic curve operations, and more.</p><p>And so, our constraints are defined. There’s a constraint to check that a choice has been made (fold, see, or raise). There’s another to check that either a pair is present or fold has been chosen. And finally, the <em>out</em> signal is set to 1.</p><pre> // isRaise = (raise != 0)<br> isRaise &lt;-- (raise &gt; 0);<br> isBid &lt;-- (isRaise || isSee);</pre><pre> // Constraint: Must be either bid or fold: isBid XOR isFold = 1<br> hasChosen &lt;-- isBid + isFold — 2*isBid*isFold;<br> hasChosen === 1;</pre><pre> // Constraint: numPairs must be &gt; 0 if isBid = 1<br> var hasPairs = (numPairs &gt; 0);<br> component not3 = NOT();<br> not3.in &lt;-- isBid;</pre><pre> component or2 = OR();<br> or2.a &lt;-- hasPairs;<br> or2.b &lt;-- not3.out;<br> or2.out === 1;</pre><pre> out &lt;-- or2.out;</pre><h4>Running the Proof</h4><p>The initial steps will be familiar from the introductory tutorial:</p><pre>circom poker.circom -o poker.json<br>snarkjs setup -o poker.json</pre><p>The next step requires the inputs to be provided. Let’s take a look at a sample input file (<em>input.json</em>):</p><pre>{“cards”: [8, 7, 4, 7, 13], “isFold”: 0, “isSee”: 0, “raise”: 10 }</pre><p>The hand has a pair, so all bidding options are available. The player has chosen to raise by 10. We’ll expect this input to be passed as valid. The hand remains private, while the other inputs are public. I’ve glossed over the possibility of the player entering a false hand. Perhaps it could be handled by hashing the hand, making the hash public, thus allowing for confirmation at the end of the hand. In a real-life zero knowledge proof, all such aspects of the procedure, including the circuit code and the setup, need to be agreed in advance by both the prover and the verifier. The verifier would insist on removing any possibility that would allow the prover to falsify their hand.</p><p>Let’s go through the next steps, to generate the proof:</p><pre>snarkjs calculatewitness -c poker.json<br>snarkjs proof</pre><p>Proof generation performance will run in O(n) time, where n=number of constraints. We have too few constraints in this example to see this happening. See <a href="https://github.com/DalaiLlaama/snark-example/tree/master/factor-perftest">here</a> for a test with many more constraints.</p><p>And now the verification, run by the verifier:</p><pre>PS C:\dev\snarks\poker&gt; snarkjs verify<br>OK</pre><p>… and it works!</p><p>With a well-designed ZK-SNARK, the chain of trust goes back to the setup. There’s only one thing the prover can do to get that ‘OK’ result from the verify step, and that’s to create a witness that satisfies all the constraints.</p><p>I hope you find this useful.</p><h4>The Complete Circuit</h4><pre>include “../node_modules/circomlib/circuits/gates.circom”;<br>include “../node_modules/circomlib/circuits/comparators.circom”;</pre><pre>template Poker() {<br> signal private input cards[5]; // Each 2..14<br> signal input isSee; // 1 or 0<br> signal input raise; // int<br> signal input isFold; // 1 or 0<br> signal output out; // 1 or 0<br> // Intermediate results<br> signal isBid;<br> signal isRaise;<br> signal hasChosen;</pre><pre> // Count pairs<br> var numPairs = 0;<br> for (var i=0; i&lt;4; i++) {<br>    for (var j=i+1; j&lt;5; j++) {<br>       if (cards[i] == cards[j]) {<br>          numPairs++;<br>          // break doesn’t work. Just force j and i to exit<br>          j = 5;<br>          i = 5;<br>       }<br>    }<br> }<br> // isRaise = (raise != 0)<br> isRaise &lt;--(raise &gt; 0);<br> isBid &lt;--(isRaise || isSee);</pre><pre>// Constraint: Must be either bid or fold: isBid XOR isFold = 1<br> hasChosen &lt;--isBid + isFold — 2*isBid*isFold;<br> hasChosen === 1;</pre><pre> // Constraint: numPairs must be &gt; 0 if isBid = 1<br> var hasPairs = (numPairs &gt; 0);<br> component not3 = NOT();<br> not3.in &lt;-- isBid;</pre><pre> component or2 = OR();<br> or2.a &lt;-- hasPairs;<br> or2.b &lt;-- not3.out;<br> or2.out === 1;</pre><pre> out &lt;-- or2.out;<br>}</pre><pre>component main = Poker();</pre><p>You can find the code in <a href="https://github.com/DalaiLlaama/snark-example/tree/master/poker">github</a></p><figure><a href="https://cryptofi.co/"><img alt="" src="https://cdn-images-1.medium.com/max/407/1*HrFLDXz92JavTZXjhmvU7g.png" /></a></figure><blockquote><a href="https://coincodecap.com/?utm_source=coinmonks">Get Best Software Deals Directly In Your Inbox</a></blockquote><figure><a href="https://coincodecap.com/?utm_source=coinmonks"><img alt="" src="https://cdn-images-1.medium.com/max/584/0*OJ-qb5G6i863msBB.png" /></a></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ec8d0c5ee52" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/zk-poker-a-simple-zk-snark-circuit-8ec8d0c5ee52">ZK Poker — A Simple ZK-SNARK Circuit</a> was originally published in <a href="https://medium.com/coinmonks">Coinmonks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>