<?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 Distributed Lab on Medium]]></title>
        <description><![CDATA[Stories by Distributed Lab on Medium]]></description>
        <link>https://medium.com/@distributed-lab?source=rss-6ed4aa1fcd15------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*n50tzaPEyy9MiDVobeRnNg.jpeg</url>
            <title>Stories by Distributed Lab on Medium</title>
            <link>https://medium.com/@distributed-lab?source=rss-6ed4aa1fcd15------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 03:15:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@distributed-lab/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[Token protocols war on top of Bitcoin]]></title>
            <link>https://medium.com/distributed-lab/token-protocols-war-on-top-of-bitcoin-2b850040d424?source=rss-6ed4aa1fcd15------2</link>
            <guid isPermaLink="false">https://medium.com/p/2b850040d424</guid>
            <category><![CDATA[l2]]></category>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[tokenization]]></category>
            <dc:creator><![CDATA[Distributed Lab]]></dc:creator>
            <pubDate>Thu, 06 Jun 2024 17:20:03 GMT</pubDate>
            <atom:updated>2024-06-06T17:20:03.016Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U_I14GVG6OyxvrnersL-IQ.png" /></figure><p>Bitcoin, often recognized as the “king” of cryptocurrencies, boasts the highest market value and operates under simple yet robust rules. Its decentralized nature and resistance to censorship have earned it the moniker “digital gold.” However, Bitcoin’s strengths — its immutable rules and resistance to control — have made it less appealing for mainstream adoption as a payment method… until now!</p><p>Innovative minds have developed token protocols that operate on the Bitcoin network to address this challenge. Building assets on top of Bitcoin leverages its unparalleled security and decentralization. This provides a strong foundation for new tokens, inheriting Bitcoin’s security. Additionally, these tokens can tap into the vast Bitcoin ecosystem and liquidity, potentially reaching a wider audience and benefiting from its established infrastructure.</p><p>In this article, we compare and analyze several fungible token protocols built on Bitcoin, including BRC-20, Runes, Taproot Assets, and LRC-20. We explore their distinct features, advantages, and potential use cases to illuminate this evolving landscape of Bitcoin-based assets.</p><h3><strong>BRC-20</strong></h3><p>The <a href="https://domo-2.gitbook.io/brc-20-experiment">BRC-20</a> protocol was proposed as a fun experimental standard to see if the <a href="https://docs.ordinals.com/">ordinal theory</a> can facilitate fungibility on Bitcoin. It has very limited functionality (all functions are just JSON metadata) to be executed:</p><ul><li><strong>deploy function</strong> — declares the token symbol and its rules, such as supply, whether anyone can mint it, tokens limit per mint call, etc.</li><li><strong>mint function</strong> — mints a certain amount of the mentioned tokens to the issuer’s address. This function can be used by anyone if it was stated during the deployment, so either only the issuer can mint, or anyone can mint</li><li><strong>transfer function</strong> — transfers a certain amount of tokens to another address</li></ul><p>BRC-20 information about tokens is public, because of an OP_RETURN-based approach. It’s not impossible to say that publicity/privacy is bad or good, but we can say that implementing both approaches is good (so that the user can choose what suits them), and that’s not the case here. While anyone can see and recognize TXs with BRC-20 data, it still requires an additional module to parse BRC-20 metadata. BRC-20 tokens increase the demand for Bitcoin transactions, driving up fees due to heightened competition for limited block space. Additionally, the larger size and complexity of BRC-20 transactions consume more blockchain resources, further contributing to their higher cost compared to regular Bitcoin transactions. This congestion reduces the amount of transactions processed on the blockchain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6H2nM-kPr9NKanHW1_anTg.jpeg" /></figure><h3><strong>Runes</strong></h3><p><a href="https://docs.ordinals.com/runes.html">Runes</a> is another protocol that uses ordinals theory and is partially OP_RETURN-based. The protocol supports the following operations:</p><ul><li><strong>Etching</strong> — announces the rune (token), its name, symbol, terms (supply, pre-mine, cap), etc.</li><li><strong>Mint</strong> — mints a fixed amount of new units, subject to the terms of the mint.</li><li><strong>Transfer</strong> — transfers runes from the inputs to that transaction’s outputs.</li></ul><p>Unlike BRC-20, runes are bound to UTXOs. Runes are always “anyone-can-mint”, but the issuer (who etches the runes) can pre-mine all supply during the etching. Also, it is possible to make tokens mintable only during a certain period, e.g., from block 841000 to 842000. Transactions with runes in the inputs will move them to outputs and can be configured, i.e., to which output, how much, and which runes will be moved, using the OP_RETURN op-code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pPFm-z6-pTQixXbMSgI8mw.jpeg" /></figure><h3><strong>Taproot Assets</strong></h3><p>At first, taproot’s idea was to hide Bitcoin scripts inside the public key so the user could either spend it using the signature (or multi-signature) or by revealing the script and satisfying it. The validator nodes can then verify that the script was stored inside the public key and the user fulfilled its requirements. But there is another core idea — any data can be put in a taproot key (and the address bound with such a key), which is spent by regular signature. So, no additional data (at least in the Bitcoin blockchain) must be revealed.</p><p>Lightning Labs proposed the <a href="https://docs.lightning.engineering/the-lightning-network/taproot-assets"><strong>Taro</strong></a> protocol and its idea is to store metadata inside the Taproot key using the Merkle Trees, concretely — Sparse Merkle Tree. SMT is a key-value tree that has 2^n leaves (n = 256 in their case), and the position of the inserted data is determined by the key, which is the public key of the asset holder. The tree is also combined with Sum Trees, so every node stores an integer (the number of tokens in our case) and the sum of integers in child nodes. This approach allows efficient verification of the conservation rule (no coins are created from air).</p><p>So, in a nutshell, the protocol works as follows:</p><ol><li>The issuer creates an empty tree and commits to its root using Taptweak (and making an on-chain TX). The Taproot key would look like <em>Q = P + H(P||c) · G</em>, where <em>P</em> is the issuer’s public key and <em>c </em>is SMT root.</li><li>When the issuer issues assets, it adds the recipient public key to the tree with a certain number of tokens, updating the root.</li><li>After committing to the new root (via on-chain TX), it can create a Merkle inclusion proof for the user.</li><li>When a user wants to spend these tokens, they contact the issuer and ask it to change the root by “transferring” the funds to another address. The issuer then again commits to the new root.</li></ol><p>The protocol looks good, but an immediate problem with scalability appears — imagine an Issuer that has 1 billion users inside the tree. It is not hard to change this root for it, cause it’s always a one-taproot transaction on-chain, but it’s hard to process all off-chain requests, such as proof requests, transfers, new issuance, etc.</p><p>It’s also not very user-friendly because every time a user wants to spend the funds, the user needs to contact the issuer (of course, it can be a back-end service, but it looks as if the user does not own his funds). Conversely, it is done by “removing” funds from the user. Issuers should remember that certain funds are not spent but just locked, and if the user passes the verification, the user can return them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qMV8JCKdrkdeCkJ5glZSKg.jpeg" /></figure><blockquote>Note. Some may wonder why we highlighted the absence of UTXO binding as a disadvantage. UTXO binding is interesting because it inherits the Bitcoin protocol double spending prevention and users’ behavior while working with UTXOs. Secondly, Lightning Network uses UTXOs as well, and a protocol bound to UTXOs is simpler to implement and follow the development cycle of LN and Bitcoin.</blockquote><h3><strong>LRC-20</strong></h3><p>The <a href="https://github.com/akitamiabtc/LRC-20">LRC-20</a> protocol’s idea is to hide assets as pairs (Y, UV) inside the taproot key (Y is the token identifier and UV is the amount), making it invisible for regular Bitcoin nodes and users. The protocol assumes the existence of additional indexer nodes that can recognize LRC-20 transactions and notify users about them (together with proof of these transactions’ correctness). If the user doesn’t want to trust some existing node, then can run their own ones.</p><p>LTC-20 protocol works the following way:</p><ol><li>The issuer announces the asset (provides asset info).</li><li>The issuer issues some tokens by tweaking the receiver’s key <em>K</em> and sends any amount of satoshis (dust amount) to the taproot address calculated from the key <em>P = K + PXH · G,</em> where <em>PXH</em> is a hash with tokens metadata (Y and UV).</li><li>The issuer sends this TX on-chain and provides proofs (Y, UV data, and user’s key <em>K</em> in open format) to YUV nodes so they can verify that the issuer indeed can issue these tokens and that everything is correct.</li><li>Users can then similarly spend these funds by asking for a counterparty’s public key and tweaking it with token metadata (the same way how issuer did that).</li></ol><p>Issuers can manage tokens via freeze. This is done through the OP_RETURN op-code, which freezes or unfreezes certain UTXOs with LRC-20 tokens. Also, the protocol supports private payments by changing the amount in the taproot key to the Pedersen commitment with Bulletproofs+ range proof. Users can privately exchange tokens while proving that the token conservation rule is met. Another advantage is that users directly control their funds because they are linked to UTXOs, which can be spent only by them.</p><p>A disadvantage of the protocol is that the longer certain coins are “alive,” the bigger the chain of proofs that should be transferred becomes. However, this is only a problem for the users since nodes store the whole history anyway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MIvYuVLmSx0fcVDcGSm99w.jpeg" /></figure><h3>Conclusion</h3><p>We can summarize all mentioned before in the following table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tKcYPmoVsps34Eeq0F3fyg.jpeg" /></figure><p>Bitcoin, renowned for its robust security, has become a reliable foundation for tokenization (including RWAs). However, Bitcoin’s security comes at a cost. Transaction fees on the main blockchain can be high, particularly during periods of network congestion. This can make tokenization, which often involves multiple transactions, a pricey endeavor for some projects.</p><p>A promising solution lies in Bitcoin’s Lightning Network. Designed for fast, low-cost transactions, Lightning could become the ideal layer for peer-to-peer (P2P) token transfers. By keeping most transfers off the main blockchain, Lightning not only reduces costs but also improves scalability, ensuring the Bitcoin network isn’t overloaded.</p><p>We believe that the trade-off for tokenization on top of Bitcoins involves a hybrid approach. Key operations like token issuance and official announcements could be secured on the Bitcoin blockchain, while the bulk of trading and transfers occur via the Lightning Network. This would provide the best of both worlds: the security of the main chain for critical actions, and the speed and affordability of Lightning for everyday use.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2b850040d424" width="1" height="1" alt=""><hr><p><a href="https://medium.com/distributed-lab/token-protocols-war-on-top-of-bitcoin-2b850040d424">Token protocols war on top of Bitcoin</a> was originally published in <a href="https://medium.com/distributed-lab">distributed-lab</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Account Abstraction Landscape]]></title>
            <link>https://medium.com/distributed-lab/account-abstraction-landscape-a8ccfe7a022a?source=rss-6ed4aa1fcd15------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8ccfe7a022a</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[account-abstraction]]></category>
            <dc:creator><![CDATA[Distributed Lab]]></dc:creator>
            <pubDate>Wed, 01 May 2024 10:27:57 GMT</pubDate>
            <atom:updated>2024-05-01T10:27:57.488Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article we are going to dive deeper into the ecosystem being built on top of the AA, analyzing products for developers that solve complex problems in that area.</p><p>Account Abstraction is a paradigm shift in blockchain that proposes a unified account model, blending the capabilities of externally owned accounts (EOAs) with the versatility of smart contracts. It opens a simplification window for those who are not deeply familiar with the blockchain (and they don’t need to now) and a flexibility door for the developers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fu7AnIM8Tct5kgYK7aT4-w.png" /></figure><h3>Why AA is a game-changer?</h3><ul><li><strong>Web2 UX</strong> is now available in Web3. 2FA, login &amp; account recovery via email, social media accounts, phone, biometrics, etc. There is no need to write 12 words on a piece of paper your mom can accidentally throw away while cleaning the desktop. Everything we are used to but with the security and decentralization of Web3.</li><li><strong>Gasless experience</strong>. Paymaster functionality enables dApps to cover the gas fees for its customers based on any rules that can be coded. There’s also no more pain for blockchain newbies getting the native currency for their first transaction. Gas can be fully covered or paid in ERC-20 tokens.</li><li><strong>Transaction batching </strong>offers the ability to perform several operations within one transaction (e.g., approve() and transferFrom()). This leads to reduced transaction costs and network efficiency improvement.</li><li><strong>Custom wallet logic</strong>. Subscriptions, spending limitations, multisignatures, and many other options can be a part of the smart account.</li><li><strong>Post-quantum signatures</strong> can now be used for the verification of transactions.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*8c2A1jA_hAYcZZg0Dld3TA.png" /></figure><p>This and many other advantages show us that AA adopts a transformational approach, combining the ease of use and familiarity of traditional web applications with the revolutionary aspects of blockchain technology. It addresses some of the key issues around blockchain usability and accessibility, and lays the foundation for wider adoption and innovative applications in the blockchain space.</p><h3><strong>ERC-4337</strong></h3><p>The heart of the AA concept is <a href="https://eips.ethereum.org/EIPS/eip-4337">ERC-4337</a>. This proposal completely avoids the need for consensus-layer protocol changes via Entry Point Contract specification and Alt Mempool. If you are not familiar with a mechanism that makes the magic behind ERC-4337 happen, the 4-part technical <a href="https://www.alchemy.com/blog/account-abstraction">article</a> from Alchemy or Vitalik Buterin’s Medium <a href="https://medium.com/infinitism/erc-4337-account-abstraction-without-ethereum-protocol-changes-d75c9d94dc4a">post</a> is recommended.</p><p>Let’s refresh on the main principle behind the AA specification. ERC-4337 doesn’t modify the consensus layer thanks to combining on-chain and off-chain operations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*OIkdxJas5QIq40lbUcj83A.png" /></figure><p>All the bricks we will talk about below are glued together with the help of <strong>UserOps</strong>. They are like usual transactions but with a slightly different <a href="https://eips.ethereum.org/EIPS/eip-4337#useroperation">structure</a>. Users package up the action they want their account to take in a struct named UserOperation which is further sent to the Alt Mempool before being added to the blockchain.</p><p>Off-chain part is represented by 2 main entities:</p><ul><li><strong>Bundlers</strong> play the role of aggregators and executors. They collect UserOps submitted by users into the Alt Mempool and bundle them into a single transaction. This aggregation is critical to efficiency, reduced gas costs, and optimized network throughput. After the bundling, they execute the transaction acting like a proxy EOA account.</li><li><strong>Alt Mempool</strong> is similar to Ethereum’s main Mempool. This is a separate holding area for UserOps waiting to be incorporated into the blockchain. Managed by a bundler, it acts as a buffer zone, smoothing the flow of operations to EntryPoint contracts.</li></ul><p>On-chain part consists of 5 main contracts:</p><ul><li><strong>EntryPoint</strong> contract plays the role of the coordinator. It serves as the universal receiver of all user operations (UserOps) and is responsible for their validation and execution. The contract standardizes the way operations are handled and ensures consistency and reliability across different implementations.</li><li><strong>Smart Account (Wallet)</strong> contract is a place where your wallet is programmed in any convenient way. This is a core business logic component.</li><li><strong>Account Factory</strong> contract is needed to deploy the specific wallet contracts. It’s important to mention that the smart account address is not random, it is determined using the CREATE2 opcode which can be extremely useful for multi-chain support.</li><li><strong>Paymaster</strong> contract is optional and can pay for the transaction, instead of the sender, thereby expanding accessibility and facilitating user onboarding. Thanks to that users don’t have to care where to get native currency in the first place.</li><li><strong>Aggregator</strong> contract is also optional and is used for signature aggregation. It significantly improves efficiency and saves a lot of gas by introducing the ability to validate many ops at the same time with just one signature instead of many.</li></ul><p>The workflow of the AA as an orchestra of all the components mentioned above is perfectly summarised in this diagram from Alchemy:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*Jslx3qAopAcVtCGnBseBIQ.png" /><figcaption>ERC-4337 transaction flow</figcaption></figure><h3><strong>Modularity in Smart Accounts</strong></h3><p>Though ERC-4337 is quite detailed and proposes a great standardized solution there’s always some space for improvement left. One of the most important components missed is flexible modularity. <a href="https://eips.ethereum.org/EIPS/eip-6900">ERC-6900</a> is the first proposal focused on the AA modularity, developed by Alchemy in April 2023.</p><p>As an alternative, there’s also <a href="https://eips.ethereum.org/EIPS/eip-7579">ERC-7579</a> which aims to standardize the same thing but in a less opinionated way, offering developers more room for experimentation (you can read about the reasons why ERC-7579 was created as a new standard instead of sticking to ERC-6900 <a href="https://docs.zerodev.app/blog/why-7579-over-6900">here</a>. It was proposed by Rhinestone, Biconomy, ZeroDev, and OKX in December 2023. Recently Etherspot has also been added to the “Supported by” list.</p><p>Both of them introduce a standard way to broaden the functionality of the smart account while maintaining things modular. It is possible due to the plugins/modules system that gets especially handy for verification and execution.</p><p>As an addition to ERC-7579, you can also find <a href="https://eips.ethereum.org/EIPS/eip-7484">ERC-7484</a> useful. It standardizes the interface and functionality of Module Registries, allowing modular smart accounts to verify the security of modules using a Registry Adapter. In other words, Module Registries are needed to keep audited and trusted ERC-7579 modules in one place.</p><h3><strong>Cornerstone of the AA implementation</strong></h3><p>The Infinitism team shared a <a href="https://github.com/eth-infinitism/account-abstraction/tree/develop/contracts">repository</a> with the standard implementation of the AA contracts relied upon by most solutions (from SDKs to brand wallets) in this area. It includes core contracts, all the needed interfaces, and some samples for reference.</p><h3><strong>Landscape</strong></h3><p>The market of Account Abstraction solutions is full of different projects that offer a lot of similar utilities and it’s easy to get lost among all of them looking for the product that suits your needs the best. Here is the landscape relevant for April 2024.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rYlNbX0P-rsZrgcCFWT2HQ.png" /></figure><p>Even though after some investigation the account abstraction concept may seem clear, things become more complicated once you dive deeper into the AA landscape and see how diverse it is. Every solution is a brick in a huge building that is still under construction. One product uses others, and different utilities are linked together more than it may seem at first glance.</p><p>All of the products are unique in some way but almost all of them include key features that bring a new web3 milestone closer:</p><ul><li>social logins &amp; account recovery</li><li>transaction batching</li><li>custom validation logic</li><li>multisigs</li><li>gas abstraction</li></ul><p>Taking into consideration the fact that the AA is still fairly new and the market is constantly evolving we will take a closer technical look at the most mature solutions that include most of the functionality needed for bringing the idea of account abstraction to life. Let’s see what the market can offer us.</p><h3><strong>1. Full-stack Solutions</strong></h3><p>The development process is extremely important to make the decentralized Internet a more user-friendly place. There’s a great bunch of SDKs &amp; APIs for wallet creation and interaction, Bundlers, Paymasters, and Auth Providers as services created to make the life of developers easy and let them fully concentrate on the new ideas of how to improve the AA ecosystem rather than reinventing the wheel.</p><p>Some of these solutions are the whales in the world of dev toolkits that capture the entire development cycle including ERC-4337 wallet operations and providing services like bundlers and paymasters. All in one place.</p><h4><strong>1.1 Biconomy</strong></h4><p>The Biconomy SDK is an Account Abstraction toolkit built with TypeScript on top of ERC-4337. It relies on a modular architecture according to the ERC-7579.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ShaYqziFoWM7Lv_DKscyqg.png" /><figcaption>Biconomy Account Abstraction SDC structure</figcaption></figure><p>From the above scheme, we can see that the Modular Smart Contract Wallet (ERC 4337-compliant signer agnostic <a href="https://github.com/bcnmy/scw-contracts/tree/develop/contracts/smart-account">contract</a>) can be enriched with the functionality from the programmable modules (those provided by the Biconomy or custom ones).</p><p>Modules are divided into 2 categories: Validation Modules and Execution Modules.</p><p>Biconomy provides such validation modules:</p><ul><li><strong>ECDSA Ownership Module</strong>: This is the default module that relies on an EOA to sign and verify messages. It can seamlessly integrate with MPC providers such as <a href="http://fdf/">Web3Auth</a>, abstracting EOA private key storage and enabling a web2-like experience such as email login. If the module is used the Smart Account’s address is generated based on the signer’s public key, which is the owner’s address used in the ECDSA Module. This module is <a href="https://eips.ethereum.org/EIPS/eip-1271">EIP-1271</a> Compliant.</li><li><strong>Multichain ECDSA Validator Module</strong>: This module significantly improves UX for deploying and setting up Smart Accounts on several chains. It is an extension of the ECDSA Module enabling to dispatch multiple UserOps on different chains using a single signature. It is possible since the user signs the Merkle Root (of a tree where every UserOpHash is a leaf) instead of signing individual hashes. This way, signed Merkle Root serves as on-chain evidence, proving any UserOp within the tree is authorized.</li><li><strong>Session key Manager Validation Module</strong>: This module enables the use of sessions to execute transactions. It verifies whether a given user operation adheres to the permissions defined within the session key and confirms that the operation has been signed by that session key. The smart contract is designed in a way that session key data has a specific <a href="https://docs.biconomy.io/tutorials/sessionkeys/sessionvalidationmodule#breaking-down-the-contract">layout</a> including permissions and additional data. Those permissions are further verified by the Session Key module. After the successful verification, the module validates that the provided signature matches the session key using ECDSA.</li><li><strong>Batched Session Validation Module</strong> allows batching of several session key signed operations which should be validated by different Session Key Manager Validation modules into one User Operation and execute them atomically. From the smart account point of view, every operation in the batch is expected to be an action managed by a specific Session Validation Module. SmartAccount.executeBatch() method is used to execute atomic operations: calldata from this method is parsed and routed to be validated to the specific SVMs based on the actions in the batch.</li><li><strong>MultiOwnedECDSAModule</strong>: This is an alteration of the ECDSA Module which allows multiple signers to be set up, and any one of the enabled owners can authorize a transaction using the ECDSA signature.</li><li><strong>Custom Validation Module</strong> can be developed by anyone and must extend the abstract contract <a href="https://github.com/bcnmy/scw-contracts/blob/main/contracts/smart-account/modules/BaseAuthorizationModule.sol">BaseAuthorizationModule</a>. It ensures your custom validation module operates securely and efficiently.</li></ul><p>Biconomy Smart Accounts are flexible in allowing you to use any signer from an <a href="https://eips.ethereum.org/EIPS/eip-1193">EIP-1193</a> provider, (or simply an ethers signer) to create a Smart Account. It supports such Auth providers as Dynamic, Particle Network, Privy, Magic, DFNS, Capsule, Turnkey, and Web3Auth.</p><p>In terms of infrastructure, Biconomy is also widely useful because of its Paymaster-as-a-service (Sponsorship Paymaster &amp; Token Paymaster are available) and Bundler-as-a-service. The Biconomy dashboard is your gateway to accessing those services. Additionally, this is where you can top up and configure your Paymasters for sponsoring transactions. This is how the majority of similar solutions work — via dashboard and API keys.</p><p>We can’t also pass by the fact that on top of all the blockchain experience, Biconomy offers the ability to integrate with fiat On-Ramp &amp; Off-Ramp service providers and aggregators. One of the easiest examples is Transak. Biconomy SDK’s Transak library is made for developers who just want on-ramp solutions and don’t want to go through with all the steps to integrate the SDK.</p><h4><strong>1.2 ZeroDev</strong></h4><p>ZeroDev is one of the most used solutions providing AA SDK and meta infrastructure.</p><p>It is built on top of their own smart account — <a href="https://github.com/zerodevapp/kernel">Kernel</a>. Like most other SDKs ZeroDev is modular but unlike Safe{Core} the moduleness is standardized in ERC-7579 (same as in Biconomy). This allows expanding the Kernel with the help of plugins. Here is the list of plugins introduced:</p><ul><li><strong>Passkeys</strong> are supported as signers in 2 ways. The first one is native passkeys using the <a href="https://eips.ethereum.org/EIPS/eip-7212">ERC-7212 precompile</a>. Though it is the best option due to its gas efficiency, a small number of chains currently support it. That is why if ERC-7212 is unavailable ZeroDev automatically falls back to smart contract passkeys using either the <a href="https://github.com/daimo-eth/p256-verifier">Daimo</a> or <a href="https://github.com/rdubois-crypto/FreshCryptoLib">FCL</a> implementation. This option is much more expensive but for sure works on all EVM networks. The trade-off here is that in order to use passkeys you need to use the passkey server. It can be ZeroDev’s one or for the sake of decentralization your own one. This server stores only public information, users’ keys are stored on their devices only.</li><li><strong>ECDSA </strong>validator validates signatures produced with an ECDSA private key, providing an experience similar to usual EOAs.</li><li><strong>Weighted ECDSA</strong>. While the ECDSA plugin allows users to create multiple accounts from the same EOA signer using an index, Weighted ECDSA is used to associate multiple signers with the Kernel account, each having a different weight. Enabling it can be useful in case you want your account to be multisig or setting up guardians for the account.</li><li><strong>Session keys</strong>. There are 2 patterns in the session key creation available: owner-created and agent-created. But what are those entities? The owner is someone who controls the master key of the account, this person is able to create session keys. The agent is whoever using the session key. So, in the first approach, the owner just creates the session key and shares it with the agent. In the case of agent-created session keys, the agent creates a public-private key pair and shares the public key with the owner. The owner authorizes the public key (by signing it), and shares the signed data with the agent. Finally, the agent creates the full session key by combining the signed data with the private key. This pattern is powerful because the agent never had to share the private part of the session key with anyone.</li><li>The <strong>Recovery plugin</strong> is just a special case of the <strong>guardian plugin</strong> (which is itself a special case of the Weighted ECDSA plugin).</li></ul><p>In terms of signers, ZeroDev is compatible with EOA signers and many different third-party “wallet services” like <a href="https://docs.dynamic.xyz/aa-providers/zerodev">Dynamic</a>, <a href="https://docs.privy.io/guide/frontend/account-abstraction/zerodev">Privy</a>, <a href="https://docs.portalhq.io/resources/account-abstraction-alpha">Portal</a>, <a href="https://docs.joyid.dev/guide/evm/evm-aa">JoyID</a>, etc.</p><p>Things become a little unusual when we come closer to the infrastructure provided by ZeroDev. It works with major AA infra providers to deliver a “meta infrastructure.” In other words, traffic is proxied to the bundlers and paymasters of the supported infra providers (Alchemy, Gelato, Pimlico, StackUp). The idea of meta infra makes bundler access more reliable by working with multiple bundler providers. If one fails, another takes over.</p><p>Or you can use your own infrastructure.</p><h4><strong>1.3 Alchemy Account Kit</strong></h4><p>Account Kit is a toolkit to build embedded accounts with AA. According to the Alchemy account <a href="https://github.com/alchemyplatform/aa-benchmarks">gas benchmarks</a> the Account Kit appears to be the most gas-efficient among similar solutions including Biconomy, Kernel, and Safe.</p><p>Let’s take a look at the tools available:</p><ul><li><strong>AA SDK</strong> is a TypeScript library built on top of <a href="https://viem.sh/">viem</a> and fully compatible with ethers.js. It is responsible for embedded account integration into your app and orchestrating all the processes.</li><li><strong>Signer API</strong>. Embedded Accounts are powered by the non-custodial Alchemy Signer API which uses Turnkey to securely store key material in a <a href="https://docs.turnkey.com/security/our-approach">Secure Enclave</a> so that only the user can access it. Alchemy signer is a nice option for a quick start because all you need is an Alchemy API key. Along with that Account Kit is compatible with any EIP-1193 provider.</li><li><strong>Smart Contract Accounts</strong> are the core of the toolkit. You can use your own ERC-4337 account, or utilize out-of-the-box Alchemy solutions. There are 2 types of accounts in the Account Kit: light one and modular one. A light account is simply an ERC-4337 <a href="https://github.com/eth-infinitism/account-abstraction/blob/develop/contracts/samples/SimpleAccount.sol">SimpleAccount</a> from Infinitism with some key improvements added (namespaced storage usage to avoid clashes when switching implementations, some event renaming, and use of custom errors). It is ERC-1271 compliant and in addition, supports ownership transfer and transaction batching. A modular account can be thought of as an extension of a light account that can be customized with ERC-6900 plugins. Modular Account uses the <a href="https://docs.openzeppelin.com/contracts/4.x/api/proxy#UUPSUpgradeable">UUPSUpgradeable</a> proxy pattern, and plugins are singleton contracts. This is how all this is structured:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g2ImWK3h1Yv50XcrAYDQgQ.png" /></figure><ul><li><strong>Gas Manager API</strong> is responsible for sponsoring gas for UserOps. Programmable gas policies can be created to specify exactly which transactions should be sponsored, set strict spending limits per wallet or globally, and allow/blocklist particular wallet addresses.</li><li><strong>Bundler API</strong>. Alchemy has developed an efficient <a href="https://github.com/alchemyplatform/rundler">Rundler</a> — bundler written in Rust. Rundler is implemented in a modular manner, allowing its components to be run as a single integrated binary, or as a distributed system.</li></ul><p>For now, modular Smart Accounts are introduced with 2 plugins:</p><ul><li><strong>Multi Owner Plugin </strong>supports one or more EOA accounts or ERC-1271 compliant contracts as owners of the account.</li><li><strong>Session Key Plugin</strong> supports the following types of permissions for each key: time range, access control lists, pending limits for ERC-20 token, native token, and gas. Also, key rotation is possible.</li></ul><p>As an additional useful feature Account Kit provides React Hooks to interact with your Smart Contract Accounts.</p><p>Aside from the Account Kit Alchemy has some enhanced APIs, and Alchemy Smart Account can be used with 2 of them: NFT API and Token API. They are useful for querying NFT and token info related to the account.</p><h4><strong>1.4 Particle Network</strong></h4><p>Particle Network is focused on creating the modular L1 chain abstraction, and wallet abstraction along with liquidity and gas abstractions is a part of this huge plan. There are several products implemented, but what interests us the most is their Modular Smart Wallet-as-a-service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_YLBIGvd0CxXYH25dTkqQw.png" /></figure><p>From the scheme, we can see how the Particle Network implements Account Abstraction:</p><ul><li><strong>Smart Account</strong>. Currently, there’s built-in support for Biconomy Account, Cyber Account, Alchemy Light Account, and Simple Account wallet implementations but using any other ERC-4337 smart account is also available. All of them support tx batching, session keys, and the use of verifying or ERC-20 paymaster.</li><li><strong>Key Management</strong> is represented by another Particle product — Particle Auth. It is a self-custodial auth infra for Web3 apps and wallets powered by SDKs for different platforms. Particle Auth enables users to log in through Google, Apple ID, Facebook, Twitter and other social methods, and can also log in with Email / Mobile number without a password. Under the hood, a crypto wallet without a private key is created for such logins. An associated wallet is secured with MPC (Multi-Party Computation)-based TSS (Threshold Signatures Scheme). Along with Web2 methods, different Ethereum and Solana wallets are supported.</li><li><strong>Embedded AA Wallet</strong> is an infrastructure plugged into apps or wallets (important not to think of it as of independent wallet). It also has integrated multiple On-Ramp vendors to allow users to purchase cryptocurrency directly with fiat currency, exchanges, DeFi protocols, wallets, and Web3 services.</li><li><strong>Infrastructure</strong> is represented by bundler and paymaster services. An innovative moment here is that Particle Network has implemented a Paymaster (Omnichain Paymaster) service that supports multiple chains. For now, you just need to recharge USDT either on Ethereum Mainnet or BNB Chain to use the Paymaster service on any chain, all the needed conversions are done automatically in the background.</li></ul><p>After analyzing the implementation of all key aspects that make ERC-4337 so attractive, it’s finally time to move on to the most exciting part the company has introduced — BTC Connect.</p><p><strong>BTC Connect</strong> is the first account abstraction protocol in the BTC ecosystem. It implements ERC-4337 on EVM-compatible Bitcoin Layer-2s to assign smart accounts directly to native Bitcoin wallets.</p><p>A Bitcoin wallet and a smart account on a Bitcoin EVM-compatible L2 can be linked together thanks to the usage of ECDSA (sepc256k1) for signature generation. To make things sound simpler, we can understand the basic flow in such a way: a user enters the system for the first time -&gt; user connects a BTC native wallet, such as UniSat, OKX, TokenPocket, or Bitget (through a modal that aggregates mainstream BTC wallets) -&gt; BTC Connect generates and assigns a smart account to a Bitcoin wallet (through the computation of an EVM EOA address based on the Bitcoin wallet’s public key) -&gt; user can now send UserOps signing them with signatures generated directly by the Bitcoin wallet. You can find more technical details on the BTC Connect <a href="https://blog.particle.network/chain-abstraction-on-bitcoin-btc-connect/">here</a>.</p><p>To summarize, Particle Network has plenty of products useful in the AA ecosystem and all of them (Embedded Wallet, Particle Auth, Account Abstraction, BTC Connect, etc) can be used together (like they already do as some use others) or as separate products for your dApp.</p><h4><strong>Conclusion</strong></h4><p>The most popular combination of tools in the full stack solutions is SDK + Infrastructure (bundlers and ERC20 &amp; verifying/sponsoring paymasters).</p><p>Some deliver their own smart account contract implementations as a core like Biconomy, ZeroDev, Thirdwev, etc, while still supporting other ERC-4337 accounts. The majority of the accounts are built to be modular for easy plugin integration. Those are, for example, Biconomy and ZeroDev adapted to ERC-7579 plugins, and Alchemy Account Kit with ERC-6900 modules.</p><p>In terms of auth, most of the products use other third-party auth vendors but there are those that propose such signing solutions themselves like Particle Network and Sequence.</p><p>You can use any of those solutions for general purposes, but there are specific cases when some products are better. For instance, if you are developing a web3 game Sequence and Blockus are the best option because they are game-oriented. In case you are planning to use AA on Bitcoin, Particle Network is currently your only choice.</p><h3><strong>2. SDKs and APIs</strong></h3><p>There’s a great bunch of wallet SDKs and APIs created to make the development easier. Most of the operations take only a few lines of code with the help of all these tools.</p><h4><strong>2.1 Safe{Core}</strong></h4><p>Safe{Core} is a modular account abstraction stack that provides AA tooling. It consists of 3 parts: SDK, API and Safe Smart Account.</p><p><strong>Safe{Core} SDK</strong> can be categorized into 5 distinct function kits:</p><ul><li>Protocol Kit is a way to interact with the Safe Smart Account contracts including Safe accounts creation and configuration, signing, batching and executing transactions etc. Basically, it’s just a TypeScript interface for the AA contracts.</li><li>Auth Kit enables creating EOAs and authenticates them based on an email address, a social media account, or a crypto wallet like Metamask. The authentication system behind the Auth Kit utilizes the Web3Auth MPC technology.</li><li>Relay Kit: simply an interface to use ERC-20 paymaster powered by <a href="https://docs.gelato.network/developer-services/relay">Gelato relay</a>.</li><li>Onramp Kit helps users buy cryptocurrencies with fiat money to fund a Safe account via a credit card or other payment methods. This is possible thanks to the integration with Stripe Pack for cryptocurrency purchases and Monerium Pack to make direct transfers of e-money tokens from their Safe accounts to an IBAN via the SEPA network.</li><li>API Kit is used for interaction with the Safe Transaction Service API.</li></ul><p><strong>Safe{Core} API</strong> is needed to provide all Safe account-related information to interfaces and is represented by 4 services: Transaction Service, Events Service, Config Service, Client Gateway.</p><p>In general, Safe’s production setup is a mixture of several instances of the Safe Transaction Service orchestrated by the Config Service, later consumed by the Client Gateway. A simple example of its basic usage is sending a transaction as a 2 of 3 multi-sig account: the transaction is formed and signed off-chain -&gt; signed transaction is submitted to the Safe Transaction Service which is being listened to by other signers -&gt; second signer gets the tx from the service, signs it and submits the signed tx back to the service -&gt; finally tx is executed.</p><p><strong>Safe Smart Account</strong> is the core used in all smart contract-based wallets. Basically, this is a modular account framework. By default, it uses a multi-sig approach and proxy pattern.</p><p>Safe Smart Account can be extended with Safe Modules. It can also be used together with Transaction Guards. We can think of them as hooks that can make checks before and after a Safe transaction. A simple example is AllowListGuard.</p><p>The last but not least thing utilized by Safe Smart Account is Fallback Handlers. They allow to add extra functions to the core contracts. It can be useful in case a new standard is introduced that is not natively supported in the account. Then the required functions can be implemented in the fallback handler that is further plugged into the account.</p><p>As you can see the main feature — Safe Modules — is not that easy to find as they are not gathered in one place. Moreover, other issues not fully solved by usual Safe modular smart accounts are interoperability and security. But Safe{Core} Protocol is about to fix this. At the moment of creating this AA landscape the Protocol <a href="https://github.com/5afe/safe-core-protocol">repositories</a> are marked as <strong>“not actively developed at the moment”</strong> and seem not to be ready for production use, but the standardized solution provided within this protocol is still worth mentioning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lp6OGNF5vpfv840vvGja_g.png" /><figcaption>Safe{Core} Protocol Architecture with examples</figcaption></figure><p>As you can see from the scheme Safe Manager is introduced, which aims to get rid of the direct connection between the account and 3 pluggable components mentioned before (Modules, Transaction Guards, and Fallback Handlers). This Manager would have access to the registry where all the verified modules are listed, and allow the communications between accounts and those modules. Modules here are divided into categories with names that speak for themselves.</p><p>In general, this approach is similar to what ERC-7579 (Minimal Modular Smart Accounts) and ERC-7484 (Registry Extension for ERC-7579) propose. But they are not supported by Safe{Core} Protocol and are implemented in a bit another way. Though the Fallback Manager inside the <a href="https://github.com/erc7579/erc7579-implementation">Reference Implementation</a> of ERC-7579 is stated to be inspired by the <a href="https://github.com/safe-global/safe-smart-account/blob/main/contracts/base/FallbackManager.sol">Safe</a> Fallback Manager.</p><h4>2.2 Rhinestone</h4><p>Rhinestone delivers a set of tools oriented toward building smart account modules on top of any compatible smart account vendor. Rhinestone is one of the ERC-7579 (a modularity proposal) authors, so logically, account implementations supported are those compatible with ERC-7579: Biconomy and ZeroDev. Currently, the Rhinestone team is also working on the Safe accounts support.</p><p><strong>ModuleKit</strong> is a development kit that allows you to build, test, and deploy the ERC-7579 modules. It consists of:</p><ul><li>Module templates and standardized interfaces. Module types are validators, executors, hooks, and fallbacks (similar to Safe{Core} types).</li><li>3rd party integrations: <a href="https://github.com/rhinestonewtf/modulekit/tree/main/packages/modulekit/src/integrations">library of integrations</a> and pre-built conditions, e.g., for Uniswap, Aave, Chainlink, Compound, dYdX, etc.</li><li>Testing frameworks with built-in unit and integration tests.</li><li>Helper utilities to test that your module adheres to the ERC-4337 restrictions or to calculate gas.</li><li>Security automation to detect possible vulnerabilities in the module code.</li></ul><p><strong>Module Sandbox</strong> is a frontend part of the Rhinestone kit, including a set of pre-built components. It is basically a playground to build and test frontend components for smart account modules.</p><p><strong>Module SDK</strong> is a TypeScript library created for easy interaction with modules with the help of dedicated helper utilities. Integrated modules are Ownable Validator (allows to add an ECDSA owner to an account), WebAuthn Validator, MFA Validator, Scheduled Transfers, and Scheduled Orders (for scheduling swaps).</p><p>Both Module Sandbox and Module SDK are currently under active development so have to be used with caution.</p><p>Another not-so-technical but still extremely useful thing for developers is a Notion page <a href="https://rhinestone.notion.site/Module-ideas-for-developer-inspo-338100a2c99540f490472b8aa839da11">“Module ideas for developer inspo”</a> by Rhinestone. If you are thinking about building upon ERC-7579 this can definitely come in handy.</p><h4>2.3 UniPass</h4><p>UniPass is a wallet solution offering its own smart account contracts implementation and SDKs to use inside your dApps.</p><p><strong>UniPass Contracts</strong> are unique because they introduce the Role Based Access Control (RBAC) to be used for the keys. Each account key has a specific role and weight. A key may be given to a single role or several roles. There are 3 available roles:</p><ul><li>Owner holds the primary authority for managing fundamental account operations, such as deployment, upgrades, and deletion.</li><li>Operator is the key used the most as it is the main executor. The operator is able to transfer assets, interact with smart contracts, authorize permits, etc.</li><li>Guardian is used for account recovery in case of losing keys.</li></ul><p>UniPass also supports multiple key types. Here is an example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hiE8JAjSINceRoJQI45Iww.png" /></figure><p>The most intriguing type here is email address because UniPass introduces an on-chain email verification technique. It is possible thanks to verifying the email’s <a href="https://datatracker.ietf.org/doc/html/rfc6376"><strong>DomainKeys Identified Mail</strong> </a>(DKIM) signature. This signature allows the receiver to check that an email was indeed sent and authorized by the owner of the specified domain, and not modified by a third party.</p><p>During the verification process, UniPass utilizes zero-knowledge proof technology to ensure the privacy and security of the user’s email information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KVR1rZA4an3eTRjZG_DRcg.png" /></figure><p>UniPass provides a default UniPass Relayer Node that you can use out of the box. It accepts gas payments in the form of native tokens and mainstream stable coins.</p><p><strong>Custom Auth SDK</strong> is a non-UI SDK based on the UniPass contract, and available for Web, Android, and iOS. The main features are:</p><ul><li>Basic smart wallet usage like transaction signing and verification, tx batching, gasless services, wallet ownership transfer, and social recovery.</li><li>Smart wallet management with various key management schemes: multi-signature logic, permission management that allows setting weights on keys and performing account operations with a threshold, RBAC-based permission management that allows setting weights and roles on keys.</li><li>EOA and EIP-1271 contract accounts integration for using them as master keys.</li><li>Social logins through integration with wallet services like Web3Auth and Magic.</li><li>Customized integration solution based on JWT Token (JSON Web Token) for master keys.</li></ul><p><strong>Plug &amp; Play SDK</strong> is a with-UI SDK based on the UniPass contract, where the with-UI refers to the <strong>UniPass Wallet</strong>. This SDK is also available for Web, Android, and iOS.</p><h4>Conclusion</h4><p>Typically, AA SDKs are created to easily integrate the wallet into your dApp including the interface for the account contracts and third-party infrastructure providers to use, which usually comes together with an API.</p><p>More mature solutions like Safe or Rhinestone are covering most of the needed functionality from tx batching to complex session key management logic. But sometimes you don’t need that many features. In this case, easier-to-use solutions that focus on certain features may seem beneficial: Patch Wallet API with social airdrops using Safe contract as a core, Banana Wallet with their OTP-based two-factor authentication (ZK-powered) and touchID-based signing, etc. If your intentions are within the gaming world, Openfort is a good choice as its SDK is targeted at the gaming industry.</p><p>In terms of modularity as discussed before Rhinestone is modular according to ERC-7579 and its SDK is generally focused on module management rather than the usual smart account interactions. There are also custom module implementations, e.g. in the Funkit and Soul Wallet (inspired by Safe modules).</p><p>Most of the SDKs are designed to be compatible with any other ERC-4337 wallet provider, but some of them are mainly oriented toward their own account implementations. These are, for instance, Halliday and UniPass. Their SDKs are created specifically for their implementations and this can be explained by the fact that the focus is shifted towards their branded wallet applications. However investigating how they approach AA issues still may be useful for developers, even if not using the wallet itself.</p><h3><strong>3. Infrastructure</strong></h3><p>This section consists of 2 main blocks: Bundlers &amp; Paymasters and Auth Providers.</p><p>The first one is already well-known to us as a key component of the ERC-4337.</p><p>Auth providers are optional but very crucial when things come to supporting not only the Web3 auth approach, but also one of the main AA advantages — social logins.</p><h4><strong>3.1 Bundlers &amp; Paymasters</strong></h4><p><strong>3.1.1 Stackup</strong></p><p>Stackup is focused on providing simplified smart account infrastructure.</p><p>Stackup’s paymasters allow users to sponsor transactions or accept ERC-20 tokens for gas payment. It charges a fee of 5% of the gas price to sponsor transactions.</p><p>When we come to bundlers things become more complex because the use of Alt Mempool leads to a number of rules and restrictions. The full set of validation rules for the canonical public ERC-4337 mempool is described in <a href="https://github.com/eth-infinitism/account-abstraction/blob/develop/erc/ERCS/erc-7562.md">ERC-7562</a>. First and foremost, it is needed to prevent denial-of-service attacks on the mempool.</p><p>Stackup bundler endpoints combine methods for both ERC-4337 bundlers and regular blockchain nodes. They can be public or private. Public RPCs are a great way to try the service without an API key, but they tend to be slow. For more robust production cases submitting a request for dedicated (private) bundlers is preferable. It is also important to mention that Stackup bundlers are MEV-protected.</p><p>Another useful product is userop.js — a JavaScript library for building User Operations. It is vendor-agnostic and can work with any ERC-4337 compliant infrastructure, whether self-hosted or from a third-party provider. It is also compatible with any Smart Account implementation from `SimpleAccount` to ZeroDev’s `Kernel` or custom ones. Userop.js can be especially useful for calling the <a href="https://docs.stackup.sh/docs/paymaster-api-rpc-methods">Paymaster RPC Methods</a>.</p><p><strong>3.1.2 Gelato</strong></p><p>Gelato is a unique case in terms of Account Abstraction infrastructure. It has 2 web3 services on top of which familiar AA bundler and paymaster are built:</p><ul><li><strong>Gelato Relay</strong> is responsible for executing the transaction on-chain instead of the sender. How it works: user forms a meta transaction -&gt; user signs this transaction (still off-chain) -&gt; user passes the signed tx to a network of decentralized Gelato Executors -&gt; executor verifies the signature with the help of <a href="https://eips.ethereum.org/EIPS/eip-712">ERC-712</a> and validates the transaction -&gt; executor executes the tx on-chain. Doesn’t it sound familiar? This is very similar to how ERC-4337 bundlers work. This is why the Gelato Bundler is built on top of the existing Gelato Relay service and sponsors transactions via 1Balance.</li><li><strong>1Balance</strong> is a unified multi-chain payments system the Gelato Paymaster is utilizing. It allows paying for all of your gasless transactions on all EVM chains with a single balance.1Balance system has a unique approach to sponsoring transactions because it does not rely on the on-chain EntryPoint to compensate transaction costs, getting rid of the need for an EntryPoint deposit or an on-chain paymaster. Transaction fees are settled post-execution which avoids overcharging users and reduces the overall on-chain footprint. This is possible by setting `maxFeePerGas=0`, thereby eliminating the need for upfront fee payments (`requiredPrefund=0`). In order to cover your relay costs regardless of the target chain you need to fund only 1 balance with: USDC on Polygon for mainnets and SEP on Sepolia for testnets. It’s important to mention that withdrawals are not yet supported, so need to be careful when funding and stay tuned for the update.</li></ul><p>So, by using the approach above the Gelato infrastructure is cheaper due to not incurring on-chain paymaster and fee transfer overhead, users are charged with 100% accuracy as fees are settled post-execution, and the tx inclusion is instant as there is no need to wait for other UserOps to form a bundle. In addition, MEV protection is used.</p><p><strong>3.1.3 Pimlico</strong></p><p>Pimlico is an account abstraction infrastructure platform. It delivers bundlers, paymasters, and a library for efficient use of the previous two (similar to the Stakup structure).</p><p><strong>Alto Bundler</strong> is a type-safe ERC-4337 bundler written in Typescript. A real gas saver here is that Alto Bundler supports sending compressed UserOps. To do so you need to: write and deploy your inflator contract implementing the `IOpInflator` interface -&gt; get the inflator contract address whitelisted by Pimlico -&gt; start submitting your compressed user operations using the `pimlico_sendCompressedUserOperation` JSON-RPC method. So, you send compressed UserOps and they will be decompressed on the inflator contract on-chain before submitting through the EntryPoint.</p><p><strong>Paymaster</strong>. As usual, verifying and ERC-20 paymasters are available.</p><p>The verifying paymaster is a combination of an on-chain paymaster contract and an API (needed to get back a signature for the contract). Such kinds of payments are charged off-chain. Pimlico calculates the maximum amount of balance your user operation could possibly spend (gas limits * max gas price) in USD terms and charges the percentage on top of that to your pre-loaded balance or attached card. After 15 minutes Pimlico checks on-chain how much your user operation actually spent and refunds the difference to your account.</p><p>Unlike the verifying paymaster, an ERC-20 one is fully permissionless meaning that there’s no need to interact with any hosted APIs. This has the trade-off however that token approvals to the paymaster cannot be done during the execution phase of the UserOperation, and must rather be done during the validation phase or in a previous UserOperation.</p><p>Another highly important trade-off here is that Pimlico’s paymaster is not decentralized. The owner of the ERC-20 Paymaster has limited admin control. They can withdraw accumulated ERC-20 tokens from the contract for the purpose of swapping them back into native tokens and depositing them back into the paymaster. Additionally, the owner can update the `priceMarkup` and `priceUpdateThreshold` configurations within predefined limits to manage operational costs and risks.</p><p>`priceMarkup` (default value is 10%) is a form of fee the owner takes for maintaining the infrastructure and covering some risks. The good news is though the owner can change this value there is a hardcoded maximum set during the constructor that is enforced by the smart contract.</p><p>Last but not least about the ERC-20 paymaster — Chainlink is leveraged as price oracles, a combination of the ERC-20 Token to USD and Native Token to USD prices is used to calculate the ERC-20 Token to Native Token price. The nice thing about it is the ability to easily deploy Paymaster on any chain for any token that has Chainlink support, but the potential problem lies in the complete trust in Chainlink because if it is compromised paymaster is not completely valid anymore.</p><p><strong>Permissionless.js</strong> is a TypeScript library built on viem for interacting with ERC-4337 bundlers, paymasters, and user operations. It is easy to use, has a small bundle size, and provides high-level support for the major ERC-4337 smart accounts, including Safe, Kernel, Biconomy, and SimpleAccount.</p><p><strong>Conclusion</strong></p><p>Bundlers and Paymasters in the infrastructure delivering focused services are implemented in a similar way according to ERC-4337 specification and ERC-7562 rules. Almost all of the products along with the Bundler &amp; Paymaster services introduced a library for easy UserOps manipulations within the infrastructure. They are actively used by the SDKs, e.g. Rhinestone Module Box is built on top of Permissionless.js introduced by Pimlico.</p><p>While bundlers are unique for each product but still comparatively similar, paymasters’ logic varies from solution to solution except for the fact that all of them provide 2 main paymaster types: verifying/sponsoring and ERC-20 ones. For example, Gelato Paymaster is based on the Gelato 1Balance service that does not rely on the on-chain EntryPoint for gas costs compensation and sets the fees post-execution allowing to charge users with 100% accuracy. On the other hand, Pimlico is utilizing a combined off-chain (with API) and on-chain approach for verifying paymasters, while making its ERC-20 paymasters fully permissionless (but unfortunately not decentralized).</p><p>Stackup infrastructure and Infinitism Universal Paymaster are closer to the basic and standardized approach familiar to the user after the ERC-4337 investigation.</p><h4><strong>3.2 Auth providers</strong></h4><p>In terms of AA, signers are separated from the account while in usual EOAs private key and public key are conjoined. Regardless of the type of authentication, we anyway get back to the private key required to sign transactions, whether they are regular EOA transactions or those packaged in UserOps. Securing a private key is a complex art and it is particularly interesting to see how different auth providers have approached the issue.</p><p><strong>3.2.1 Web3Auth</strong></p><p>Web3Auth is not just a signer provider but a perfect example of utilizing MPC technology in AA wallets.</p><p>The Web3Auth SDK lives solely on the user/application’s front-end client and handles the interactions between OAuth providers and the Auth Network. From the diagram below you can see how different Web3Auth products are related to other applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*243l-Th7eZJ585VdokUpXw.png" /><figcaption>Web3Auth high-level architecture</figcaption></figure><p><strong>Plug and Play SDK</strong> is like a wrapper for all other internal processes. It includes UI components like modal and facilitates the embedding of the login function. From the modal user is redirected to the login/OAuth provider, and after carrying out the authentication process there, is redirected back. After the successful authentication, Web3Auth handles the reconstruction of the user’s key.</p><p><strong>Core Kit SDK</strong> is the backbone of the magic happening behind simple login. It can be divided into 2 types:</p><ul><li>Single Factor Auth. It is semi-custodial in nature, since the key is custodial to the Auth Provider and the Web3Auth Network, but neither Web3Auth, Social Login Providers, nor any other party holding a key share can claim full ownership. This can be achieved because to create a social login share, users interact with the Web3Auth Auth Network, where key generation operates via a 5/9 consensus system.</li><li>Multi-Factor Auth. Here things become more interesting because this is where MPC comes to the game. With the Web3Auth infrastructure, your key is divided into multiple parts and stored across your devices and the Auth Network. In the traditional Web3Auth SDK, your key was dynamically reconstructed in the front end using threshold signatures. In the MF Auth case, it is never reconstructed, your key remains divided. Each part of your key on its own can sign a piece of a message or transaction. These partial signatures are collected and combined using a method called Threshold Signature Scheme (TSS) to create a complete signature. This final signature can then be used to execute transactions on the blockchain.</li></ul><p><strong>Auth Network </strong>is an open-source wallet management network that safely splits and secures user wallets. Current operators are Binance, Ethereum Name Service, Etherscan, Polygon (MATIC), Zilliqa, Tendermint, Ontology, SKALE, and Web3Auth (Torus).</p><p>To make things simpler we can think of the Web3Auth key management infrastructure in the following way:</p><ul><li>user’s private key is split into multiple shares using SSS(Shamir Secret Sharing): socials (Google, Twitter, etc), device, and backup/security question.</li><li>OAuth (social login) share is split into 9 shares, and they are held by 9 different nodes inside the Auth Network.</li><li>when the user is trying to log in 5 out of those 9 shares are fetched and combined with any other share. This way the key is reconstructed (2/3).</li></ul><p>As you can see the key is never stored by 1 party this way.</p><p>The flow described above is SSS-based shallow MPC which is used by Single Factor Auth. For Multi-Factor Auth TSS (Threshold Signature Scheme) based full MPC system is used. In this case, we can replace the part where key reconstructions happen with partial signature generations. The flow remains the same, but the key is never reconstructed. Here is the scheme to visualize the logic:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8NPx5Y2qgZZt1jVA8d3gTQ.png" /><figcaption>SSS MPC vs TSS MPC</figcaption></figure><p>In the example 2 of 3 scheme is used but you can use 2 of n adding more shares.</p><p><strong>3.2.2 Turnkey</strong></p><p>Turnkey is a crypto private key infrastructure that lets developers securely generate private keys and sign transactions via simple APIs.</p><p>Infrastructure is built upon the concepts of <strong>organizations</strong> as a logical grouping of resources. Each organization has its <strong>root quorum</strong>, you can think of it as of group of users who can execute any action and bypass the policy engine if the threshold “n of length of users in quorum” is reached. The <strong>policy engine</strong> contains rules defining which users can take which actions within an organization.</p><p>Moving closer to private keys we need to understand the concept of wallets and accounts is Turnkey. <strong>Wallet</strong> (<a href="https://learnmeabitcoin.com/technical/hd-wallets">hierarchical deterministic (HD) Wallet</a> is this case) is basically a collection of crypto private keys that share a common seed. Seeds are generated with a default mnemonic length of 12 words according to <a href="https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki">BIP-39</a>, but you can use 15, 18, 21, or 24 words to enhance security. <strong>Account</strong> is used to sign with the private key, which is extended from the wallet.</p><p>Another crucial concept is <strong>Credentials</strong>. They represent ways for Users to authenticate to Turnkey. All Turnkey Credentials are held by you, the end user. Turnkey only keeps public keys.</p><p>Two types of credentials are supported:</p><ul><li>Authenticators. Webauthn device registered on Turnkey is what it is.</li><li>API Keys are a P-256 key pair generated by a user (either through the CLI or through the dashboard). A private key is held by the user, public key is within the Turnkey’s control. Requests made via SDK or CLI use the private API key to sign requests. Turnkey’s public API expects all requests (e.g. to get data or to submit activities) to be signed.</li></ul><p>Turnkey provides an opportunity to recover your access to the account via email in case access to the API keys and authenticators is lost. <strong>Email recovery</strong> is happening only through the previously attached to the account email. Unlike typical email recovery, no tokens in a ready-to-use format are sent. Instead, recovery credentials are encrypted before transferring. It is needed to protect against man-in-the-middle attacks.</p><p>Let’s see how the recovery happens:</p><ul><li>a user creates a target encryption key (TEK). This target encryption key is a standard P-256 key pair</li><li>the public part of this key pair is passed as a parameter inside of a signed `INIT_USER_EMAIL_RECOVERY` activity</li><li>Turnkey creates a “recovery credential” (a fresh P-256 key pair), and encryptes the private key with the TEK user sent when initiating the recovery.</li><li>the user receives the encrypted private key via email and after decrypting it with the private key part of the TEK is able to use it to sign a `RECOVER_USER` activity, submitted to Turnkey.</li></ul><p><strong>Email Auth</strong> is another feature that can be used to authenticate the Turnkey account with email via either a one-time code or a magic link. In this process, the user is granted an expiring API key that is stored in memory within an iframe. This expiring API key can then be used by the user to access their wallet, similar to a session key.</p><p>Encrypted “auth credential” (a fresh P-256 key pair) is delivered, to the user via email according to the same procedure that is used during email recovery.</p><p>Additionally, Turnkey SDK has integrated <strong>passkey</strong> functionality.</p><p><strong>3.2.3 Privy</strong></p><p>Privy is a library that provides authentication flows and embedded wallets to your app. The most mature product is Privy React SDK which with the help of simple broadly customizable React components and hooks makes it easy for users to onboard. It supports multiple methods for authenticating:</p><ul><li><strong>email or phone number</strong> via a one-time password (OTP)</li><li><strong>social accounts</strong> (Google, Apple, Twitter, Discord, Github, TikTok, LinkedIn, Spotify) via the OAuth2.0 Protocol</li><li>verifying the user’s ownership of a wallet via the Sign In With Ethereum (<strong>SIWE</strong>) standard.</li></ul><p>An important thing here is that one user can associate multiple login methods to his account.</p><p>The key feature is Embedded wallets. Privy allows users to connect an external Ethereum wallet to your app, or to create a secure, self-custodial embedded wallet associated with the login method. Both of them are able to do basic wallet tasks but embedded wallets do not require a separate wallet client, like a browser extension or a mobile app, and can be accessed directly from your product (that is why they are embedded). Another difference is some extra customization in terms of how signature and transaction prompts are presented to users.</p><p>The embedded wallet consists of 3 parts:</p><ul><li><strong>SDK</strong> — a high-level interface for the apps to integrate.</li><li><strong>API</strong> for storing wallet metadata for a given user, such as their wallet address.</li><li><strong>Isolated iframe</strong> — entity for private key management and wallet operations handling.</li></ul><p>Along with that simplicity goes a responsible approach to security. It’s important to know that Neither Privy nor integrated applications ever access embedded wallet private keys.</p><p>According to the official documentation when a user creates an embedded wallet, the isolated iframe securely generates a keypair for the user by choosing 128 bits of entropy, and converting the bits to a mnemonic via BIP-39. From this mnemonic, the iframe then derives the wallet’s public key (and by extension, the wallet address) and private key.</p><p>The iframe then splits the private key into three shares using Shamir’s secret sharing:</p><p>1. <strong>Device share</strong>, which is stored in the iframe’s local storage.</p><p>2. <strong>Auth share</strong>, which is encrypted and stored by Privy.</p><p>3. <strong>Recovery share</strong>, which is encrypted either by user-provided entropy (a strong password) or by Privy. Recovery shares are only ever encrypted or decrypted on the user’s device.</p><p>The full private key is only ever assembled in memory and is never persisted anywhere. The threshold to constitute the full private key is at least two of three shares.</p><p><strong>Conclusion</strong></p><p>The market of signer vendors is very diverse compared to the previous blocks. Most of the solutions are good at providing basic signing methods like email, social accounts, passkeys, SIWE, 2FA, biometrics, etc. However, the difference is how they approach the key management problem. We can roughly categorize their approaches to wallets into the following types:</p><ul><li>Non-custodial wallets: Turnkey, Magic.</li><li>MPC wallets (non-custodial): Privy, Fireblocks MPC, Portal, Capsule, Walletkit.</li><li>Decentralized MPC Network (non-custodial): Lit Protocol, Web3Auth (Torus Network), 0xpass.</li></ul><h3><strong>Future of the AA technology</strong></h3><p>The ERC-4337 is not the endgame, it’s more like a staging area, a migrating path to the <a href="https://github.com/ethereum/RIPs/blob/master/RIPS/rip-7560.md">RIP-7560</a>— Native Account Abstraction. It would be an extremely risky decision to modify the protocol in such a significant way right away. That is why ERC-4337, which requires no protocol changes, is a great candidate to test how the community will accept it and see the growth potential of such an ecosystem. And the fact that we were not able to include the analysis of the products built upon ERC-4337 in this article speaks for itself.</p><p>Ethereum is already moving towards implementing native changes. A new hot topic recently included in the upcoming Pectra upgrade is <a href="https://eips.ethereum.org/EIPS/eip-3074">EIP-3074</a>. It allows externally owned accounts to delegate control to a contract by introducing 2 new opcodes: AUTH and AUTHCALL. It is expected to dramatically improve the UX and be a part of the gradual onboarding to AA, but still not a full solution. ERC-4337 and therefore RIP-7560 are able to cover more functionality and use cases. For instance, EIP-3074 does not provide the key rotation feature, missing the key point of typical user behavior: we all make mistakes and can lose things, especially secret keys. So, this proposal is a highly important step, one of many, on a long path to abstracting our accounts.</p><p>If you want to get to know more about EIP-3074 compared to other AA proposals, this Ambire Wallet <a href="https://blog.ambire.com/eip-3074-explained/?ref=blog.thirdweb.com">article</a> is recommended.</p><h3><strong>Conclusion</strong></h3><p>Now, having an understanding of what tools are currently powering the account abstraction ecosystem we can see how far the idea of expanding the usual EOA has come.</p><p>We’ve looked through the main blocks that can be used to build a smart account: core smart contracts, smart account modules, SDKs &amp; APIs, Bundlers &amp; Paymasters, and Auth Providers. There are also full-stack solutions including some or even all of them in one place, but most of the tools are built to be compatible with others. Like a Lego constructor, you can build your own Smart Account with different blocks depending on your needs and requirements. Moreover, you can find the implementations for almost any platform: Web, mobile, game engines, etc.</p><p>The AA ecosystem is quite a broad topic and there are much more products than it is described in this article. Unfortunately, we cannot cover all of them here because that would be too much. But it’s good to keep in mind that there’s already a plenty of tools to help with your needs. And if there’s some functionality missing it’s a high time to create something amazing and be a part of the community that is helping to onboard millions of users to web3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*1Zf1iTUPeoQhct7KEkW5oQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8ccfe7a022a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/distributed-lab/account-abstraction-landscape-a8ccfe7a022a">Account Abstraction Landscape</a> was originally published in <a href="https://medium.com/distributed-lab">distributed-lab</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Is the UMA protocol the Future of Global Money Transfers?]]></title>
            <link>https://medium.com/distributed-lab/is-the-uma-protocol-the-future-of-global-money-transfers-a34375832852?source=rss-6ed4aa1fcd15------2</link>
            <guid isPermaLink="false">https://medium.com/p/a34375832852</guid>
            <category><![CDATA[bitcoin]]></category>
            <dc:creator><![CDATA[Distributed Lab]]></dc:creator>
            <pubDate>Fri, 24 Nov 2023 14:51:28 GMT</pubDate>
            <atom:updated>2023-11-27T09:58:43.384Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s world, financial transactions are becoming increasingly complex. We use many different accounts at different banks, each with its number. This can be very confusing, especially if we want to send money to someone who is not our customer. The Universal Money Address (UMA) is a new standard designed to make financial transactions easier and faster. UMA is a single address that can be used to send and receive money from any bank account anywhere in the world.</p><h3><strong>History</strong></h3><p>On October 23, 2023, Lightspark introduced its Universal Money Addresses (UMA) solution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*sHetbkz4omhMseGwJ9XV1g.png" /></figure><p>Following this announcement, XapoBank introduced universal money addresses on the same date, Bitnob also presented its implementation of UMA. Currently, UMA is operational in 47 countries.</p><h3><strong>Context</strong></h3><p>Before diving into the details of the UMA protocol, let’s start with some basic definitions and roles.</p><p>A <strong>VASP</strong> (Virtual Asset Service Provider) typically encompasses businesses engaged in various activities on behalf of customers, including exchanging virtual assets with fiat currencies, facilitating exchanges between different virtual assets, transferring virtual assets, and providing safekeeping or administration of virtual assets or instruments that enable control over them. Additionally, VASPs may participate in and offer financial services related to virtual asset issuance, sale, or management.</p><p><strong>VASP1</strong> — Under this abbreviation, we will mention the VASP that initiates a Lightning payment using UMA for its customers.</p><p><strong>VASP2</strong> — This VASP in our description receives a Lightning payment powered by UMA for its customers.</p><p><strong>Travel Rule Authority</strong> (TR Authority) serves as an elective entity within the UMA protocol, offering the capability to authenticate the public keys of UMA participants. For example, when VASP2 obtains a signature and the corresponding signing public key from a VASP1, it can query the TR Authority to verify whether the provided public key genuinely corresponds to the VASP domain identified as the sender. So we can imagine the TR authority as a Certificate Authority in PKI.</p><p><strong>Compliance Provider</strong> — a third-party or internal compliance service that provides blockchain analysis and related services for risk and regulatory compliance. UMA facilitates risk assessment and transaction monitoring reviews both pre- and post-transaction.</p><h3><strong>How UMA appeared (a possible scenario)</strong></h3><p>During her exciting holiday on a mysterious island, Alice discovers a stunning charity event that Bob, her longtime friend, organized. She wants to support this important initiative, but all her funds are held in cryptocurrency, while the promotion only accepts donations in local currency. Now Alice needs to send money to Bob so that he can contribute to her charity and support their common goal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jKbSq2VRZDLcoKHxx-60Xg.png" /></figure><p>Let’s define how it might look before UMA…</p><p>Firstly, Alice opened her laptop and started looking for an exchange service on the island (because her exchange/custody service doesn’t support Bob’s local currency).</p><p>She found a few options and compared their terms. Then she chose a service that offered a favorable exchange rate and low commissions. Alice registered on the exchange service’s website and entered her personal information.</p><p>Then she transferred her cryptocurrency funds to the service’s account. The exchange process, let’s say, took about an hour, and the commission was 1%. After the exchange, Alice received the funds in her account at a local bank. She decided to transfer them to Bob’s account through an online platform. The deposit process took about two hours, and the fee was 2%. Looks like that’s it, but…</p><p>The next day, Alice received a message from the bank. The deposit had been rejected due to a compliance issue (shit happens). Alice was confused and frustrated. She called the bank to find out what had happened. The bank explained that Alice had not provided enough information about her source of income. So she would need to provide additional information, such as her tax returns, before the deposit could be processed. Alice was disappointed. She didn’t have time to gather all the necessary information. The charity event was only a few days away.</p><p>Alice decided to try to exchange her cryptocurrency for local currency through another exchange service. She found a service that offered a slightly lower exchange rate but did not require as much compliance information. The exchange process went smoothly, but the withdrawal process was slow. It took several days for the funds to arrive in Alice’s account at a local bank.</p><p>Finally, Alice was able to transfer the funds to Bob’s account. But could it be much easier and faster?</p><p>With UMA, Alice could avoid many problems she would have encountered using traditional methods. She would not have to waste time searching for an exchange service on the island. She would not have to exchange cryptocurrency for local currency, which can be costly and time-consuming. And she wouldn’t have to provide additional information, such as her source of income (as long as she has a verified account on an exchange, supporting UMA), which could be inconvenient or even dangerous. Let’s see how.</p><h3><strong>The general flow</strong></h3><p>There are 4 main steps of the UMA <a href="https://app.lightspark.com/static/overview_swimlanes-5de8a741.png">payment flow</a>:</p><ol><li><strong>Recipient Information Request:</strong> The sender’s bank or financial institution (VASP1) asks the recipient’s bank (VASP2) for basic information about the recipient, such as their preferred currency and exchange rate.</li><li><strong>Payment Request Creation:</strong> VASP1 sends a request to VASP2 specifying the amount to be sent and any additional compliance information required. VASP2 then generates a payment invoice.</li><li><strong>Payment Execution:</strong> The sender uses their UMA address to pay the invoice using the Lightning Network, a fast and low-fee payment protocol.</li><li><strong>Post-Transaction Compliance:</strong> After completing the transaction, information about the payment is shared with compliance providers for any necessary post-transaction checks.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*aVVBWkraH7_sIHLun-7DOw.png" /></figure><h3><strong>How UMA protocol works</strong></h3><p>Now we will assemble everything into one diagram and then break it into logical steps with their detailed description.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lhf9o01yfMcCR0aHuFWr3w.png" /></figure><p>At first, Alice needs to register with a VASP that supports UMA to acquire her unique name and address. To accomplish this, she must share her personal information and undergo the<a href="https://amluae.com/fatf-travel-rule-and-know-your-corresponding-vasps/"> ‘Know Your Customer ‘</a> procedure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/449/0*2fsR4h4Q6E21b3zu" /></figure><p>After registering with VASP, Alice receives a unique name and, accordingly, an address. UMA addresses have the format $&lt;username&gt;@&lt;domain&gt;. Addresses have their requirements; you can find them <a href="https://app.lightspark.com/docs/uma-sdk/uma-addresses">here</a>. Bob needs to do the same with his VASP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/0*JluNmrAJmtFU5IYI" /></figure><p>Now Alice can inform the VASP that she intends to transfer a specific amount to Bob at his address. In this case, Alice consents to transferring personal data, including the payment amount, sender, and recipient.</p><p>Next, Alice’s VASP interacts with Bob’s VASP. Each VASP has a unique pair of keys, confirming its authenticity. TR Authority issues certificates of conformity to certify that VASPs are operating correctly. The UMA protocol presume the usage of two secp256k1 key pairs: to sign messages between VASPs and to encrypt sensitive data such as payment information and travel policies (through generation the common secret with DH).</p><p>After the initiation of the UMA protocol, the VASP1 sends the first request towards the VASP2.</p><p>For instance, in a scenario where $alice@vasp1.com is making a payment to $bob@vasp2.com, the request takes the following form:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/533/1*F50AFluRs36IeSnAKKaivQ.png" /></figure><p>Here, <strong>umaVersion</strong> denotes the supported UMA protocol version by VASP1, and its details can be explored in the versioning section below. The parameter <strong>isSubjectToTravelRule</strong> indicates that VASP1 functions as a financial institution obligated to comply with the Travel Rule Authority. <strong>Nonce</strong> represents a randomly generated unique string created by the SDK, serving the purpose of preventing replay attacks. <strong>Timestamp</strong> corresponds to the Unix timestamp in seconds. The <strong>Signature</strong> is VASP1’s signature over the hash of “$bob@vasp2.com” + nonce + timestamp. It’s essential to note that UMA signatures are consistently presented as hex-encoded strings<strong>.</strong></p><p>Now, we need to synchronize the versions. The UMA protocol includes a version negotiation method within the original LnurlpRequest. UMA versions are represented as &lt;major&gt;.&lt;minor&gt; (e.g., 1.2), where major changes are critical, and minor changes may include minor additional features. VASPs must support compatible versions for successful interaction. You can view the interaction diagram <a href="https://app.lightspark.com/static/uma_version_negotiation-e13a9481.png">here</a>.</p><p>If the verification is successful and the versions match, we can check the Virtual Asset Service Providers for compliance with Financial Action Task Force (FATF) requirements. The UMA SDK provides an efficient mechanism for obtaining and caching public keys from other VASPs within the UMA protocol context. This tool manages the key cache, offering transparent access to extraction, addition, removal, and clearing of public key records. During the execution, the VASP2 effectively checks the sender’s key cache. Without a valid record, the SDK dynamically requests keys from the sender. The received keys may undergo additional confirmation to ensure their belongingness to the respective VASP.</p><p>Upon successful verification, we proceed to initiate a payment request. This request facilitates the exchange of compliance data and instructs the VASP2 to create an invoice for a specific amount on behalf of the receiving user.</p><p>The next UMA protocol request is the payreq request. This request exchanges compliance data and instructs the VASP2 to create an invoice for a specific amount on behalf of the receiving user. The VASP2 must generate an invoice for the VASP1 with the correct amount and return a valid.</p><p>Now, just send the payment by settling the invoice! However, this payment needs to be made in the sender’s preferred currency → Bitcoin → recipient’s preferred currency. On the VASP side, when the user confirms the payment, you first need to convert their preferred payment currency into bitcoins to transmit them over the Lightning network. As a VASP2, you must listen for a completed incoming transaction.</p><p>The UMA protocol also involves a Compliance Provider — a vital entity offering blockchain analysis and associated services for risk and regulatory compliance. UMA goes the extra mile by facilitating risk assessment and transaction monitoring, ensuring a comprehensive review before and after transactions occur. This strategic integration adds layer of security and regulatory adherence to the UMA financial landscape.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WAlN6oIHpjIGR3Sv" /></figure><p>And with that, we’ve completed the protocol! Bob has successfully received his funds, and our financial fairy tale ends happily. Like a magic wand, the UMA protocol ensures seamless and efficient money transfers, bringing joy to our digital kingdom.</p><p>For a detailed protocol overview, visit the Lightspark <a href="https://app.lightspark.com/docs/uma-sdk/introduction">website</a>.</p><h3><strong>Who uses the UMA protocol</strong></h3><p>While UMA has encountered its share of critics, it is gaining significant traction with active utilization by prominent platforms such as Bitnob, Coins.ph, Foxbit, Ripio, and Xapo Bank. These entities actively embrace UMA, underscoring its increasing adoption and relevance within the financial landscape.</p><h3><strong>Critiques of UMA</strong></h3><p>UMA faces notable criticism primarily for not presenting a groundbreaking concept, with parallels drawn to the pre-existing ‘Paymail’ feature on the BitcoinSV chain.</p><p>Additionally, detractors highlight its lack of permissionlessness and censorship resistance. Numerous users, especially within the X community, express aversion to the mandatory KYC procedure, considering it contradictory to the foundational principles of Bitcoin. UMA’s compliance measures also come under scrutiny, raising concerns about potential centralization associated with stringent regulatory adherence. A significant portion of Bitcoin users lean towards privacy over embracing KYC requirements.</p><h3><strong>Comparison</strong></h3><p>While UMA has no direct equivalent in the cryptocurrency world, there are several similar systems in the traditional financial system, such as SWIFT, SEPA, and ACH. SWIFT is the most widely used system for international financial messaging, providing a secure network for banks to send and receive financial information. SEPA aims to simplify cross-border Euro transfers, making them as convenient as domestic transfers. ACH networks in countries like the United States facilitate large volumes of credit and debit transactions in batches, often used for payroll, direct deposit, tax refunds, and other payments. These traditional systems offer similar functionality to UMA, but they are slower and charge more fees, while UMA offers faster transfers, 24/7, from anywhere in the world and through any VASP that supports UMA.</p><h3><strong>Tendencies</strong></h3><p>The UMA protocol provides an innovative solution for global financial transactions, offering unique capabilities for the transfer of both cryptocurrencies and fiat funds. Despite some criticism, UMA is seeing significant attention from crucial players such as Bitnob, Coins.ph, Foxbit, Ripio, and Xapo Bank, highlighting its importance and strong adoption in the industry. With continuous development and improvement of the protocol, UMA continues to gain attention and set new standards in the world of financial technology.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a34375832852" width="1" height="1" alt=""><hr><p><a href="https://medium.com/distributed-lab/is-the-uma-protocol-the-future-of-global-money-transfers-a34375832852">Is the UMA protocol the Future of Global Money Transfers?</a> was originally published in <a href="https://medium.com/distributed-lab">distributed-lab</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to broadcast a Bitcoin payment transaction via single SMS]]></title>
            <link>https://medium.com/distributed-lab/how-to-broadcast-a-bitcoin-payment-transaction-via-single-sms-91f24bace0c4?source=rss-6ed4aa1fcd15------2</link>
            <guid isPermaLink="false">https://medium.com/p/91f24bace0c4</guid>
            <category><![CDATA[bitcoin]]></category>
            <dc:creator><![CDATA[Distributed Lab]]></dc:creator>
            <pubDate>Fri, 18 Aug 2023 16:01:15 GMT</pubDate>
            <atom:updated>2023-08-18T16:01:15.191Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Abstract.</strong> We propose a method for sending Bitcoin payments when the sender has no Internet connection. However, the sender has a Bitcoin address to which coins need to be sent, and somewhere on the planet, there is an intermediary who can receive SMS, rebuild the full transaction, and propagate it across the network. The essence of the method lies in creating a transaction, signing, discarding unnecessary data, and sending it via SMS to the intermediary who knows how to reconstruct the discarded data to make the transaction valid and confirmed in Bitcoin.</p><h3>1. Previous research</h3><p>While exploring solution options, various approaches were considered, including using SIGHASH_SINGLE, SIGHASH_NONE, or SIGHASH_ANYONECANPAY. Additionally, the option of sending a private key via SMS was explored. However, these methods require more trust in the SMS transmission service and the intermediary. Hence, we will focus on the method with the omission of certain transaction data, which can be reconstructed by the intermediary as long as both the sender and intermediary adhere to the same transaction formation rules.</p><p>For more efficient compression, we will start from the very beginning by selecting the smallest transaction, namely a transaction with a single input. Typically, such transactions have a size of 192 bytes if they contain one output and 240 bytes if they contain two outputs (the second being the change output). But the usual SMS contains up to 140 bytes [1]. Converting bytes to symbols is simple we can use an Ascii85 (Base85) encoder/decoder. Let’s go into detail about the Bitcoin transaction structure and look at its Binary Map [2]:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wHOI_GGbzndEQKOP.png" /><figcaption>Picture 1 — Binary map of transaction</figcaption></figure><h3>2. Proposed solution</h3><p>We will use only standard inputs and outputs (P2PKH or P2WPKH) in our target transactions to make it possible to discard some constant values [3]. There are a lot of small constant fields. They are unnecessary to fit into SMS if we will rebuild the full transaction body after receiving SMS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kdoGCf93SSD-jUzooP0C_A.png" /><figcaption>Picture 2 — High-level diagram</figcaption></figure><p>The sender and the intermediary must use the same technique of building the target transaction to make it possible for the intermediary to rebuild the full transaction body, which will be correct and valid for Bitcoin.</p><p>Table 1 — Target transaction structure</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rZJ6lSsuZhUZRyNdPCp6HQ.png" /></figure><h3>3. Explanation</h3><p>For the version field and nLockTime field, we can use constant values on the sender side while creating a transaction. And we can use the same constants on the intermediary side while rebuilding the full transaction. So we do not need to transmit those values.</p><p>To transmit 32 bytes of prev_hash, we can use 8 bytes. 4 bytes to transmit the block height, where that transaction was confirmed, and 4 bytes — sequence number of that transaction in the block.</p><p>To refer to a particular output in the previous transaction, we can use a 1 byte unsigned integer, assuming that the transaction has no more than 256 outputs. So here, we can transmit via SMS only 1 byte instead of 4 bytes.</p><p>Let’s сonsides scriptSig field as two separate fields: signature data itself and public key; discarding such constant values as SIGHASH flag. Assuming that we will always use the SIGHASH_ALL flag for all our transactions in that case [4].</p><p>The signature data can not be compressed or omitted, so we will transmit it via SMS in full size as 64 bytes. But the public key we can discard because an intermediary can recover it from the signature data and even check the correctness by hashing and comparing it with the address in the previous output.</p><p>The nSequence field can be omitted, assuming that the sender and intermediary will use the same constant value and will not exploit the functionality of alternative transactions like replace-by-fee.</p><p>Assuming that we will use only the most popular output types: P2PKH and P2WPKH; we can omit the full scriptPubKey by transmitting only the bitcoin address data and an output type as 1 byte value.</p><p>In our case, it would not be necessary to have the whole 8 bytes of the sending amount in satoshis because 4 bytes (uint32) is already 4294967296 satoshis at maximum value, which are 42.94967296 bitcoins. And we assume that the sender will not send more than 42 coins. So we can transmit 4 bytes instead of 8 bytes.</p><p>We propose not to transmit any data about change output but assume that it will be present in the target transaction. And the intermediary will rebuild the whole transaction, including change output, understanding that the sender will receive a change to the same address from the previous transaction and with a value calculated as the rest from sending amount and fee.</p><p>In our case, the sender and intermediary must use a constant amount of satoshis for the transaction fee to avoid transmitting it via SMS. In that case, we can also omit transmitting the change value because the intermediary can calculate it on his side:</p><p><em>change = spendingAmount — sendingAmount — constantFee</em></p><p>As you notice, we can “compress” our target transaction to 97 bytes, and that is fine because the maximum size of SMS is 140 bytes. The rest space of the SMS could be used to add a link to some website, where an intermediary can find tools and manuals on handling the data from that SMS. Or you can modify our proposal, e. g. transmit a new address for a change instead of using the old one.</p><h3>4. Assumptions</h3><p>The UTXO we are going to use for input of the target transaction must be fully confirmed in Bitcoin. Since the sender would not track the confirmation status of the target transaction and replace it if it is not confirmed. For example, in case of chain reorganization or some other transaction spent the same UTXO.</p><p>The change from the target transaction will go to the same address as an original UTXO. It is a slightly less secure and private approach, but we assume it is enough for our situation.</p><p>Transaction fee for target transaction will always be constant (e. g. 10’000 satoshis). It would be more expensive, but still the simplest solution and helps economize space in the SMS.</p><p>Supporting only the most popular input/output types: P2PKH and P2WPKH. It helps to avoid transmitting the custom Script via SMS. While we are going to support more than one type of output, we need to transmit one additional byte to determine the exact type (e. g. P2PKH or P2WPKH).</p><p>The intermediary can not steal the money, but the sender has to trust that the intermediary will be online, will receive SMS, and handle it. Otherwise, the payment will not occur.</p><h3>5. Afterwords</h3><p>That article is not an exact specification but rather one of the possible solutions for particular cases when the sender has an agreement with an intermediary to receive SMS, rebuild the transaction, and broadcast it to Bitcoin.</p><h3>References</h3><p>[1] <a href="https://ozekisms.com/p_2612-sms-character-set-handling-and-multipart-messages.html">https://ozekisms.com/p_2612-sms-character-set-handling-and-multipart-messages.html</a></p><p>[2] <a href="https://en.bitcoin.it/w/images/en/e/e1/TxBinaryMap.png">https://en.bitcoin.it/w/images/en/e/e1/TxBinaryMap.png</a></p><p>[3] <a href="https://en.bitcoin.it/wiki/Transaction">https://en.bitcoin.it/wiki/Transaction</a></p><p>[4] <a href="https://en.bitcoin.it/wiki/Contract">https://en.bitcoin.it/wiki/Contract</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91f24bace0c4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/distributed-lab/how-to-broadcast-a-bitcoin-payment-transaction-via-single-sms-91f24bace0c4">How to broadcast a Bitcoin payment transaction via single SMS</a> was originally published in <a href="https://medium.com/distributed-lab">distributed-lab</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ZKProtection for MITM attacks]]></title>
            <link>https://medium.com/distributed-lab/zkprotection-for-mitm-attacks-3b969b58e16f?source=rss-6ed4aa1fcd15------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b969b58e16f</guid>
            <category><![CDATA[circom]]></category>
            <category><![CDATA[mitm]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[zkp]]></category>
            <category><![CDATA[snark]]></category>
            <dc:creator><![CDATA[Distributed Lab]]></dc:creator>
            <pubDate>Thu, 06 Jul 2023 11:04:33 GMT</pubDate>
            <atom:updated>2023-07-06T11:04:33.084Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently we have released the second version of w3sign — the solution that enables the signing of various documents, files, etc, using MetaMask. The first version of the solution had a vulnerability that allowed to modify the document signers’ list by the man in the middle (front-running attack).</p><p>Now we describe how we resolved this issue using zero-knowledge proofs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WT3s09Ee3_gbUBua" /><figcaption>The best UX you have ever seen</figcaption></figure><p>Instance: <a href="https://w3sign.app/">https://w3sign.app/</a></p><p>Github: <a href="https://github.com/dl-w3sign">https://github.com/dl-w3sign</a></p><h3>Original flow</h3><p>The general user flow of the first version was the following:</p><ol><li>The user uploads the document to be signed and calculates the document hash using the keccak256 hash function.</li><li>The user fills in the list of signers if needed.</li><li>The user sends the transaction with the document hash value and list of signers and calls the w3sign contract with mentioned data.</li></ol><p>Then any verifier can upload the same document, calculate its hash value, and check that it was stamped in the blockchain. Then the defined signer can sign the document via an additional transaction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/0*mqFbua0_3BGWelaH" /></figure><p><em>The signature process involves sending a transaction followed by a call to a specific function on a contract.</em></p><h3>Problem statement</h3><p>This logic was vulnerable, as anyone could intercept the transaction and send their own with the same hash but with a different list of signers, which made the original transaction invalid, as stamps cannot be changed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/0*SozDjftzgDUVh1rf" /></figure><p>There were two solutions to this problem (probably their amount is larger):</p><ol><li>Abandon the list of signers and allow all users to sign any stamps</li><li>Use ZK proofs to verify that the user who sent the transaction owns the original document</li></ol><p>The first option is cheaper for the end user but less convenient because all users can sign any document: 1 — additional FE requirements; 2 — inability to limit signing documents only by involved parties.</p><p>The second approach is right. It is slightly more expensive for users, but: 1 — it doesn’t reduce the logic of the system; 2 — it is secure.</p><h3>New Paradigm</h3><p>The updated flow isn’t different for the user (in the context of UX/UI), but under the hood, there are some changes:</p><ol><li>The user uploads the document to be signed and calculates the final document hash: 1.1) The hash of this document is calculated using keccak256 -&gt; 1.2) Then the first hash is calculated using the Poseidon hash function -&gt; 1.3) The final document hash is calculated by another hashing using Poseidon.</li><li>The user fills in the list of signers if needed.</li><li>Then a ZK proof is generated that the user owns the original file. To generate a ZK proof, the user must provide the first Poseidon document hash, which can only be obtained when the user owns the original file. Additionally, to generate a ZK proof, the user must provide an EVM address from which the transaction will be sent. This is done to prevent anyone from stealing the proof and reusing it.</li><li>After generating the proof, a transaction is formed and sent to the contract.</li><li>The stamp is created.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/0*XD2eTHP4ondhP1yb" /></figure><p>For verifiers and signers, the flow has no differences except the hashing process.</p><p>In this case, the Attacker also can take a final hash value of the document, but they can’t generate a correct proof for their account (that only an <strong>EXACT</strong> account can send the transaction with an <strong>EXACT</strong> stamp).</p><pre>template Hash() {<br>    signal input hash;<br>    signal input msgSender;<br>    signal output hashOfInput;<br><br>    component poseidon = Poseidon(1);<br>    poseidon.inputs[0] &lt;== hash;<br>    hashOfInput &lt;== poseidon.out;<br>}</pre><h3>Smart contracts description</h3><p>There are two main functions on the TimeStamping contract that users interact with <strong>createStamp</strong> and <strong>sign</strong>.</p><p>The <strong>createStamp</strong> function creates a stamp and accepts the following:</p><ol><li>ZK proof that the user owns the original document</li><li>List of signers who can sign the document. If the list of signers is empty, the stamp is public, and anyone can sign it.</li><li>Flag indicating whether the document needs to be signed on behalf of the stamp creator.</li></ol><p>The <strong>sign</strong> function only accepts the hash of the document to be signed. This function call will be successful only when the user has yet to sign and is in the list of signers or the stamp is public.</p><p>There are also functions on the contract that can only be called by its owner — <strong>setVerifier</strong>, <strong>setFee</strong>, and <strong>withdrawFee</strong>.</p><p>The <strong>setVerifier</strong> and <strong>setFee</strong> functions are used to update the values of the corresponding fields.</p><p>The <strong>withdraw fee</strong> function is used to withdraw the fee stored on the contract.</p><p>In addition to all the above functions, there are view functions that can provide information about various stamps, get the final hash of a document by its bytes and much more.</p><h3>Cost</h3><p>Here are some computations about gas consumption for old and new versions:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*hsTag07cP33W0A0Xj_meUA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b969b58e16f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/distributed-lab/zkprotection-for-mitm-attacks-3b969b58e16f">ZKProtection for MITM attacks</a> was originally published in <a href="https://medium.com/distributed-lab">distributed-lab</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to prove that you are 21 and not reveal anything else]]></title>
            <link>https://medium.com/distributed-lab/how-to-prove-that-you-are-21-and-not-reveal-anything-else-9ad5b56a7cbc?source=rss-6ed4aa1fcd15------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ad5b56a7cbc</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[pki]]></category>
            <category><![CDATA[digital-identity]]></category>
            <category><![CDATA[merkle-tree]]></category>
            <dc:creator><![CDATA[Distributed Lab]]></dc:creator>
            <pubDate>Fri, 04 Feb 2022 10:10:47 GMT</pubDate>
            <atom:updated>2022-02-04T13:03:20.623Z</atom:updated>
            <content:encoded><![CDATA[<h4>Tricks with Merkle Trees</h4><p><strong>Classic identity principles</strong></p><p>On a sunny Monday morning, Alice decides to go to the store to get some tequila. Naturally, as soon as she chooses the required product and is going to pay for the purchase, she needs to prove to the seller that she is already 21 years old. The proof procedure in this case is quite simple: Alice shows the seller her passport / ID card (hereinafter “<strong>identity</strong>”), the seller checks Alice’s date of birth, and if everything is ok, sells the product.</p><p>In current conditions the seller trusts the authority that issued Alice her passport (let’s call that authority “<strong>Trust</strong>”), and, accordingly, Alice’s date of birth (indicated in the passport): this information is enough to validate the purchase.</p><p>Now let’s figure out what the problem is. In fact, along with disclosing her date of birth and photo (the only information necessary to make the purchase), Alice also — involuntarily — disclosed:</p><ul><li>name, surname;</li><li>gender;</li><li>possibly — address of residence;</li><li>other information that the seller doesn’t need to know.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ue84z6hljZKbtTNbjvekbw.png" /></figure><blockquote>*Disclosure of such unnecessary information may negatively affect Alice. Imagine that the seller, now knowing Alice’s address of residence, crashes her Friday party, or begins stalking her with declarations of love, or tells Alice’s employer that Alice bought several bottles of tequila on a Monday morning thus raising suspicion that Alice is a habitual heavy drinker. Each of these scenarios is negative and harmful for Alice, but could have been easily avoided if Alice disclosed only the data directly relevant to her purchase, that is, date of birth and photo.</blockquote><p>In this particular scenario, Alice simply has no choice but to disclose that additional data, which in return creates a dilemma. On the one hand, every country has a legal requirement to provide to sellers of adult products a valid ID issued by that country’s authorities since the seller must be able to confirm both the purchaser’s identity and the originality and integrity of the document (including issuing authority aka Trust and presence of required watermarks). On the other hand, Alice cannot obfuscate or hide all other data contained in her ID so that the seller could see only the date of birth, thus involuntarily revealing all other data in the ID that is not directly relevant to her transaction.</p><p><strong>Digital identity</strong></p><p>Let’s discuss the same situation in the digital world. Suppose Alice wants to subscribe to a newsletter from a club of beautiful and adults. To do this, the site administrator must verify that Alice is an adult and has reached the required legal age (say, 21 years). We also assume that Alice has a digital passport (let’s call it Alice’s digital identity) which contains data about her. Unlike a physical passport, a digital identity (in the common sense) is just a byte array of data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R93ncuQ_WabX4fyaKh7vqg.png" /></figure><p>As in the physical world, the administrator must verify that the passport is issued by Trust. But while in the physical world this fact can be confirmed by the signature / seal of Trust, in the digital world that signature / seal is replaced by the digital signature that Trust calculated for Alice’s digital identity (using their own keypair).</p><p>First, suppose Trust hashed the entire byte string and signed it with their private key and passed the signature to Alice.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mDwbfpp5Lig_pETIDXeBlg.png" /></figure><p>When Alice proves to the adult club’s website administrator that she is 21 years old, she transfers to the administrator all of her digital identity data along with Trust’s signature. The administrator checks Alice’s data, as well as the validity of the signature (the public key of Trust is commonly known).</p><p>It turns out that we are facing the same problem — Alice revealed data that was not necessary. Moreover, if she provides only a part of the identity data, the administrator will not be able to verify the validity of Trust’s signature (since the signature covers the entire byte string).</p><p><strong>Deeply to privacy</strong></p><p>However, in the digital world there are quite a few math tricks that can provide very interesting properties for information. In this case, we will use the concept of <strong><em>binary hash value trees</em></strong> proposed by Ralph C. Merkle in 1979, known simply as <a href="https://patents.google.com/patent/US4309569"><strong><em>Merkle trees*</em></strong></a>.</p><p>Suppose that Trust does not sign the hash value of Alice’s complete byte string of data, but rather separates it into several logical components which are further used to construct the Merkle tree. In this case, Alice’s name, surname and other information appear as “leaves” of the tree.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y2KnMgauCunhTUzDcscoDQ.png" /></figure><p>Trust only signs the root value and returns it to Alice along with the signature.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-daY50D_54U5zwLvAYD-1Q.png" /></figure><p>How can Alice prove to the administrator that she is 21 using the proposed scheme? To do this, she gives them the value of the Merkle Root along with the signature of Trust, a set of data that confirms her legal age (date of birth) and Merkle Branch as proof that the provided data set is part of the general structure of the tree. Merkle Branch values are shown in red in the image below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dAo_xPxM7z-nCRlGZ277lQ.png" /></figure><p>Now Administrator can verify Alice’s legal age easier in only three stages</p><ol><li>The site administrator first subtracts the date of Alice’s birth from the current date and if the result is &gt;= 21 years old, the first stage of validation is passed.</li><li>The administrator then calculates the hash value of Alice’s birth date and uses it and the Merkle Branch for sequential pairwise concatenation and hashing of values among themselves in order to obtain a single hash value (the Merkle Root). It then compares the obtained value with the Merkle Root transmitted by Alice and if the values are identical, the second stage of validation is passed.</li><li>The administrator then verifies Trust’s signature. If it is correct, the validation procedure is completed and Alice can receive a service.</li></ol><p>There is, however, a problem that needs to be solved when using this scheme. It is related to the simplicity of finding the preimage of a hash function for small values by enumeration. Let’s take a quick look at a simplified example: Alice’s identity contains two components: last name and date of birth. When Trust signs Alice’s identity, it signs the root of the tree with two leaves:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZRzcbAo6P5RjTAqX418m2g.png" /></figure><p>If Alice wants to prove that her last name is Black, she provides to the verifier her last name, the Merkle Root with the signature of the Trust and the Merkle Branch, which in this case is represented by the value of H02. Verification is performed exactly as in the example above.</p><p>However, a verifier with a value of H02 can try to find the initial value by enumerating (in this case, it will take several seconds) — for each of the possible values, it calculates the hash value and compares it with the existing one until it matches.</p><p>Humanity came up with a solution to this problem a long time ago, when application servers began storing, instead of user passwords themselves, hash values of their passwords with additional salt value. The same approach can be applied to this case. When forming Alice’s identity, a randomly generated salt value can be additionally used for each data block. Trust, in turn, will sign the value of the root of the tree, taking into account the salt used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*iLvmisK2ICPXk5mGDp-Avw.png" /></figure><p>Now, when proving her identity, Alice must additionally provide the salt value used for a particular data block. But at the same time, the verifier will be able to access only the information that is defined by Alice.</p><p>There may arise a case when a verifier requires several elements of the user’s personal data — for example, date of birth plus full name plus residence address. In this case, if Alice sends a Merkle Branch for each data fragment, some values ​​of the nodes of the Merkle tree may overlap, resulting in redundancy (this increases the total proof size). To solve this problem, a multiple authentication scheme (like <em>Octopus Authentication</em>) can be applied to the Merkle tree. This particular authentication scheme allows creating a Merkle Branch while avoiding redundancy through increasing the number of authentication nodes, in return reducing the signature size. This authentication scheme is part of the <em>Gravity-SPHINCS</em> hash-based signature scheme which is a heavily optimized version of the original <a href="https://github.com/gravity-postquantum/gravity-sphincs/blob/master/Supporting_Documentation/submission.pdf">SPHINCS scheme*</a>. Below is a graphic example of Octopus Authentication application to a Merkle tree.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DiC6gpguMy_sAFEEdBbtTA.png" /></figure><p><strong>Role in digital identity infrastructure</strong></p><p>The goal of the digital identity infrastructure is to replace the trusted <strong>Trust</strong> with a decentralized infrastructure, which (in our own opinion) implies application of the following principles:</p><ul><li>There are no centralized identity providers; instead, every individual using the digital identity infrastructure may be both an identity provider and a user whose data is verified;</li><li>multiple identity providers verify identities and attributes of users;</li><li>each identity provider is responsible for confirming proof of identification during any identity (data verification) procedure;</li><li>all events related to any digital identity are potentially publicly auditable by everybody, while at the same time user data is kept confidential in a separate secure database the contents of which are distributed among separate providers;</li><li>all events with digital identities are time stamped and recorded in a particular order, ensuring that integrity and authenticity of the events are also publicly verifiable;</li><li>the more identity providers independently confirmed identity and a time stamp, the better.</li></ul><p>In other words, Alice herself is responsible for the formation of her own identity and all the attributes associated with it. The task of identity providers is only to independently verify these attributes.</p><p>At the same time, Alice must be able to give to various providers only those attributes that she considers necessary. However, the task is to confirm that each of these attributes separately and all of these attributes collectively are in fact related to the same identity.</p><p>The advantage of the proposed scheme is that now Alice independently creates a tree of attributes and sends identity providers the root value and the corresponding Merkle Branch for the attributes that need to be verified, without having to provide or verify any data that is unnecessary for any particular transaction.</p><p>Identity providers, in turn, form confirmations of a set of attributes that belong to a single Merkle Root value. The transaction of identity confirmation should include:</p><ul><li>provider’s identifier;</li><li>the set of data that has to be confirmed;</li><li>expiration date;</li><li>provider’s signature.</li></ul><p>In life, a procedure like this can go through providers who already have a certain weight in society. For example, Alice can receive confirmation of personal data from the tax office, confirmation of higher education from the university, and health status from the clinic. In this case, when applying for a new job, Alice can transfer the necessary data and the recipient (e.g., employer) can check that these attributes of Alice’s identity were confirmed by the responsible parties.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eTmP6pondKuryfnl4_0zOw.png" /></figure><p>This scheme allows Alice to provide only the data that is necessary for confirmation / verification, without disclosing the remaining attributes. Moreover, all confirmations of this data are tied to a single entity that connects the attributes (the existence of the latter in the structure is quite simple to check mathematically).</p><blockquote><a href="https://medium.com/@pavelkravchenko"><em>Pavel Kravchenko</em></a><em>: </em><a href="/service/mailto:pk@dstributedlab.com"><em>pk@distributedlab.com</em></a></blockquote><blockquote><em>Oleksandr Kurbatov: </em><a href="/service/mailto:ok@distributedlab.com"><em>ok@distributedlab.com</em></a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ad5b56a7cbc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/distributed-lab/how-to-prove-that-you-are-21-and-not-reveal-anything-else-9ad5b56a7cbc">How to prove that you are 21 and not reveal anything else</a> was originally published in <a href="https://medium.com/distributed-lab">distributed-lab</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>