<?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[Going Byzantine - Medium]]></title>
        <description><![CDATA[economics of tokenized systems, mechanism design, DLT, protocols - Medium]]></description>
        <link>https://medium.com/going-byzantine?source=rss----1e6078c0028f---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Going Byzantine - Medium</title>
            <link>https://medium.com/going-byzantine?source=rss----1e6078c0028f---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 04:44:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/going-byzantine" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[DeFi in Eth 2.0 and migrations]]></title>
            <link>https://medium.com/going-byzantine/defi-in-eth-2-0-and-migrations-6c6d50c655d8?source=rss----1e6078c0028f---4</link>
            <guid isPermaLink="false">https://medium.com/p/6c6d50c655d8</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[future]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[defi]]></category>
            <category><![CDATA[beacon-chain]]></category>
            <dc:creator><![CDATA[coreference]]></dc:creator>
            <pubDate>Thu, 24 Dec 2020 01:18:03 GMT</pubDate>
            <atom:updated>2020-12-24T01:25:57.081Z</atom:updated>
            <content:encoded><![CDATA[<h4>ETH explained</h4><h4>a brief on the hot topic &amp; implications for decentralized finance</h4><p>When we wrote an in-depth guide to DeFi (<a href="https://byzantine.solutions/redefine2020?utm_source=goingbyzantine&amp;utm_medium=medium_post&amp;utm_campaign=eth2.0"><strong><em>Redefine 2020: A Primer</em></strong></a>), Eth2.0 was still a distant dream. A dream of blazing-fast, but still decentralized future built with spaceship cryptography, bringing scale to DeFi. Just two months later, it is still a dream, but the shining beacon in space has launched, Phase 0 is a go. On Dec 1, Beacon Chain was launched — the first in three major renovations geared towards Eth 2.0 that will span over the next two years. What it means for DeFi now and what to make of it for the long term? See in our brief.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MCbCgjEe4WSxXz0lqRx3XA.jpeg" /></figure><h3>Fact sheet</h3><p><strong><em>Timing:</em></strong> Ethereum 2.0 comes in 3 phases (see <a href="https://docs.ethhub.io/ethereum-roadmap/ethereum-2.0/eth-2.0-phases/"><em>ethhub</em></a><em> </em>from background reading &amp; see the table below)</p><p>1. <a href="https://ethereum.org/en/eth2/beacon-chain/"><strong>Beacon Chain</strong></a> (<a href="https://beaconscan.com/"><em>BeaconScan</em></a>)&gt; <br>2. <a href="https://ethereum.org/en/eth2/shard-chains/"><strong>Shard Chains</strong></a> &gt; <br>3. <a href="https://ethereum.org/en/eth2/docking/"><strong>Docking</strong></a> (fully functional Shard Chains &amp; full migration)<br> <br>All things considered, migrations and implications for DeFi will only be relevant (and will take final shape) in a couple of years.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bgGySG7WB4X8YebVhSxZlw.png" /><figcaption>ETH 2.0 planned rollout phases</figcaption></figure><ol><li><strong><em>App contracts: </em></strong>No application contracts on the Beacon Сhain, naturally. Only on shard chains.<br> <br><em>PSA: the following is about Phase 2, for which nothing is fixed yet.</em></li><li><strong><em>Tokens &amp; Shards: </em></strong>ERC20 standard will be updated to allow tokens to exist on all shards. You can move ETH freely between shards, the same can and will be done with tokens.<br> <br><strong><em>In a nutshell, the process goes like this: </em></strong><em><br>1 — You submit a transaction to the source shard, saying you want to transfer some ETH/ERC20 to a destination shard. <br>2 — The source shard processes the transaction and issues a receipt on a beacon chain for an outgoing transfer. <br>3 — The destination shard picks up that receipt and credits you with the same amount of ETH/ERC20.</em></li><li><strong><em>Dapps &amp; Shards: </em></strong>Dapp developers will be able to choose the shard to deploy their contract. This means that the option of having the entire DeFi ecosystem deployed onto one shard (like it’s on Ethereum mainnet now) is always there, with all its drawbacks (slow &amp; costly in gas). <strong>The question is, can we do better.</strong></li><li><strong><em>Contracts &amp; Shards: </em></strong>There’s a concept of “yanking”, an operation to move a contract from one shard to another. It can obviously only work with contracts with small enough state (not too much data to move). Contracts will define for themselves their yanking rules. One option is to allow any user to yank the contract to any shard of their choosing: if you want an atomic operation, just yank your Maker vault contract to the shard hosting the DAI/ETH Uniswap pair, and then do it.</li><li><strong><em>Transition:</em></strong> The current plan is that after Phase 2 is deployed, Eth1 will migrate to become a shard in Eth2. The transition will be mostly seamless, with all accounts and contracts just waking up on Eth2 one day, unchanged. Of course, clients and wallets will have to be updated (much like for other Eth1 hard forks, like Constantinople). <br><em>*Under the hood, it’s more complicated, since Eth1.x has to build stateless clients before Eth1 can be migrated, but let’s not get into that.</em></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dFEa6M9ba9NnjpFkI5VhJA.png" /><figcaption><strong>Systemic visualization on Eth2.0 phases: </strong>Phase 0 — <a href="https://beaconcha.in/">Beacon Chain </a>— launched the PoS network with first shards coming with Phase 1. (Img credit: <a href="https://twitter.com/trent_vanepps/status/1321936246332104705">Trenton Van Epps<em>)</em></a></figcaption></figure><h3>Technical considerations</h3><p>It’s too early to say anything for certain, as the stage of Eth2 that can host applications <strong><em>(Phase 2)</em></strong> is still a fair deal away, and isn’t locked in. In the absolute worst case, DeFi on Eth2 will work the same as DeFi on Eth1.</p><p>The current migration plan will just move everything into Eth2, the ecosystem will have to diverge from that point. For one thing, moving liquidity to Eth2 DeFi dapps will work the same as it is now between Eth1 dapps.</p><p>The current design discussions suggest that smart contract architectures optimal for sharded blockchain may be different. There likely won’t be natural atomic transactions between shards (there are some talks with unclear status), instead, there may be a shift to asynchronous (non-atomic) transactions and “yanking” contracts between shards. For applications, this means that the approach to contract architectures may change, making room to account for: <br> — compartmentalization of state for ease of yanking, <br> — mechanisms to use partial transactions and receipts, <br> — workarounds to account for lack of cross-shard atomicity.</p><p>Long atomic execution sequences (such as using flash loans to perform risk-free arbitrage between Uniswap-like exchanges) may leave us for good. There are three important use cases for atomic multi-contract transactions (possible only within one shard):</p><p>1. Using flash loans in complex deals;<br>2. Risk-free arbitrage;<br>3. UX-improving sequences, such as repaying a large loan on Maker and unlocking collateral in one transaction, using limited liquidity.</p><blockquote>Yanking can be a niche solution to these, provided every contract required for a use case is small enough and idle enough to be available for yanking (or they already reside on the same shard). Generally, though, the first two use cases may fall out of fashion, and the third one will have to be worked around with architecting the user-side contracts in a yankable way.</blockquote><p>We shouldn’t discard L2 solutions which continue rapid development, including non-custodial exchanges on zero-knowledge proofs, L2 chains on rollups, etc. By the time Phase 2 of Eth2 will be out, it is possible that all of the missing functionality for atomicity may move into cryptographically secured L2 networks attached to shards, preserving the existing modes of operations as they are.</p><p>Overall, Eth2 doesn’t (shouldn’t) break anything in DeFi, but may rather offer great excitement of much greater throughput, better security (with users running stateless nodes instead of going through central bottlenecks on their way to the blockchain), and maybe cooler use cases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/0*pUkkFokh77KjF6Wq.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*pGFVAnf3K4srA78r.png" /><figcaption>Img credits: <a href="https://boxmining.com/ethereum-2/">1</a>, <a href="https://www.seba.swiss/research/Beacon-chain-Conductor-of-the-ETH-2.0-orchestra">2</a></figcaption></figure><h3>Takeaways</h3><p>Frankly, it’s too early to tell anything for sure with regards to the DeFi: only Phase 2 will have contracts, it’s not locked in, and it’s expected no earlier than 2022. But for now, we already do have some things to think about.</p><h4>Benefits</h4><p>Smooth migration will preserve the existing DeFi ecosystem as is on the Eth1 shard, but new, Eth2-enhanced versions of the DeFi dapps may be deployed on different shards and <strong><em>have quick liquidity migrations</em></strong>. The immediate bonus is <strong><em>growth in throughput</em></strong> and <strong><em>possible reduction of gas prices</em></strong>, as the same amount of traffic will be a lower load on the network. Easily transferable tokens and moving smaller contracts between shards (“yanking”) will likely allow the network to <strong><em>balance loads between shards</em></strong>, better reacting to traffic spikes on particular contracts.</p><h4>Food for thought</h4><p>Atomic transactions, one of the most exciting properties of Ethereum contracts (enabling the notorious flash loans, for instance) will likely <strong><em>not work between shards</em></strong>, although workarounds may appear at a later time. <br>This can be sidestepped to an extent with contract yanking and putting a synergizing contract on the same shard, but these still are <strong><em>partial solutions</em></strong>, as not everything will be movable, and popular contracts may have to restrict yanking to provide a reasonable UX.</p><h3>Background reading</h3><p><a href="https://byzantine.solutions/redefine2020?utm_source=goingbyzantine&amp;utm_medium=medium_post&amp;utm_campaign=eth2.0"><strong><em>Redefine 2020: A Primer. Where Decentralization Meets Finance</em></strong></a><strong><em><br></em></strong>(<a href="https://cointelegraph.com/consulting/byzantine-solutions/redefine-2020-a-primer-where-decentralization-meets-finance?utm_source=byzantine.solutions&amp;utm_medium=medium&amp;utm_campaing=post"><em>CT promotion page</em></a>, <a href="https://drive.google.com/file/d/1ofnejMOyOn_PwuSNO5p6aE3gILG_mKc2/view?pdf=Redefine2020"><em>pdf</em></a>)</p><p><strong><em>Hot stuff</em></strong></p><ol><li>Vitalik’s post on cross-shard DeFi composability (<a href="https://ethresear.ch/t/cross-shard-defi-composability/6268"><em>ethresearch, Oct </em></a><em>’19</em>) <br>+ discussion in the same thread</li><li>Vitalik’s post on cross-shard contract yanking (<a href="https://ethresear.ch/t/cross-shard-contract-yanking/1450"><em>ethresearch, Oct ‘19</em></a>)</li><li>Docs on Ethhub, including Eth2 phases (<a href="https://docs.ethhub.io/ethereum-roadmap/ethereum-2.0/eth-2.0-phases/"><em>ethhub</em></a>)</li></ol><p><strong><em>Other relevant material</em></strong></p><ul><li>Vitalik’s post on eth1 =&gt; eth2 migration (<a href="https://ethresear.ch/t/the-eth1-eth2-transition/6265"><em>ethresearch, Oct ‘19</em></a>)</li><li>Sharding FAQ on ethwiki (<a href="https://eth.wiki/sharding/Sharding-FAQs"><em>ethwiki</em></a>)</li><li>Eth 2.0 specs (<a href="https://github.com/ethereum/eth2.0-specs"><em>Github</em></a>) and <a href="https://notes.ethereum.org/@djrtwo/Bkn3zpwxB?type=view"><em>Phase 0 for Humans</em></a> writeup</li><li>Eth2 page <a href="https://ethereum.org/en/eth2/"><em>on ethereum.org</em></a></li><li>Staking contract for Eth 2.0 Phase 0 beacon chain (<a href="https://etherscan.io/address/0x00000000219ab540356cbb839cbe05303d7705fa"><em>etherscan</em></a>)</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c6d50c655d8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/going-byzantine/defi-in-eth-2-0-and-migrations-6c6d50c655d8">DeFi in Eth 2.0 and migrations</a> was originally published in <a href="https://medium.com/going-byzantine">Going Byzantine</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[EY Nightfall: Timber]]></title>
            <link>https://medium.com/going-byzantine/ey-nightfall-timber-b35050ded824?source=rss----1e6078c0028f---4</link>
            <guid isPermaLink="false">https://medium.com/p/b35050ded824</guid>
            <category><![CDATA[offchain]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[scalability]]></category>
            <dc:creator><![CDATA[Ivan Kamakin]]></dc:creator>
            <pubDate>Wed, 29 Jan 2020 09:34:00 GMT</pubDate>
            <atom:updated>2020-01-29T16:20:07.507Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LjhUkD0iX5bR-OUHdmwm5w.jpeg" /></figure><p>EY Nightfall is a Layer 2 private transaction framework that fairly recently has garnered major attention in the sphere. Nightfall uses zero knowledge proofs together with off-chain transaction processing and achieves functionality similar to ZCash, but on Ethereum:</p><ul><li>the users make blinded commitments to their coins in a Merkle tree;</li><li>coins are spent by constructing a SNARK proving that there is an unspent coin known to the user somewhere in the tree, without revealing which coin;</li><li>when the coin is spent, the user also attaches a nullifier — a commitment-determinant string that ensures the same coin will not be spent in the future.</li></ul><p>While the Nightfall design around zero knowledge is solid, it is not the primary innovation of the project, as it for the most part follows the construction of ZCash. What is truly interesting about it, however, is its approach to data availability.</p><p>Data availability is an ever-present issue in Layer 2 designs, which leads to users’ inability to withdraw their assets from the off-chain network back onto the chain in the worst case where the operator of the off-chain network refuses to provide necessary data/witnesses.</p><p>There are various approaches to this problem, but in this article we will focus on the Nightfall’s protocol for solving data availability called Timber. Timber facilitates on-chain availability, which means that the entirety of the data required for a withdrawal can be reconstructed from the synchronizable chain history. While on-chain availability is in general costly in terms of Layer 1 storage, Timber uses a set of clever tricks to minimize the amount of stored data, thus achieving the solution in a relatively cheap way.</p><p>Timber utilizes the fact that the tree of commitments (which is all the data necessary to withdraw coins in this ZCash-like architecture) is append-only, so with each new addition only a small subset of tree nodes needs to get recomputed. Therefore, Timber does not store the entire tree, instead storing in a contract a small (<em>O(log(n))</em>, to be precise) number of nodes called “frontier”. The frontier contains only the nodes that are required to recompute the root when adding a new leaf into the tree.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TnWUW0YwNLhbNnOZ.gif" /><figcaption>Illustration of Timber’s on-chain storage mechanics. Courtesy of Michael Connor.</figcaption></figure><p>This technique allows to ensure the consistency of the tree root while severely cutting down on storage costs. Note, however, that it does not make addition of individual leaves efficient — since at least one new node will be written/rewritten in the frontier — but with batch addition the frontier is only updated after the entire batch, which means that <em>O(n)</em> leaves may be added at the cost of <em>O(log(n))</em> storage writes.</p><p>Another interesting approach reflects in some ways the <a href="https://ethresear.ch/t/history-state-and-asynchronous-accumulators-in-the-stateless-model/287">design philosophy</a> of Ethereum 2.0 regarding application layer: instead of storing the state of the system within the smart contract (which is expensive), the app enables users to build the full state locally from history, which is fully on-chain. Only a small amount of data is stored on-chain to help users check the consistency of the final state. Consequently, instead of storing leaves on-chain, Timber emits an event for each new leaf, specifying the leaf index and value, and the new root. Nightfall also provides a local listener that detects “NewLeaf” events and builds locally a full Merkle tree. The user can then use this local tree to construct SNARKs that verify with the on-chain root. Since events are much cheaper than storage writes, this allows to further reduce the cost.</p><p>Overall, with proper batching and without taking SNARK verification into consideration (efficiently verifying SNARKs on-chain, although very much doable, is a big separate topic), the amortized cost of each transaction in Nightfall is ~10k gas (which mostly covers event emission) which is 2x times cheaper than ordinary Ethereum transfers with an added benefit of privacy on top.</p><p>Timber is exciting to us is because it can be a useful and mechanically simple data availability solution for future projects, and can be used as a ready-made primitive by architects when designing Layer 2 applications. All Timber requires to work is the state tree being append-only, which can be done even for complex state transition functions (which is illustrated in the same <a href="https://ethresear.ch/t/history-state-and-asynchronous-accumulators-in-the-stateless-model/287">Ethresearch thread</a>). While it still limits scalability to some degree, it fits very well into the Ethereum 2.0 paradigm of “history first, storage second”, and we are likely to see this mechanism used extensively as Ethereum’s ecosystem grows.</p><p>If you want to learn more, check out the <a href="https://github.com/EYBlockchain/timber">Github repository</a> for Timber.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b35050ded824" width="1" height="1" alt=""><hr><p><a href="https://medium.com/going-byzantine/ey-nightfall-timber-b35050ded824">EY Nightfall: Timber</a> was originally published in <a href="https://medium.com/going-byzantine">Going Byzantine</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Current state of MPC in privacy-preserving ML]]></title>
            <link>https://medium.com/going-byzantine/current-state-of-mpc-in-privacy-preserving-ml-575486684f4c?source=rss----1e6078c0028f---4</link>
            <guid isPermaLink="false">https://medium.com/p/575486684f4c</guid>
            <category><![CDATA[multi-party-computation]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[cryptography]]></category>
            <dc:creator><![CDATA[Ivan Kamakin]]></dc:creator>
            <pubDate>Wed, 25 Sep 2019 11:38:01 GMT</pubDate>
            <atom:updated>2020-09-30T11:51:07.116Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yEui6E28wzCm1w2eGJmf3A.png" /></figure><h3>Motivation</h3><p>Privacy-preserving computation is one of the hottest current topics in cryptography, which has become especially sought after with numerous leaks in recent years even by <a href="https://www.cbsnews.com/news/millions-facebook-user-records-exposed-amazon-cloud-server/">big</a>, <a href="https://us.norton.com/internetsecurity-emerging-threats-uber-breach-57-million.html">well-established</a> organizations endangering the users’ privacy and even safety (especially where geopositional data is concerned).</p><p>Companies that receive and store public data in plaintext run the risk of being breached and the data leaking, but there is also a growing concern of FAANG (and possible future tech giants) being able to use the data accumulated over the years to sway public opinion on a massive scale and, e.g., manipulate elections.</p><p>In most cases user data is collected by businesses (at least, initially) for the purposes of targeted advertising and recommendation. For such tasks, companies use data processing pipelines constructed of various preprocessing tools and machine learning models. This leads us to believe that PPC tools tailored to machine learning would allow to fulfill the overwhelming majority of companies’ business goals in a way that not just protects user data better, but eliminates the possibility of a breach altogether, as at no time the companies would have the user’s data in plaintext.</p><p>While there are several other approaches to privacy-preserving ML, such as homomorphic encryption or functional encryption, multi-party computation gets the most attention in state-of-the-art research and, especially, implementations. The reason for that is that MPC is currently the most efficient technique of privacy-preserving computing (although it has its own efficiency struggles, which we will outline below). More than that, MPC protocols are based on much simpler cryptographic primitives than their analogues, mostly having to do with only finite field additions/multiplications with very limited utilization of more advanced protocols in certain parts, while, e.g., homomorphic encryption is based on a recent and complex R-LWE assumption.</p><p>One of our recent projects involved extensive research into various modes of privacy-preserving machine learning, and we decided to share some of our findings for those who want to start their own research into this field.</p><h3>Multi-party computation protocols</h3><p>Generally, MPC boils down to computing arithmetic circuits (i.e., circuits where gates are addition and multiplication and wires hold numbers) on shares of some secret data — only collecting some subset of all shares for a single data point would allow to reconstruct that point. While in machine learning these circuits may become quite large, the base procedure remains the same (with the exception of non-polynomial functions, which require additional tricks). Therefore, all MPC protocols can be fully described by procedures for computing additions and multiplications on data that is shared among several peers. Addition is usually simple (most of the secret sharing schemes are additive, so addition on shares comes naturally), but multiplication is complex and requires communication among participants.</p><p>Generally, MPC communication complexity rises sharply with the number of computing parties (with all other parameters, such as the level of security and adversarial model, being equal), so it is preferred to have as few participants as possible. For example, widely used protocols <a href="https://link.springer.com/chapter/10.1007/978-3-642-32009-5_38">SPDZ</a> and <a href="https://eprint.iacr.org/2018/442.pdf">SecureNN</a> are 2PC and 3PC, respectively. Without loss of generality, we will focus on the 2PC case to keep the math concise.</p><p>We will describe a basic MPC protocol, and then will outline some modifications to this protocol made for various purposes.</p><h4>Basic MPC scheme</h4><p>Suppose that we have an additive secret sharing scheme such that for any data value <strong>x, </strong>and finite field modulus<strong> q </strong>there are</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/436/1*V3C-W2HcLCjP8pBleQ4BOQ.png" /></figure><p>In practice this is usually done by sampling the first share randomly and computing the second share. Then shares can be distributed between two computing parties, and as long as they do not collude, the initial data cannot be recovered. In this setting, computation of linear combinations does not impose additional overhead:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/1*28Q8A-6e9IZsudp6e_aEjw.png" /></figure><p>Multiplication is more challenging. Suppose that we need to get additive shares of a product</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*YW8SOjmEG-9twD0BtMRs9Q.png" /></figure><p>While the first and fourth terms can be computed by the parties locally, the second and third term mix shares of different parties.</p><p>To securely compute the shares of the product, the so-called Beaver’s trick is used. Beaver’s trick defines an oracle that outputs shares for a triple</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/1*gmg9a7qoc7NWi9U1YaptcA.png" /></figure><p>(i.e., shares of two random numbers and their product). Then, the parties compute</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/391/1*WGvF9GZ2qQuI7i70jt5MgA.png" /></figure><p>and combine the computed shares to reconstruct (“open”)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/359/1*oYcdAZk8Y-vYr66f2VTrHQ.png" /></figure><p>Since <strong>a</strong> and <strong>b</strong> were sampled randomly, these new values perfectly mask <strong>x</strong> and <strong>y</strong>, but they can be used to compute the shares of the product:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*2OItgwkmMUkrGSQCias9eg.png" /></figure><p>One can easily check that they are indeed additive shares:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*P9FwSZZE_RLHJERctOPwlg.png" /></figure><p>Note that opening masked values necessarily requires communication between computing parties.</p><p>Additionally, for each multiplication gate, a separate Beaver triple (which is a triple of shared secrets) needs to be computed. In some cases differences between different MPC protocols boil down to the protocol for generating these triples. For example, the SPDZ protocol uses a <a href="https://eprint.iacr.org/2011/277.pdf">homomorphic encryption</a> scheme to compute triples, while <a href="https://eprint.iacr.org/2016/505.pdf">MASCOT</a> uses <a href="https://crypto.stanford.edu/pbc/notes/crypto/ot.html">oblivious transfer</a> for these purposes. Finally, (<a href="https://eprint.iacr.org/2017/1230.pdf">Keller et al, 2017</a>) propose to forego triples entirely, and instead use semi-homomorphic encryption (i.e., encryption that allows to add encrypted values) to compute mixed terms.</p><h3>Improvements</h3><p>Actual practical protocols build on top of this foundation to gain various useful properties.</p><p>Most protocols used in practice add MACs to ensure that values are not corrupted by an active adversary when these values are opened (this often happens, e.g., during multiplication). To prevent too much overhead, the protocols use a single MAC value, which is only revealed in the end. Commitments ensure that incorrect openings of values are detectable in the end of the protocol — although the computation result would be incorrect, the responsible party will be discovered.</p><p>Often machine learning-specific improvements are introduced.</p><p>As machine learning mostly involves vector computations, arithmetic on shared secrets is vectorized in a natural way — instead of numbers, computing nodes hold shares of tensors; instead of computing triplets of numbers, triplets of tensors are computed and used in the same way as Beaver triplets in the protocol above.</p><p>To implement fixed point arithmetic (as often model weights are floating point numbers), the numbers are represented as integers modulo a large prime, and truncated if their length is large.</p><p>Finally, computation of models such as neural networks requires computation of non-linear activations. While it is in principle possible to compute activations directly through addition and multiplication gates, in practice this is extremely inefficient. Authors propose separate activation function calculations, for example, (<a href="https://eprint.iacr.org/2017/396.pdf">Mohassel and Zhang, 2017</a>) propose to use <a href="http://web.mit.edu/sonka89/www/papers/2017ygc.pdf">garbled circuits</a> for evaluating ReLU activations on private inputs, as well as using the <strong>f(x)=x² </strong>activation to compute activations with a single shared value multiplication.</p><h3>Implementations</h3><p>While for homomorphic encryption only solutions for general binary and arithmetic circuits are available (so any type of complex computation must be implemented manually), for MPC there are already comparatively mature integrations with popular ML/DL frameworks.</p><p><a href="https://github.com/tf-encrypted/tf-encrypted">TF Encrypted</a> allows for seamless transition between using standard TF and the privacy-preserving version — the only difference is that instead of the usual tf.Tensor TFE uses PrivateTensor. Tensor additions are essentially the same, and tensor multiplications require computing servers (typically, 2 servers) to exchange special “masked tensors” (which are an extension of Beaver’s trick for tensors). So, while data exchange during instantiation of private tensors and multiplication has to be implemented manually, other methods and utilities from TF work just as they do in standard local computation.</p><p><a href="https://github.com/OpenMined/PySyft">PySyft</a> is similar to TFE, but also allows to use pyTorch as backend. Unlike TFE, it also allows provides out-of-the-box tools for differential privacy and federated learning. Differential privacy and federated learning are not privacy-preserving ML techniques, but rather techniques for aggregating user data that are anonymous by design. Although this is out of scope of this article, this <a href="https://ai.googleblog.com/2017/04/federated-learning-collaborative.html">Google blogpost</a> provides a quick overview with a number of in-depth sources.</p><h3>Security considerations</h3><p>MPC could potentially present an alternative to homomorphic encryption for facilitating privacy-preserving machine learning computation. A significant advantage of the MPC approach compared to HE is the existence of developed toolkits specifically tailored to machine learning (in contrast to HE, where existing implementations only provide a low-level interface). Additionally, performance tests suggest that, while the computational overhead is still quite large, it is several orders of magnitude lower than in HE.</p><p>However, there are challenges that complicate practical use of SPDZ and similar protocols for ML:</p><ol><li>Current MPC protocols have severe communication bottlenecks — essentially, each multiplication gate requires a round of communication from computation nodes. Considering that communication performance tests (presented, e.g., <a href="https://arxiv.org/pdf/1811.04017.pdf">here</a>) show significant slowdown even when performed on different sockets on the same machine (i.e., without latency), adding latency for each multiplication gate would likely make the system impractical. Although this can be somewhat remedied by applying multiplication to whole tensors (which is done often in practice), the problem will remain on a smaller scale.</li><li>Current MPC protocols employ strong security assumptions within the so-called “passive-but-curious” or “semi-honest” adversary model, which assumes that (in the concrete case of 2PC) only one of the computing nodes is corrupted at any time. This is highly restrictive in any setting, especially fully trustless networks — one of the parties in an ML computation (the data owner or the model owner) can simply bribe both computing nodes and recover shares of their counterparty’s data/model weights. Although there are MPC protocols that assume stronger adversaries, they are mostly concerned with ensuring the computation correctness, and do not protect from data leakage.</li><li>Most MPC protocols only support addition and multiplication circuits, and more complex non-polynomial operations (such as equality checks and comparisons) require additional techniques which increase overhead.</li></ol><h3>Conclusion</h3><p>MPC protocols for privacy-preserving ML solve a very relevant modern problem, and, as such, R&amp;D in this sphere is extremely active. Just in the last 2 years there were a number of significant publications and released implementations.</p><p>Although protocols and their implementations are (as of yet) unfit for fully trustless environments due to their strong assumptions on lack of collusion, they already can be used in certain limited scenarios.</p><p>We believe that any researcher in cryptography or DLT should be at least aware of this field, as the current rate of R&amp;D implies that practical solutions will soon appear, opening a possibility for more ethical and transparent practices in handling of user data.</p><h3>References</h3><ol><li><a href="https://www.cs.tau.ac.il/~iftachh/Courses/Seminars/MPC/Intro.pdf">Gentle introduction to MPC</a></li><li><a href="https://eprint.iacr.org/2012/642.pdf">Original SPDZ paper</a></li><li><a href="https://eprint.iacr.org/2018/442.pdf">SecureNN paper</a></li><li><a href="https://eprint.iacr.org/2016/505.pdf">MASCOT paper</a></li><li><a href="https://eprint.iacr.org/2017/1230.pdf">Overdrive: an improved SPDZ variant</a></li><li><a href="https://crypto.stanford.edu/pbc/notes/crypto/ot.html">Oblivious transfer primer</a></li><li><a href="http://web.mit.edu/sonka89/www/papers/2017ygc.pdf">Garbled circuits primer</a></li><li><a href="https://eprint.iacr.org/2017/396.pdf">SecureML: A System for Scalable Privacy-Preserving Machine Learning</a></li><li><a href="https://arxiv.org/pdf/1810.08130.pdf">Private Machine Learning in TensorFlow using Secure Computation</a></li><li><a href="https://github.com/tf-encrypted/tf-encrypted">TFE repository</a></li><li><a href="https://github.com/OpenMined/PySyft">PySyft repository</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=575486684f4c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/going-byzantine/current-state-of-mpc-in-privacy-preserving-ml-575486684f4c">Current state of MPC in privacy-preserving ML</a> was originally published in <a href="https://medium.com/going-byzantine">Going Byzantine</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ethereum Storage Rent: What should we expect?]]></title>
            <link>https://medium.com/going-byzantine/ethereum-storage-rent-a2b89e96bd35?source=rss----1e6078c0028f---4</link>
            <guid isPermaLink="false">https://medium.com/p/a2b89e96bd35</guid>
            <category><![CDATA[protocol]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Ivan Kamakin]]></dc:creator>
            <pubDate>Mon, 11 Mar 2019 18:18:44 GMT</pubDate>
            <atom:updated>2020-09-30T11:50:12.278Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G4LI8aNYZfzhZ_mpVtfX5w.png" /></figure><p>Blockchain rent in Ethereum has been a topic of discussion since at least 2015, and quite fruitfully so: several methods of implementing rent were designed. However, since then the talks have died down, mostly because Ethereum state size was not an issue at that time and there were more important optimizations to attend to.</p><p>The discussion was rekindled in November 2018, when <a href="https://ethereum-magicians.org/t/ethereum-1-dot-x-a-half-baked-roadmap-for-mainnet-improvements/1995">a new roadmap for short-term Ethereum scalability</a> (dubbed Ethereum 1.x) surfaced. The scalability improvements are set to arrive in 2019 and the Ethereum ecosystem is uncertain of what to expect.</p><p>This post aims to clarify the design and motivation behind blockchain rent for all concerned. The preliminary requirement for the material is knowledge of some blockchain and Ethereum basics. If you have a high-level understanding of how blockchain works, what gas is, and how it charged, it should be quite accessible.</p><h3>Why do we need blockchain rent?</h3><p>Discussions around curbing blockchain and state growth are not exclusive to Ethereum — they started as soon as the first years of Bitcoin and were one of the central topics in the Bitcoin vs. Bitcoin Cash debate.</p><p>Rapid growth of space requirements (for example, <a href="https://youtu.be/8zVzw912wPo">Bitcoin would need 24 Gb blocks</a> to rival VISA) can lead to “household nodes” becoming non-existent — fewer owners would be comfortable allocating terabytes of space for free, even if their initial motivation to install a node was ideological. This would result in only powerful corporate/nation-state nodes being able to satisfy the growing requirements, leading to centralization and making the network a more cumbersome variant of traditional centralized solutions. Because of this, any substantial scaling through naive block size increases leads to centralization and countermeasures need to be designed to avoid that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LvAKn9Z1l7S8SlP1" /><figcaption><em>A slide from Joseph Poon’s classic talk on Lightning, with some calculations for Bitcoin block size scaling.</em></figcaption></figure><p>This leads us back to Ethereum 1.x. One of the key points of the proposed roadmap are some recently discovered optimizations in Ethereum clients that allow to reduce block propagation time and, consequently, increase block gas limit without increasing a number of uncle blocks, which destabilize the network.</p><p>However, there is still an issue of blockchain and state growth, which will accelerate proportionally to the gas limit increase. And this is where blockchain rent comes in. Economically incentivizing the developers to free-up space that is no longer needed can help slow down state growth and even possibly reduce its overall size immediately after activation, if older unused contracts are salvaged.</p><p>Also, despite being an additional headache for developers, blockchain rent can actually reduce fees for them, if they manage to free-up state in time.</p><h3>How does it work now?</h3><p>Persistent memory in Ethereum is called storage — the data written there, which constitutes both the code of the contract and its state, remains between calls, and nodes have to store it.</p><p>A special opcode to write 32 bytes (a “word” in Ethereum specification) into storage is SSTORE, and currently it costs 20000 gas if new slot is filled, or 5000 gas if a value is changed in an existing slot.</p><p>One can also set a slot value to zero to free it up (or use STORAGEKILL), and receive a refund of 10000 gas. It is important to note, though, that gas isn’t backward-convertible to Ether — if one wants to utilize the refund, they have to either spend it during the same transaction or bundle their transaction with another that will in turn consume that gas.</p><p>The main issue with the current system is that it does not incentivize developers to free-up space after a short time. There is no refund fall-off through time, and utilizing the refunded gas requires additional work to set up, so for most developers it simply isn’t worth the effort.</p><p>There are also some unpleasant externalities:</p><ul><li>Firstly, the current mechanism is path-dependent — even if you delete all the data you’ve written inside the same block, you will still pay an amount that is proportional to the number of writes, while with blockchain rent you will pay nothing, because time of storage is taken into consideration. A partial solution to this issue was proposed in the Constantinople update, <a href="https://blog.ethereum.org/2019/01/15/security-alert-ethereum-constantinople-postponement/">but the corresponding EIP was disabled after a vulnerability was found.</a></li><li>Secondly, it is currently possible for the miners to perform gas price arbitrage by saving junk into storage and then releasing it during congestion periods if gas price has risen more than 2x. There is even a project called <a href="https://gastoken.io/">GasToken</a> that provides a nifty Ethereum contract to do so. The negative here is that full node owners have to store all that junk data in their state.</li></ul><h3>Proposed payment mechanisms</h3><p>To implement blockchain rent, a number of design choices have to be considered. The first and the biggest element of design is the payment method. There are three methods that have primarily gained traction.</p><p><strong>Direct payment per word-block.</strong> The most straightforward scheme was the first one proposed — a mechanism where a contract account is charged some amount each time someone makes a call, depending on the number of words stored and time elapsed since last call. The payment is calculated as</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*tfoddkQ755JwpuozQpjXZQ.png" /></figure><p>where <strong><em>TOTFEE(n)</em></strong> is a cumulative fee dependent on block number. It can be set to something as simple as <strong><em>TOTFEE(n)=cn</em></strong>, or it may be a more complex function — for example, if we want a 5 GB restriction on total state size, we can make the fees rise exponentially as state size nears this threshold.</p><p>The advantages of this mechanism are its simplicity and the fact that there’s no need for explicit refunds. The developers are simply incentivized to free-up storage so that they don’t have to pay unnecessary fees further. However, it needs an explicit deletion scheme, which is a tricky design challenge for a number of reasons (see below).</p><p>There is also a special type of attack on this mechanism called dust griefing attack, where an attacker may do arbitrary token transfers to new addresses to increase storage rent for the contract forever, at a relatively small cost to herself. Although it is specific to token contracts only, ERC20 tokens are essential to the current Ethereum ecosystem, which makes this attack an important issue. Here are some metrics to consider — ERC20 currently constitute <a href="https://ethereum-magicians.org/t/state-rent-proposal-update-and-dark-rent-markets/2202">53% of total state</a> and more than a third of total state are taken up by balances.</p><p>Despite these challenges, this payment method was the primary one considered for implementation in <a href="https://github.com/ledgerwatch/eth_state/blob/master/State_rent.pdf">the latest version of rent proposal</a>.</p><p><strong>Exponential refund. </strong>The second mechanism takes a different approach — instead of charging some amount per time elapsed, it charges “a fee for owning the slot forever” at the time of write, and when the slot is freed, the remainder is returned.</p><p>If the initial paid amount is <strong><em>F</em></strong>, then the refunded amount is</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C-8SYRyql7ElQee5pzA1cA.png" /></figure><p>where <strong><em>B</em></strong> and <strong><em>B0</em></strong> are current block and the block of the initial write respectively, and <em>I</em> is some discount rate we set to regulate the speed of decay.</p><p>For an intuition, consider the price of a stock — it represents the sum of dividends paid to the owner each year, discounted with some cost-of-capital rate. Barring changing dividend expectations, if you sell the stock after 2 years, you will receive the new price with dividends for those 2 years subtracted. The logic behind this mechanism is the same, although instead of dividends you consume value through storage use.</p><p>There is an issue with implementing this model as-is — we have to store time of creation for each active slot in the storage, which is a considerable overhead. To circumvent that, we can instead use a sort of average-cost accounting: instead of tracking the initial block per-slot, track the “last accessed” block <strong><em>T</em></strong> and a total deposit per-account <strong><em>D</em></strong>, and after clearing the slot the deposit is set to</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*H7fQKbCIjHIanQj0QdqFJw.png" /></figure><p>while <strong><em>D/S</em></strong> (after reducing the deposit) is refunded. This heuristic produces the same result on average and reduces the overhead from per-slot to per-account.</p><p>The downside to this mechanism is that, to provide ample incentive for cleaning up, <strong><em>F</em> </strong>should be sufficiently big — substantially bigger than current per-write fee. Such a change could lead to “get it while it’s cheap” mentality and massive hoarding before the update, followed by dark rent markets.</p><p>However, the colossal advantage is that it is extremely backward-compatible — it doesn’t require an explicit deletion mechanism, and implementing fees comes down to implementing dynamic pricing for SSTORE and STORAGEKILL. This feature makes the mechanism a prime candidate for immediate implementation in Ethereum 1.x.</p><p><strong>Pseudo-random sampling. </strong>This last mechanism is interesting and easy to understand, but hasn’t gained a lot of traction because it relies on pseudo-random sampling, which is a yet-to-be-solved problem in Ethereum.</p><p>In this mechanism a contract gets a second balance called “lease”. There is also a system-wide parameter “rent”, which can be regulated in a same manner as the gas limit. On each block, we choose a set of accounts to be charged pseudo-randomly with probabilities proportional to their fraction of total storage.</p><p>If the account does not possess enough funds in its lease balance when miners try to charge it, it deleted or archived.</p><p>With this payment model it’s fairly easy to calculate your average rent costs, although one has to consider an always non-zero chance of default. It’s also backward-compatible — all new values can be assumed to always have been zero.</p><p>However, the required pseudo-randomness is not implemented yet, and is unlikely to be implemented very soon, so this mechanism is something that would probably be explored in Serenity.</p><h3>Ether vs. Gas</h3><p>Another important variable is currency in which the fees are paid. There are some advantages and disadvantages to using Ether and to using Gas.</p><p>If we use Ether, it becomes easier to decouple economics of computation fees and storage fees. Currently, if the network is congested and the price of computation is high, storage also becomes expensive, which is suboptimal. With Ether fees we can introduce a pricing mechanism tailored specifically to the task of charging for storage. This would also introduce an additional source of utility demand for Ether — while they are unlikely to be considerable at first, in the future storage costs may grow large enough to increase and stabilize the price.</p><p>However, an Ether-denominated fee requires more consensus-level changes to implement, and also needs an explicit price discovery mechanism. This complexity makes Ether-based fees less suitable for Ethereum 1.x simply from implementability and backward-compatibility standpoints.</p><p>Conversely, with gas it’s much easier to reconcile the new mechanism with older systems — price discovery is already present and introducing storage rent may amount to calculating prices/refunds for SSTORE and STORAGEKILL dynamically. However, the aforementioned gas price arbitrage externality remains, and the refunded gas is harder to utilize, because it has to be used immediately in other transactions.</p><h3>Account Resurrection</h3><p>If a payment scheme requires contract deletion, we also want to implement some resurrection protocol, so that, for example, long-term lock-up contracts aren’t lost.</p><p>The current proposal is to leave a receipt in the blockchain each time the contract gets deleted, which later can be used to resurrect the contract with its state unchanged.</p><p>However, there are some unsolved design challenges with deletion and resurrection:</p><ul><li>Firstly, this resurrection scheme may be exploited if the contract were destroyed twice — the attacker can present the older receipt and, thus, revert contract state. To solve this, a system was proposed where someone can challenge contract resurrection by presenting a more recent receipt. However, such system would require major changes to protocol, and incentive of challengers must also be designed.</li><li>Secondly, contract deletion in general leads to a freerider-like problem with public contracts — while there is a centralized developer, they will likely maintain the contract and ensure it has enough funds for rent, but for contracts with no explicit owner it is unclear who should pay. Some recent advances, such as Liberal Radicalism distribution system, may help in that regard, but it is an open topic.</li></ul><h3>Who receives the payment?</h3><p>The final design choice we have to make is how the accumulated funds are distributed.</p><p>Naturally, we want to distribute them among full nodes, but the only full nodes we can reliably verify are miners. There already concerns over great concentration of Ether in miners’ hands, which can lead to collusion and 51% attacks in Serenity. Giving miners an additional source of income would likely exacerbate the problem.</p><p>The method that is likely the most popular right now is simply burning the collected Ether, creating deflation. It is certainly the simplest, however, at the current stage of Ethereum ecosystem the deflation would likely be “crowded-out” by speculative price movements. This does, however, seem an effective measure of redistribution in a mature network with stable Ether and high storage use, so it seems to be the best model for Serenity.</p><h3>Conclusion</h3><p>Blockchain rent caused a bit of panic in the Ethereum community in the last couple of months. With this post, we wanted to familiarize all concerned with the current state of discussion and give some definitive notion of what to expect.</p><p>If you have your own ideas on mechanisms and techniques that could make blockchain rent more socially useful and friendly to Ethereum users, we urge you to join the discussion at <a href="https://ethresear.ch/t/ethereum-state-rent-for-eth-1-x-pre-eip-document/4378">Ethresearch</a> or <a href="https://ethereum-magicians.org/c/working-groups/ethereum-1-x-ring">Ethereum Magicians</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2b89e96bd35" width="1" height="1" alt=""><hr><p><a href="https://medium.com/going-byzantine/ethereum-storage-rent-a2b89e96bd35">Ethereum Storage Rent: What should we expect?</a> was originally published in <a href="https://medium.com/going-byzantine">Going Byzantine</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>