Abstract
As blockchain technology gains adoption, traditional Externally Owned Accounts face significant limitations in usability, security, and recovery. These accounts rely on private keys for authentication, creating a single point of failure with no native mechanisms for recovery or flexible authentication. To overcome these challenges, this thesis proposes an Account Abstraction Wallet architecture that integrates social recovery mechanisms and leverages zero-knowledge proofs to ensure secure and private account management.
The wallet design is based on the ERC-4337 standard, which enables account abstraction without requiring changes to the consensus protocol. In this architecture, users control smart contract wallets rather than traditional EOAs. To enhance recovery ability, the wallet employs a social recovery scheme, where a group of predefined guardians can assist in restoring access when a user loses their signing key. Unlike conventional social recovery models that require guardians to publicly sign recovery requests, our design uses zero-knowledge proofs to protect guardian identities. This ensures that the recovery process remains private, tamper-resistant, and verifiable on-chain without revealing sensitive information.
The implementation employs efficient zero-knowledge proof primitives such as the Poseidon hash function and the BabyJubJub elliptic curve, optimized for compatibility with the circuits. A user-friendly interface is also developed to facilitate the generation and submission of proofs, making the system accessible to non-technical users.
Through this approach, the proposed wallet achieves a balance between security, usability, and privacy. It eliminates the single point of failure inherent in EOAs, introduces robust account recovery, and preserves confidentiality in guardian-based verification. This thesis contributes a concrete solution toward more resilient, secure, and user-friendly Web3 identity management.
Keyword: blockchain, smart contract, externally owned account, zero-knowledge proofs, elliptic curve, circuit, social recovery.
Introduction
Web3 and blockchain technologies have the potential to reshape fundamental aspects of digital applications. Web3, the next phase of the internet, is based on blockchain technology, cryptographic technology, and peer-to-peer networks. Its goal is to create a decentralized internet with open, transparent websites and web applications. Web3 creates decentralized, trustless, and transparent systems. Therefore, Web3 gains numerous benefits for individuals.
In Web 2.0, technology companies control and exploit user information. In Web3, users have full ownership of their data. They can choose what information to share with companies and third parties. In addition, the decentralized Web allows users to track their data and review the source code of their platforms. All stakeholders remain aware of the value and transactions they are involved. In addition, Web3 directly connects businesses with customers, significantly reducing or eliminating middle layers.
With the potential to revolutionize finance, supply chains, and digital asset transactions, effective digital asset management is important. Blockchain wallets address the need by securely storing users' public and private keys while providing an intuitive interface for managing crypto assets. A wallet allows users to track their assets, create transactions, and interact with decentralized applications (dApps). The role of wallets in the Web3 ecosystem is important. Considering the advantages and disadvantages of the most common wallet type, Externally Owned Accounts (EOAs), this thesis proposes a novel blockchain wallet mechanism and discusses its potential improvements.
Motivation
EOAs are the most widely used type of blockchain wallet today. An EOA wallet allows users to control their accounts and assets. There are two main types of EOA wallets: (1) hardware wallets (cold wallets), such as Ledger or Trezor, and (2) software wallets (hot wallets), such as MetaMask or Fire. A hardware wallet is a physical device that stores the user's private key offline. Because each transaction requires approval from the physical device, hardware wallets are a highly secure option for EOA. In contrast, a software wallet is an application or browser extension that allows users to quickly and conveniently access their assets.
All EOA wallets are controlled by a private key, which serves as the user's unique signature and key to accessing the EOA wallet. EOAs are easy to use, making account creation and management straightforward. In addition, they provide users with complete control: only the person who holds the private key can manage and control the wallet, all associated assets, and transaction execution.
However, EOA wallets have several limitations. Because they are based entirely on a private key for security and ownership verification, there is no way to recover a lost private key. If users lose their private key, they lose access to all assets in the wallet, a problem that is nearly impossible to solve in practice. Some recovery methods, such as mnemonic seed phrases, have been implemented to reduce this risk. However, while seed phrases help users recover a lost private key, they do not provide a solution to recover ownership of the wallet itself.
Furthermore, while EOAs are suitable for basic transfers and dApp interactions, implementing advanced functionality or custom logic within EOAs is a challenge. EOAs basically only consist of a key pair and a few cryptographic algorithms for verifying ownership when users interact with their assets. Moreover, it is impossible to integrate a new signature algorithm or implement a recovery mechanism.
In contrast, smart contract wallets, which operate based on predefined logic defined in the smart contract code, can implement advanced functionality and custom logic. By using flexible predefined logic, smart contract wallets can support various functionalities, including gas fee optimization, transaction batching, multi-sig management, and complex security structures. Unlike EOAs, smart contract wallets can implement mechanisms for account recovery when a lost or compromised private key occurs.
Despite their advantages, smart contract wallets still face challenges such as usability and security concerns. This thesis aims to address the drawbacks of EOA wallets by proposing a novel wallet mechanism that improves user experience and introduces a secure recovery model.
Our Contributions
The primary contributions of the thesis are to introduce account abstraction and related concepts. After that, this thesis proposes the implementation of a zero-knowledge recovery mechanism for account abstraction based on ERC-4337. Specifically, our contributions will be presented in
Chapter undefined and
Chapter undefined, including:
- A recoverable account abstraction solution. We propose an account abstraction wallet architecture to remove a single private key concern, therefore eliminating the risk of permanent asset loss. Furthermore, we present a zero-knowledge recovery solution based on guardians to hide guardian addresses on-chain.
- Implementation and Evaluation. We deploy a web application, a smart contract system, and a simple bundler to test and validate the proposed account abstraction architecture.
Thesis Organization
The rest of this thesis is organized as follows:
- Chapter 2 introduces relevant concepts, including blockchain fundamentals, account system in blockchain, the smart contract, and zero-knowledge proofs.
- Chapter 3 discusses the challenges of the current blockchain account model and the need for account abstraction. It also provides an overview of account abstraction mechanisms based on ERC-4337. The chapter also provides knowledge about privacy in account abstraction, including implementations of privacy in account abstraction and several its limitations.
- Chapter 4 describes the proposed system architecture. The chapter focuses on the integration of the recovery method with zero-knowledge proofs to verify and change ownership without revealing guardian identities.
- Chapter 5 This chapter discusses the implementation environment, including the technologies used for deployment, metadata management, and system configuration. It also presents several comparisons between existing recovery wallet solutions and the wallet proposed in this thesis, highlighting key differences in architecture and recovery mechanisms. Furthermore, the chapter evaluates the performance of the proposed approach by measuring proof generation time, verification time, and on-chain gas costs.
- Chapter 6 presents the research results and suggests directions for future work. The chapter summarizes the proposed solution and its contributions to addressing the identified challenges. It also outlines potential improvements and promising areas for further development.
LITERATURE REVIEW
This chapter provides a foundation of key concepts relevant to the thesis. The relevant concepts include blockchain technology, account system, and smart contract in blockchain. The chapter then presents zero-knowledge proofs, a novel and increasingly important concept in the Web3 space. Finally, it outlines zk-SNARKs, one of the most widely used and well-suited forms of zero-knowledge proofs in Web3 applications.
Blockchain
This section introduces blockchain technology, providing an overview of its historical origins, fundamental components, defining characteristics, and consensus mechanisms. It establishes the foundation for understanding blockchain's architecture, evolution, and transformative potential across applications.
The concept of blockchain was introduced in 1991 by Stuart Haber and W. Scott Stornetta, who proposed a cryptographically secured chain of timestamped records to prevent tampering or misdating of digital documents
[undefined]. Their design used cryptographic hashing to link data blocks, forming a tamper-evident ledger.
In 2008, Satoshi Nakamoto published the Bitcoin whitepaper
[undefined], presenting the first practical blockchain implementation. Bitcoin, launched in 2009, solved the double-spending problem in digital currencies through decentralized consensus, eliminating trusted intermediaries. Since then, the technology has evolved significantly. For example, the introduction of Ethereum in 2015 extended blockchain's capabilities with smart contracts, enabling decentralized applications (dApps). Today, platforms like Cardano and Solana continue to advance blockchain functionality.
At its core, a blockchain is a distributed ledger consisting of a sequence of cryptographically linked blocks, each containing validated transactions, maintained across a peer-to-peer network of nodes. Key components include blocks, transactions, Merkle Trees, and cryptographic hashing. Blockchain relies on cryptographic digital signatures, hash functions, and consensus protocols to ensure security and authenticity. Blockchain's defining characteristics are:
- Decentralization: Data is replicated across nodes, eliminating single points of failure and central control.
- Immutability: Once recorded, data cannot be altered without network consensus, ensuring tamper resistance.
- Security: Cryptographic mechanisms protect against unauthorized access.
- Transparency: Public blockchains allow open access to transaction data, fostering trust.
Figure undefined illustrates the blockchain structure
[undefined], which is composed of a sequence of blocks. Block serves as the fundamental unit of data storage and structure. Blocks are connected to each other through the reference that contains the previous block hash. The first block is called the genesis block, which does not have any previous block. Depending on the type and design of the blockchain, additional parameters may be present in a block. However, a typical block consists of two primary components: the block header and the block body. The block header contains important metadata that identifies the block, such as the previous block hash, timestamp, nonce, and Merkle tree root hash, while the block body includes a set of transactions, which are seen as the permanent records on the blockchain.
A transaction in blockchain is a digitally signed instruction, which is performed by a particular (usually an account), to change the blockchain's state. In a blockchain network like Bitcoin, a transaction represents the transfer of cryptocurrency from one address to another. In programmable blockchains such as Ethereum, transactions can interact with smart contracts, enabling complex operations beyond simple value transfers. In terms of blockchain, transactions can be divided into two common models: unspent transaction output (UTXO) model and account model.
In the UTXO model (
Figure undefined), each transaction has a list of outputs that will be spent as inputs in future transactions. The outputs are assigned to the addresses that will spend them. The total of unspent outputs in the current blockchain state is the total of balances of the addresses. On the other hand, in the account model, a blockchain maintains the balance of all accounts and keeps records of all transactions that affect the balance.
To create a transaction, the sender specifies parameters (e.g., recipient address, amount) and signs it with a private key using an elliptic curve algorithm, such as Elliptic Curve Digital Signature Algorithm (ECDSA) or Edwards-curve Digital Signature Algorithm (EdDSA). The signed transaction is broadcast to the network's peer-to-peer nodes. Nodes verify the signature's authenticity, confirm the sender's balance, and check the nonce. Validated transactions are stored in a memory pool (mempool), awaiting inclusion in a new block by miners or validators. Selected transactions are hashed into a Merkle Tree, included in a block's body, and linked to the previous block via its hash in the header. The consensus mechanism determines which blocks are added to the blockchain. Once added, the transaction is confirmed, and the blockchain's global state is updated.
In the domain of blockchain technology, Merkle tree
[undefined] is the solution to verify whether a particular transaction is included in a block or not without having to download the entire dataset. A Merkle tree is a binary tree, represents the hash of all transactions in the block. Each leaf node in the Merkle tree is a transaction hash, and each non-leaf node is the hash of the concatenation of its two child nodes. The transaction hash is the way each transaction is identified. Transaction hash is a cryptographic digest generated by applying a hash function, such as SHA-256 in Bitcoin and Keccak-256 in Ethereum, to the transaction's contents.
In a blockchain network, nodes maintain the honesty and security of the system. Depending on the blockchain's design and consensus mechanism, nodes can be miners or validators. Miners are responsible for creating new blocks and minting coins, while validators verify transactions and ensure network consistency through digital signatures. The process of selecting which node will add the next block to the blockchain is managed by a consensus mechanism.
The consensus mechanism is the protocol that all nodes in a decentralized network agree on the state of the blockchain. A consensus mechanism has two key characteristics: (1) only valid blocks are added to the chain, and (2) the system remains secure even in the presence of malicious actors.
There are two most widely used consensus mechanisms are Proof of Work (PoW) and Proof of Stake (PoS). In PoW, miners solve complex mathematical puzzles to verify transactions. The first miner to successfully find a valid solution is permitted the right to add a new block to the blockchain and receive cryptocurrency incentives. PoW ensures network security through computational difficulty, making it resistant to attacks. However, it requires substantial computational power and energy consumption, raising scalability and sustainability concerns. In contrast, Validators are selected to create blocks based on the cryptocurrency they stake as collateral in PoS. Validators who successfully add a block receive transaction fees as a reward. PoS significantly reduces energy consumption and allows for faster transaction finality. However, PoS can pose the risk of centralization, where a small number of entities control a significant portion of the staked assets. Other consensus models, such as Delegated Proof of Stake (DPoS), Proof of Authority (PoA), and Byzantine Fault Tolerance (BFT) variants, depend on the blockchain architecture.
Account system in blockchain
This section introduces the account system in blockchain, focusing on the two fundamental account types: Externally Owned Accounts (EOAs) and Contract Accounts (CAs). It provides an overview of the structure, components, and roles of the two types of accounts.
The account system is fundamental to blockchain's functionality, enabling users and applications to interact with decentralized ledgers. Unlike traditional systems, where accounts are typically maintained and managed by centralized authorities, blockchain accounts are decentralized and governed by a cryptographic algorithm. In the current blockchain architecture, user accounts are divided into two typical types: externally owned accounts (EOAs) and contract accounts (CAs). EOAs are the most basic type of blockchain account, allowing users to execute transactions, such as cryptocurrency transfers or smart contract executions. CAs allow users to perform complex operations, such as Uniswap's automated makers or Aave's lending protocols.
EOAs are controlled through a cryptographic key pair consisting of a private key and a public key. The private key is used to generate digital signatures and authorize transactions, while the public key is used to derive the account's address. Because EOAs are based on a cryptographic pair key, their applications are limited to signing transactions and interacting with the smart contract, and can not store executable logic, transactions'state, or perform complex programmable actions.
Figure undefined illustrates the key components of an EOA, including
- Address: A 20-byte identifier derived from the public key using the Keccak-256 hash function. This is the user's identity on the blockchain, used for sending and receiving assets or interacting with smart contracts.
- Nonce: A transaction counter to prevent replay attacks by ensuring each transaction is unique.
- Balance: The amount of cryptocurrency held by the account. The balance is maintained by the ledger, and the EOA does not physically hold these tokens.
EOAs are commonly implemented in various software wallets such as MetaMask, Trust Wallet, and Rainbow, or hardware wallets such as Trezor, Ledger, and GridPlus. While they differ in terms of user experience and security interface, both types provide the same fundamental account structure and functionality.
CAs are controlled by on-chain code (implemented by a smart contract) rather than a private key. CAs cannot initiate transactions on their own but can be triggered by transactions sent from EOAs or other contracts. When triggered, a CA executes its embedded logic, enabling advanced functionalities such as automated market making, lending protocols, multi-signature wallets, or programmable access controls. A contract account consists of key components (as illustrated in
Figure undefined)
- Address: A 20-byte identifier, generated when the contract is deployed, typically derived from the creator's address and their nonce (number of transactions sent from that address).
- Balance: The cryptocurrency held by the contract.
- Code: The compiled bytecode of the smart contract, executed by the Ethereum Virtual Machine (EVM).
- Storage: Persistent data stored on the blockchain, such as user balances or contract states, organized as a key-value mapping.
- Nonce: Tracks the number of contracts created by the account (if applicable).
In conclusion, EOAs primarily support basic functionalities such as initiating transactions and managing token balances. In contrast, CAs enable advanced features, allowing for complex interactions and custom behavior through on-chain logic. The limitations of EOAs begin with their original design. Within the EVM ecosystem, EOAs and CAs are intended to function complementarily. However, these constraints limit the scalability, flexibility, and user experience of decentralized applications.
Account abstraction can resolve these limitations by unlocking the full capabilities of CAs. It introduces a more flexible and extensible account model, offering a foundation for the solutions that improve user experience, enhance security, and streamline asset management in the Web3 environment. Account abstraction will be discussed in more detail in
Section undefined.
Smart contract
This section introduces smart contracts, covering their historical origins, architectural structure, core characteristics, and execution environment. It also explores the wide range of smart contract applications, with a specific focus on smart contract wallets and their integration with account abstraction.
A smart contract is a decentralized, trustless, self-executing program stored on a blockchain that automatically executes the shared code when predefined conditions are met. The concept was first proposed by Nick Szabo in 1997
[undefined], who considers smart contracts as digital protocols that execute agreements with minimal trust. Szabo's idea leveraged cryptographic techniques to ensure security and automation, but lacked a practical implementation platform at the time.
Smart contracts came with Ethereum's launch in 2015, introduced by Vitalik Buterin
[undefined]. Ethereum introduced the Ethereum Virtual Machine (EVM), a Turing-complete environment that allows developers to deploy and execute arbitrary logic on-chain or smart contracts. Since then, other platforms such as Cardano, Solana, and Binance Smart Chain have installed smart contracts. Fundamentally, a smart contract consists of three core components:
- Code: The smart contract's bytecode, written in languages like Solidity, compiled into EVM. The code defines the contract’s logic, such as executing a token swap or updating a voting record.
- Storage: Persistent data stored on the blockchain as a key-value mapping, retaining state information. Storage is costly due to gas fees, incentivizing efficient design.
- Balance: The cryptocurrency held by the contract
In Ethereum, EVM is the runtime environment for smart contracts. The EVM is a Turing-complete virtual machine, which means that EVM can solve any problems with a necessary time, energy, and instructions. One of the key features of the EVM is its determinism, which is that the same input always results in the same output. Additionally, the EVM is designed to be isolated from the host system, meaning that smart contracts run in a sandboxed environment, isolated from the host machine.
The structure and operating mechanism of smart contracts are illustrated in
Figure undefined. A smart contract is written in a high-level programming language; in the scope of this thesis, it is Solidity. The source code is then compiled into EVM bytecode, a low-level binary representation that the EVM can interpret and execute. This bytecode is sent to the blockchain based on a deployment transaction to blockchain. After being verified and included in a block, the contract is officially deployed and then is assigned a unique address. From that point, users and other contracts can trigger functions within the contract by sending transactions to its address, executing the smart contract logic, and changing its storage.
When a user or another contract initiates a transaction directed to a deployed smart contract's address, the EVM retrieves the bytecode of the target smart contract from the blockchain state. The bytecode is then interpreted as instructions or opcodes such as ADD, MUL, JUMP, CALL, SSTORE, RETURN. As a stack-based virtual machine, the EVM executes these operations using a last-in, first-out (LIFO) stack structure, where instructions are pushed to and popped from the stack during computation. If the execution completes successfully, the contract's persistent storage may be updated, and the global blockchain state is modified accordingly to reflect token transfers, state variable changes, or other effects resulting from the contract's logic.
A smart contract has three primary characteristics: automation, immutability, and transparency. Automation means that once deployed, smart contracts execute autonomously when a predefined condition is met. Immutability is that the contract's code can not be changed after deployed. Transparency means that the code and state are publicly visible on the blockchain (in public networks), allowing anyone to verify functionality.
Smart contracts are the backbone of modern blockchain ecosystems, enabling trustless and automated solutions. Their utility expands to a wide range of domains, including DeFi, NFTs, and DAOs. More recently, the implementation of account abstraction mechanisms, such as ERC-4337, uses smart contracts to improve user experience, security, and programmability in blockchain systems.
In DeFi, smart contracts automate financial services like lending, borrowing, trading, and yield farming. Protocols such as Uniswap implement smart contracts to automate market makers, allowing users to swap tokens directly without relying on centralized exchanges.
In NFTs, smart contracts define token standards such as ERC-721, ERC-1155, enabling the creation, ownership, and transfer of unique digital assets. Smart contracts manage metadata and access rights in NFT-based marketplaces and gaming ecosystems.
DAOs are managed entirely by smart contracts, which automate proposal voting, treasury management, and execution of governance decisions. For instance, MakerDAO relies on smart contracts to manage the DAI token and adjust parameters without centralized control.
In the scope of the thesis, smart contracts play a central role in implementing the recovery account abstraction wallet, enhancing traditional EOA by offering programmable features. Unlike EOAs, smart contracts can execute and implement custom logic.
- Custom verification: Smart contracts can replace the standard EOA verification mechanism with custom verification logic. For example, smart contract wallets can use multi-signature or biometric authentication to reduce key loss risks.
- Social recovery: Smart contract wallets can enable social recovery. Fundamentally, users can designate trusted guardians (friends, devices, or entities) to recover accounts.
- Zero-knowledge proofs integration: Smart contract allows the implementation of ZKP to enhance privacy for the system.
Zero-knowledge Proof
This section introduces Zero-knowledge proofs (ZKPs). The discussion covers the foundational concepts of ZKPs, their interactive and non-interactive variants, their applications in blockchain, and a detailed introduction to zk-SNARKs, including comparisons with other ZKP methods like zk-STARKs and Bulletproofs.
ZKPs are critical for blockchain applications requiring privacy and efficiency. They enable users to prove credentials (age, financial status) without revealing sensitive data, supporting use cases like private transactions in Zcash, identity verification in decentralized systems, and scalable layer-2 solutions like zk-Rollups. By ensuring confidentiality and reducing on-chain data requirements, ZKPs enhance blockchain’s utility in finance, healthcare, and governance.
In the context of this thesis, ZKPs are essential to implementing a private authentication in a smart contract recovery solution based on guardians. Specifically, using ZKPs, the valid guardian can prove their identity and recover ownership without revealing their real identities. The architecture of the recovery solution will be discussed in more detail in
Chapter undefinedZKP is a cryptographic protocol that allows a prover to convince a verifier that a statement is true without revealing any additional information beyond the statement's validity. The goal of a zero-knowledge proof is to allow the verifier to be certain of the truth of the statement while keeping the underlying information secret. A valid zero-knowledge proof must satisfy the following three properties:
- Completeness: An honest verifier will always be convinced by an honest prover if the statement is true.
- Soundness: If the statement is incorrect, a dishonest prover cannot convince the verifier except with negligible probability.
- Zero-Knowledge: The proof reveals no additional information beyond the fact that the statement is true. Even a cheating verifier learns nothing extra.
A zero-knowledge proof involves two parties: the prover, who wants to prove the statement, and the verifier, who wants to verify its validity. The prover constructs a witness, a piece of secret information that serves as proof, and convinces the verifier that the statement is true through one of two possible approaches: (1) interactive zero-knowledge and (2) non-interactive zero-knowledge.
In an interactive zero-knowledge proof (IZK), the verifier proposes a challenge and expects the prover to respond correctly. The procedure can be repeated as many times as the verifier wants, until the verifier ensures that the probability that the prover guesses rather than knows the answer becomes low enough. A standard IZK involves three steps (as illustrated in
Figure undefined)
- The prover sends a message as a commitment to the verifier.
- The verifier returns a challenge and asks the prover to answer it.
- The prover calculates the answer and sends it back to the verifier.
If the prover consistently responds with valid answers over multiple rounds of communication, the verifier can consider that the commitment is honest. IZKs are easy to implement and straightforward. However, the protocol requires constant back-and-forth communication, which makes it inefficient. Moreover, its proof is unavailable for independent assessment. There are two key reasons why IZKs are unsuitable for blockchain applications.
Non-interactive zero-knowledge proofs (NIZKs) are developed to address the inefficiencies of interaction. These proofs require only a single message from the prover to the verifier. Instead of multiple rounds, NIZKs rely on advanced cryptographic techniques to ensure zero-knowledge properties, such as elliptic curve cryptography provides the discrete logarithm problem to ensure security, and a trusted setup or common reference string (CRS) to establish parameters. A standard model consists of three stages (that is illustrated in
Figure undefined)
- The prover inputs the secret witness into an algorithm.
- The algorithm generates a proof.
- The proof is sent to the verifier, who checks its validity using the CRS.
Based on NKZK's advantages, there are diverse applications that implement NIZKs to enhance privacy and scalability.
- Private Transactions: ZKPs can enable validation without exposing sensitive transaction data. For example, Zcash uses ZKPs to create shielded transactions. These transactions hide the participants and amounts involved while ensuring the network can verify that no double-spending occurs.
- Scalability Solutions: ZKPs compress transaction data off-chain, and then the off-chain computations are verified on-chain with minimal data. This approach reduces the volume of data stored on the blockchain while maintaining trustworthiness and security.
- Identity Verification: Users prove credentials without revealing personal data. For example, a user can prove they are above a certain age without revealing their exact birthday.
- Guardian-Based Authentication: Users can be authenticated by a group of guardians without revealing guardian identities, enhancing security in decentralized networks.
zk-SNARK stands for Zero-Knowledge Succinct Non-Interactive Argument of Knowledge. This type of ZKP is the most widely adopted ZKP in blockchains. Their succinct proofs and fast verification make them ideal for limited resource environments. Besides the primary properties of non-interactive ZKP, completeness, soundness, zero-knowledge, and non-interactivity, zk-SNARKs also satisfy the following important characteristics:
- Succinctness: The proof is short and can be efficiently stored on-chain and quickly verified by network nodes.
- Argument of knowledge: the prover possesses a valid witness that satisfies the given statement.
At a high level, zk-SNARKs transform a computation into an equivalent algebraic form that can be efficiently proven and verified. The construction typically involves the following steps:
- Arithmetic Circuit Representation: Initially, the computation to be proven is transformed into an arithmetic circuit composed of addition and multiplication gates over a finite field. Each gate represents a basic arithmetic constraint, and the overall circuit defines the computational statement.
- Rank-1 Constraint System (R1CS): The circuit is then converted into an R1CS. This structured form enables a systematic translation into algebraic proofs.
- Quadratic Arithmetic Programs (QAPs): The R1CS is compiled into a QAP. The central idea is that if a prover knows an assignment that satisfies the R1CS, they can construct polynomials that meet specific divisibility conditions.
- Trusted Setup: A one-time, trusted setup process generates a common reference string (CRS) consisting of public parameters required for proof generation and verification. The security of zk-SNARKs depends on the secrecy of certain components generated during this setup.
- Proof Generation and Verification: Using the CRS, the prover generates a valid proof, and the verifier can check the proof's validity quickly without learning anything about the input itself.
The main advantages of zk-SNARK are their succinctness and fast verification, making them highly suitable for high-frequency blockchain operations, such as transactions, smart contract executions, and rollup proofs. Their small proof size allows for significant savings in storage and network bandwidth compared to alternatives. However, zk-SNARKs has two limitations:
- Trusted setup dependency: The dependency on a trusted setup can cause a potential centralization point and security risk if the setup process is incorrectly conducted.
- Strong cryptographic assumptions: zk-SNARKs depend on complex mathematical structures like elliptic curve pairings and specific non-standard assumptions, making them more complex to implement compared to proof systems relying purely on classical assumptions.
To be compared, Zero-Knowledge Scalable Transparent Arguments of Knowledge (zk-STARK) were designed to address some limitations of zk-SNARKs, and do not require a trusted setup. However, zk-STARK proofs are larger and slower to verify than zk-SNARK proofs. Thus, while zk-STARKs are more robust in terms of trust and future-proofing, zk-SNARKs remain more efficient in terms of proof size and verification speed, which is critical for blockchains with high throughput requirements.
ACCOUNT ABSTRACTION
This chapter discusses different limitations of the current blockchain account model. Moreover, this chapter introduces the fundamental aspects of account abstraction, with a particular focus on ERC-4337 and its components. This chapter also presents recent privacy issues within the context of account abstraction. While privacy is a critical issue in blockchain systems, it is rarely discussed in account abstraction. By presenting recent developments, this chapter aims to provide useful references for further research.
Challenges in the Current Blockchain Account Model
This section outlines the limitations of the current blockchain account model, focusing on EOAs, and further discusses several significant issues, including key management risks, limited functionality, and security vulnerabilities.
The current blockchain account model, particularly EOAs, has a wide range of applications. Its advantages include ease of implementation, user-friendly experience, and reliability in typical scenarios. However, EOAs still present several limitations that lead to significant challenges. These include key management risks, feature limitations, security vulnerabilities, contract account limitations, lack of native account recovery, and inflexibility in access control. Among these, there are three primary challenges, including key management risks, feature limitations, and security vulnerabilities. Addressing these core issues can potentially resolve the others. For example, limitations in contract accounts are an aspect of feature limitations, and the lack of native account recovery can be dealt with by handling feature limitations.
Key management risk
EOAs are secured and controlled through a cryptographic key pair. This key pair enables secure communication, authentication, and transaction signing. The public-private key system is based on asymmetric cryptography, which ensures that only the private key owner can control the account, while others can independently verify ownership using the corresponding public key.
- Transaction signing: When sending a transaction, the private key generates a digital signature. This signature verifies account ownership and authorizes the transaction without exposing the private key.
- Account control: The private key is the only way to access and manage an account. If lost, the account and its associated assets become permanently inaccessible.
The public key is derived from the private key using elliptic curve cryptography. It is primarily used for the verification of digital signatures. A public key is typically 64 bytes long, consisting of two 32 byte integers that represent the $x$ and $y$ coordinates on the elliptic curve.
EOAs rely on a single private key for access and transaction authorization. This dependence causes a major risk: if the private key is lost, forgotten, or compromised, the user permanently loses access to the account and all associated assets.
As illustrated in
Figure undefined, an estimated 20% of all Bitcoin, approximately 3.84 million BTC, has been lost. This estimate is based on blockchain analysis of addresses where funds have remained inactive for seven years or more. One of the primary causes of the loss is the loss of private keys, including forgotten passwords, misplaced backups, and unrecoverable seed phrases.
Feature limitations
As discussed in
Subsection undefined, beyond the risks of losing private keys and forgetting passwords, a significant limitation of EOAs is the lack of built-in recovery mechanisms. Unlike smart contracts, EOAs cannot execute or implement programmable logic. Various recovery methods have been proposed, such as off-chain backups and seed phrases, but these approaches require users to securely store recovery credentials or rely on trusted storage solutions. Pre-signed transactions can add an extra layer of security; however, they still depend on offline storage devices and secondary accounts. More advanced recovery solutions—both guardian-based and guardian-less—are implemented via smart contracts and, therefore, cannot be natively supported by EOAs without external modifications.
Beyond recovery limitations, EOAs are restricted in their functionality. Their primary purpose is to manage Ether, interact with other accounts, and initiate transactions. However, EOAs cannot support advanced features such as:
- Paymaster services: EOAs cannot facilitate gas fee sponsorship mechanisms, limiting flexibility in transaction cost management.
- Multi-Signature security: EOAs lack multi-signature capabilities, making them less secure for collective fund management.
- Automated transaction execution: EOAs cannot schedule or automate transactions based on predefined conditions, requiring manual user intervention.
- Gas fee optimization: EOAs do not allow for gas abstraction techniques such as batching or dynamic gas payment strategies, which smart contracts can implement.
These limitations make EOAs less suitable for complex and scalable blockchain applications, driving the need for alternative account models such as smart contract-based wallets that offer enhanced programmability and security.
Security vulnerabilities
However, despite the cryptographic security of key pairs, EOAs remain vulnerable to various attack vectors, primarily stemming from private key and seed phrase compromises. Notable incidents include:
- Ronin Network Hack (2022): This attack exploited vulnerabilities in the private key management of the Ronin Network, leading to the theft of over $600 million worth of assets. The breach was a result of a compromised validator node that managed the private keys for the network.
- Poloniex Private Key Compromise (November 10, 2023): A major security breach resulted in approximately $130 million in cryptocurrency losses across multiple assets, including Ethereum, TRON, and Bitcoin. The attackers gained access to private keys, enabling unauthorized fund transfers.
- Mixin Network Database Attack (September 23, 2023): The largest crypto security breach of 2023, this attack led to estimated losses of $200 million. Attackers exploited vulnerabilities in Mixin's cloud infrastructure, obtaining private keys associated with deposit and hot wallet addresses.
- Cryptocurrency Phishing Scams (ongoing): Phishing scams, where users are tricked into revealing their private keys or seed phrases, remain a prevalent threat. Attackers often use fake websites or emails that mimic legitimate services, leading to theft of funds.
As illustrated
Figure undefined, private key compromises were the most costly attack vector, resulting in total losses of $880,892,924 across just 47 incidents. This accounted for nearly half of all financial losses in the crypto space in 2023. These incidents highlight the critical need for enhanced security measures, such as multi-signature wallets, hardware security modules, and account abstraction solutions, to mitigate the risks associated with EOAs.
Need for Account Abstraction
This section introduces an overview of account abstraction, a mechanism that combines the strengths of EOAs and CAs to address their limitations, enhancing flexibility and user experience in blockchain applications.
Account abstraction (AA) is a concept that combines the flexibility of CA and the user control of EOA. AA allows users to define how their accounts behave, how transactions are validated, and how gas fees are managed. It enhances user experience, security, and functionality in applications like smart contract wallets, social recovery mechanisms, and gasless transactions, making blockchain more accessible and secure for mainstream adoption.
Figure undefined illustrates the basic account abstraction structure. At its core, AA separates an account's identity (the public key and private key) from its logic. AA still maintains the user control through a key pair. However, the user's logic and state are managed on-chain by a contract account that is associated with the EOA instead of the key pair directly. For example, in the traditional EOA model, a wallet validates transactions at the protocol level using hardcoded rules, typically elliptic curve cryptography. With account abstraction, this validation logic is moved on-chain and becomes programmable. The mechanism eliminates EOA's single-point failure, ensuring the user's funds are safe when the private key is compromised through the implementation of recovery methods.
Account abstraction provides several advantages over traditional account models, particularly in the context of security, usability, and programmability. Developers can upgrade the logic of smart contract wallets to add new features or repair vulnerabilities, something that is not possible with fixed-function in EOAs. For example, a major limitation of EOAs is their inefficiency in executing multiple transactions. Each transaction must be signed and executed individually, leading to a slow user experience.
AA can improve this by allowing transaction batching. Instead of executing multiple transactions separately, AA allows users to bundle multiple operations into a single transaction. As shown in
Figure undefined, EOAs execute transactions sequentially, while
Figure undefined illustrates how AA bundles multiple transactions in one, reducing execution time and improving efficiency.
Additionally, AA allows gas fee flexibility. Unlike EOAs, which require users to pay transaction fees in the blockchain's native token, AA allows users to pay fees in alternative tokens defined by a paymaster contract. This mechanism automatically converts native assets into the required gas token, simplifying the payment process and enhancing accessibility for users.
AA eliminates the constraints of EOAs by integrating programmable security, flexible authentication, and enhanced transaction execution. By addressing key management risks, preventing fraudulent transactions, and optimizing user experience, AA provides a more secure and user-friendly framework for managing blockchain accounts. This innovation is crucial for improving the usability and adoption of blockchain applications while maintaining strong security guarantees.
AA introduces several recovery solutions based on smart contract, for example Smart Contract Recovery with Guardians and Guardian-less Smart Contract Recovery.
Smart Contract Recovery with Guardians: This method uses smart contracts and trusted guardians. Guardians cannot access funds, but can authorize an account recovery process. If a user generates a new key pair, guardians can approve an operation that transfers ownership to the new key. All user cases, from managing guardians to activating the recovery process, are controlled by smart contracts.
Guardian-less Smart Contract Recovery: This approach eliminates the need for external guardians by utilizing cryptographic techniques such as multi-signature schemes, zero-knowledge proofs, and secret sharing. These mechanisms enhance self-custody and account abstraction in decentralized systems.
An example of guardian-less recovery is Shamir's Secret Sharing, which can be combined with time locks or decentralized identity (DID) systems. In this method, the private key or recovery data is divided into multiple shares (e.g., split into 5 parts), with a required threshold (e.g., 3 parts) needed to recover the account. This enables secure and decentralized recovery without human involvement.
To implement AA without modifying the Ethereum consensus layer, ERC-4337 proposes a new account abstraction standard using user operations and a special smart contract called EntryPoint. ERC-4337 moves account logic off-chain and uses a bundler to submit transactions on behalf of users. ERC-4337 introduces several components:
- UserOperation: A signed data structure that represents an abstracted user transaction.
- Bundler: An off-chain node or actor that packages user operations and submits them to the blockchain.
- EntryPoint contract: A smart contract that verifies and executes user operations.
- Paymaster: A contract that sponsors gas fees or handles alternative payment mechanisms.
The technical details and architecture of ERC-4337 will be discussed in
Section undefined.
ERC-4337
This section provides an overview of ERC in common and ERC-4337 in practice. The section outlines the key components, including the UserOperation structure, the account contract, the EntryPoint contract, and the bundler.
In the Ethereum ecosystem, ERC stands for Ethereum Request for Comments. It is a technical standard used to define rules, protocols, and application-level interfaces for smart contracts and dApps deployed on the Ethereum blockchain. These standards are proposed and maintained through the Ethereum Improvement Proposal (EIP) process, and are driven by the community to evolve the Ethereum protocol and its ecosystem. Each ERC is assigned a unique number. Some of the most widely adopted ERCs include:
- ERC-20: A standard interface for fungible tokens, widely used in DeFi applications.
- ERC-721: The standard for non-fungible tokens (NFTs), enabling unique digital asset representation.
- ERC-1155: A multi-token standard supporting both fungible and non-fungible assets in a single contract.
ERC-4337
[undefined] is a token standard that supports account abstraction without changing the Ethereum consensus. Traditional proposals for account abstraction required adding new transaction types at the protocol level, for example, modifying how nodes handle accounts or signatures. ERC-4337 avoids this by defining a new object called a UserOperation, which is not a native Ethereum transaction, but a data structure handled by smart contracts and off-chain components.
Figure undefined illustrates the typical architecture of ERC-4337. Instead of submitting native transactions to the blockchain, users submit UserOperation objects to a mempool, which stands for memory pool, acting as a temporary storage for unspent UserOperations. The objects in the mempool are selected by a bundler and are aggregated into a single bundled transaction. This bundled transaction is then sent to a global smart contract known as the EntryPoint} contract, which processes and executes each UserOperation on the blockchain.
Figure undefined illustrates a standard ERC-4337 smart contract system, involving EntryPoint smart contract, user contract account, typically including AccountFactory contract for account management, and Paymaster contract or Aggregator contract as options. The Paymaster contract acts as a third party that sponsors gas fees for users. The Aggregator} contract implements multi-signature schemes, signature aggregation into account abstraction. In addition, because of the flexible property, the system can install extended smart contracts to enable functionalities that are required by developers and users.
UserOperation
A UserOperation is a new data structure that packages the user's intended actions. Unlike traditional Ethereum transactions, it is not sent directly to the network, but instead stored in a mempool. A UserOperation contains various fields that are different from traditional transactions. Some of the important fields of a UserOperation include the following:
- sender: The address of the account that will execute and validate the operation.
- nonce: A unique identifier to prevent replay attacks and ensure operation order.
- initCode: Initialization code for deploying a new smart account (if it does not yet exist). Empty if the account already exists.
- callData: The data specifying the function call and its arguments defines the actual operation the user wants to perform.
- signature: A cryptographic signature or other proof mechanism to validate the operation's authenticity.
- callGasLimit: The amount of gas that the sender is willing to spend for the main execution.
- verificationGasLimit: The amount of gas that the sender is willing to spend for the verification step.
EntryPoint
EntryPoint is a middle layer between bundlers and smart contract wallets. Its primary features are verification, execution, and gas calculation for UserOperation objects. The core interface of the EntryPoint contract is illustrated in the
Program undefined. Notably, the keyword UserOperation[] in line 3 denotes an array of UserOperation instances, each of which is processed by the EntryPoint during execution.
interface IEntryPoint {
function handleOps(
UserOperation[] calldata ops,
address payable beneficiary
) external;
function handleAggregatedOps(
UserOpsPerAggregator[] calldata opsPerAggregator,
address payable beneficiary
) external;
function simulateValidation(
UserOperation calldata userOp
) external;
}
The core interface of the entry point contract
EntryPoint has two significant methods, handleOps and handleAggregatedOps.
- handleOps processes a UserOperations batch that does not rely on signature aggregation. It follows a strict validation and execution workflow for each operation.
- handleAggregatedOps extends the logic of handleOps, allowing support for signature aggregators. This enables bundlers to process UserOperations from multiple users who share the same aggregator, improving scalability and reducing gas costs.
In a typical setting without a Paymaster, the handleOps method operates in two main phases: the verification loop and the execution loop.
For each UserOperation in the batch, the EntryPoint performs the following steps in the verification loop:
- Account deployment: If the account does not exist, it deploys the account using initCode parameter. If initCode is empty or the deployment fails, the operation must fail.
- Validation: The EntryPoint call method validateUserOp for each UserOperation. This method verifies the signature, nonce form, and pre-pays the required gas fees. If any call to validateUserOp fails, the corresponding UserOperation is skipped or reverted, depending on the bundler's architecture and the surrounding configuration.
After verification loop, the EntryPoint executes each valid UserOperation in the execution loop. The EntryPoint calls the account contract using the callData parameter provided in the UserOperation. Typically, the wallet includes an execute() function that decodes the data and carries out one or more internal calls accordingly.
Bundler
A bundler is a specialized node or actor in the ERC-4337 architecture that aggregates multiple UserOperations into a single transaction. Instead of submitting individual transactions to the blockchain network, the bundler groups several UserOperations into a batch and submits them as a single transaction. This batching mechanism reduces transaction costs, network congestion, and enables advanced account functionality beyond the limitations of EOAs.
The operation of a bundler typically consists of four stages: (1) monitoring UserOperations, (2) batching UserOperations, (3) submitting the batch to the EntryPoint contract, and (4) receiving incentives.
To monitor the UserOperation, the bundler uses a dedicated mempool, an off-chain queue specific to ERC-4337, to hold pending UserOperations. When a user submits a UserOperation, it is placed in this mempool, waits to be selected by the bundler. The ERC-4337 mempool operates off-chain and is intended to follow its own protocol rules.
Once the bundler detects valid UserOperations, it aggregates multiple operations into a single transaction. Normally, both before add a UserOperation to the mempool and before batching a single transaction, the bundler uses simulateValidation function of EntryPoint contract to validate UserOperation parameters and ensure UserOperation can be executed at the time it is validated.
When one of the predefined events occurs (typically defined by developers, such as when the number of UserOperations on mempool or the pending time is enough), the bundler will submit a batch of UserOperations into EntryPoint contract. EntryPoint will verify each UserOperation and execute them according to the specified logic in the user's contract account.
Bundlers are incentivized to perform this aggregation task by earning gas fees and potential additional rewards from the users whose operations they include in the batch. These fees are typically paid in ERC-20 tokens or other assets, depending on the account abstraction logic.
Privacy in Account Abstraction
This section outlines several implementations of privacy in account abstraction, which use zero-knowledge proofs. Based on that, this section discusses the current limitations of privacy in account abstraction. In conclusion, this section demonstrates solutions that are used in the context of the thesis to deal with some limitations
Account abstraction allows developers to implement custom logic, including ZKPs, so that it can enable various privacy-preserving solutions in blockchain systems, following by the below:
- Privacy-preserving transaction: In a traditional blockchain system, transaction details, including sender and receiver addresses, transferred amounts, and associated metadata, are public. It can compromise user privacy, exposing sensitive information. Using smart contracts and ZKPs, account abstraction can prove the validity of transactions without revealing transaction details.
- Private authentication: Fundamentally, the purpose of private authentication is to prove that a user is authorized without revealing which member of a group they are. For example, in a smart contract recovery with guardians, guardians' identities are typically stored on-chain, so they are public. It can disclose sensitive information about participants, cause privacy problems. To reduce this problem, account abstraction allows for the implementation of ZKP to prove that the guardian is eligible without knowing any guardian's identity.
- Anonymous voting: Account abstraction with ZKPs can support governance functions such as voting in decentralized autonomous organizations (DAOs). For example, users can preserve the privacy of their choices while ensuring that each vote is valid and unique.
- Payment system: Account abstraction with ZKPs can implement a payment system that verifies transactions without compromising privacy. It is useful in peer-to-peer payment systems, where privacy is important.
- Digital identity: Account abstraction with ZKPs enables users to prove their identity without revealing real information. For example, if a user wants to prove that the balance is enough but does not publish the real balance, the user can use ZKP to shield the real balance, preventing the leak of the balance information.
There are many real-world applications that use ZKPs to improve privacy and preservation. One of the fascinating applications is the Semaphore protocol
[undefined]. The protocol is a zero-knowledge protocol designed to enable users to prove membership in a group and send signals (such as votes or attestations) anonymously, without revealing their identity or linking their actions. The protocol presents identity as an EdDSA key pair and uses the hash of the public key as a commitment to enable a zk-SNARK protocol. Even though ZKPs enhance privacy significantly, there exist limitations that make it expensive and hard to implement in real-world applications, following by the below:
- On-chain verification cost: ZKPs are strongly based on complex mathematical operations, such as elliptic curve, polynomial, so that the verification process demands significant computational resources, which increases fees when executed on Ethereum or other EVM blockchains.
- Proof size and latency: Some ZKP protocols require a large proof for verification. A large proof can increase bandwidth and latency during transmission and verification.
- User experience and accessibility: Privacy-preserving account abstraction requires users to interact with advanced cryptographic tools such as ZK compilers, proof generators, which are often difficult to understand. Moreover, the risk of losing a ZK-based identity or failing to generate a valid proof may lead to transaction failure or loss of account access.
- Trusted setup: Some ZK schemes require a setup phase to generate public parameters. If this process is compromised, the privacy and soundness of the entire system may be at risk.
Considering two prominent ZKP protocols, zk-SNARK and zk-STARK, zk-SNARKs require a trusted setup, which can cause a potential vulnerability if the setup process is compromised. However, zk-SNARKs have the advantage of compact proof sizes, resulting in lower bandwidth usage and reduced verification latency. In contrast, zk-STARKs eliminate the need for a trusted setup, enhancing transparency and security, but they produce significantly large proofs. This increases bandwidth requirements and latency during transmission and verification.
In terms of the thesis, we will introduce two key contributions to enhancing privacy-preserving mechanisms in account abstraction using ZKPs and try to deal with the limitations of account abstraction:
- We process the evaluation and selection of efficient methods to interact with the ZKP environment. An evaluation was conducted to identify and select suitable methods that minimize proof size, gas consumption, and verification latency. This assessment is based on the following criteria: proof size, gas cost, verification time.
- To improve the accessibility and user experience of privacy-preserving features, a complete interface was developed to facilitate the generation and verification of guardian proofs. This interface abstracts the underlying cryptographic complexity and allows users to:
- Generate valid ZK proofs without interacting directly with low-level tools or libraries.
- Verify guardian authorizations securely and privately.
- Simplify the recovery process in smart wallets while preserving the anonymity of the guardian set.
DESIGNING THE WALLET ARCHITECTURE
In this chapter, we propose an account abstraction wallet design that implements a guardian mechanism as a recovery solution. The mechanism operates with a threshold system and a time delay to enhance security. Additionally, we integrate zero-knowledge proofs into this design to continuously improve its privacy.
Architectural Overview
Figure undefined illustrates the proposed architecture of the guardian-based recovery mechanism based on ERC-4337 with a zero-knowledge proof to improve privacy. Overall, users interact with the system through a user interface, which constructs UserOperations according to ERC-4337. The UserOperations is then sent to a bundler. The bundler stores UserOperations in the alternative mempool and uses internal services to batch, validate, and submit valid UserOperations to EntryPoint contract.
The architecture's on-chain system has four primary smart contracts: EntryPoint, AccountFactory, Account, and the ZKRecovery} smart contract. The EntryPoint contract is the central component for executing and verifying UserOperations on-chain. It performs two primary functions: verifying UserOperation and executing UserOperation (
Subsection undefined). Additionally, the system introduces ZKRecovery, a different component compared to the original ERC-4337 structure. The ZKRecovery smart contract enables all functionalities that are relevant to ZKPs in the system.
The system implements a privacy-preserving recovery mechanism that involves a group of n guardians, each holding a secret key pair. When owners want to change ownership, they notify their guardians. The guardians combine the notification with their key pairs to generate a credential, and then they submit it to ZKRecovery contract. ZKRecovery verifies the submitted credential using ZKPs. If the ZKGuardian collects enough valid proofs, it unlocks the ownership change function, allowing the owner, or any valid account, to fulfill the ownership transfer.
Guardian-based Account Abstraction Recovery Mechanism
This section explains the proposed guardian-based account abstraction recovery mechanism. It provides a detailed explanation of the complete workflow, including the initialization of guardians, modification of contract parameters, and the process of ownership recovery.
The proposal is based on the guardian mechanism, which allows trusted individuals or entities to assist users in regaining access to their accounts when necessary, providing a secure and decentralized approach to account recovery by implementing smart contracts. The proposal is divided into three processes:
- setup process: This process initializes the guardian configuration parameters.
- updating process: This process updates the guardian configuration parameters after setting up.
- change ownership process: this process supports the owner can change ownership.
Setup process
The setup stage occurs only the first time when the owner needs to initialize the guardian configuration parameters, which are listed in the Table~
ef{table:setup-configuration-parameters}. Only the owner can execute the setup stage, but unlike other transactions that are only executed by the owner, the setup stage does not have to wait for a delay; it is activated immediately after the owner executes it. In addition, the initial parameters must follow some characteristics:
- Threshold must be greater than 0 and less than or equal to the total number of guardians.
- Number of guardians must be less than or equal to the predefined constant maxGuardian in the smart contract.
- Each guardian must be distinct, and none can be the zero address.
Parameter | Type | Description |
---|
guardians | uint[] | The list of initial guardians. Instead of the list of addresses, guardians is a list of units because we store the hash of the guardians account address instead of the plain addresses (the feature will be demonstrated in more detail in Section undefined) |
threshold | uint256 | The minimum amount of guardian's confirmations to change ownership. |
expirePeriod | uint256 | Expire time, after this time, owners can't execute their queue transactions. The expiration time variable is the maximum time a queue transaction can be executed. |
delay | uint256 | Owners aren't allowed to execute queue transactions immediately, they must wait a delay time and execute it after instead. The delay variable is the minimum value that owners must wait for. |
Setup configuration parameters
According to
[undefined], only two out of three properties: usability, strong security, and high availability, can be achieved at the same time. In the context of a (t, n)-guardian mechanism, where t represents the threshold and n the number of guardians, we consider three possible configurations:
- Usability and availability (t=2, n=5): This setup is usable (as recovery requires only five guardians) and available (only two confirmations are needed for recovery). However, it lacks strong security because an attacker only needs to compromise two guardians to take control of the account.
- Security and usability (t=4, n=5): It is usable (recovery requires only five guardians) and secure (attacker must compromise four guardians to take control of the account). However, it may be unavailable because requiring four guardians to be ready at the same time is difficult.
- Security and availability (t=4, n=10): This setup provides both high security and availability, but it loses usability. Finding ten secure and reliable guardians can be impractical for most users.
Considering this trade-off, we define maxGuardian as a constant in the smart contract to balance usability, security, and availability effectively.
Updating process
Once the guardian parameters are configured, owners can change them. Similar to the initial setup phase, only the owner can execute these changes. However, transactions can be executed after a time delay. This delay gives the account owner an opportunity to detect and respond to any malicious activities before the transaction is executed. The updating process consists of two phases: queuing and execution ( including aborting), as illustrated in
Figure undefined.
Queuing is the process of packing the owner's transaction data into an OwnerTransaction (details in
Table undefined). Queuing process assigns executedType value as 0, and pushes it to a list of OwnerTransactions. The variable eta of each OwnerTransaction defines the nearest time in the future when the owner can execute their transaction. It must be greater than or equal to the current time plus the delay defined in the setup process.
Variable | Type | Description |
---|
value | uint256 | Value of token sent with a transaction. |
data | bytes | Transaction's callData. |
eta | uint256 | The closest time the owner can execute his transaction. |
executedType | uint8 | Executed transaction status. 0 - queue status, the transaction is pending to execute; 1 - success; 2 - fail; 3 - cancel. |
_type | uint8 | Transaction type. 0 - add a guardian; 1 - remove a guardian; 2 - set threshold. |
Variables of OwnerTransaction
Execution is the phase where owners execute their transactions and save changes to the smart contract. If an owner chooses to cancel a transaction, the executedType of the OwnerTransaction is set to 3 (indicating canceled), preventing further execution of that transaction. For other cases, depending on the execution result, the executedType can be updated to 1 (success) or 2 (failure).
Transactions can not be executed until the time delay has expired. Once this delay has expired, owners have a period defined by the expirePeriod (set during the initial setup phase) to execute their transaction. The combination of the delay, expirePeriod, and eta parameters creates a flexible mechanism for managing time delays in owner transactions. The relationship between the three parameters is illustrated in
Figure undefined.
In
Figure undefined, the green period indicates the time when the owner can execute the transaction. The yellow period is the waiting period, and the gray period represents the expired period, after which the transaction can no longer be executed.
Change ownership process
The final action supported by the guardian mechanism is the change of ownership, as illustrated in
Figure undefined. This process is divided into three steps:
- The owner submits a new owner address. The step is only executed by the owner.
- The guardians generate their zero-knowledge proofs and submit their proofs to the smart contract system.
- Once the required number of valid proofs from guardians is collected, the smart contract system unlocks a special transaction to change ownership. It is important to note that at this stage, anyone can execute the transaction, as all validations and verifications have already been completed in the previous steps. The transaction simply updates the owner to the new address designated by the old owner in Step 1.
Because it is a sensitive process, it is irreversible and blocks all other actions until they are completed.
If the current owner notices that their ownership may have been compromised, the owner can initiate the ownership transfer by submitting a new owner address, stored temporarily on-chain in the ZKRecovery smart contract. The new owner's address must satisfy the following conditions:
- It must not be zero address.
- The new owner's address must be different from the current owner's address.
- The account address calculated from the new owner address by the account factory smart contract is an undeployed address.
The first and second conditions ensure the validity of the new owner's address, and the third condition makes sure that the new owner's address is unique and available.
Algorithm undefined illustrates the logic behind the submitNewOwner function.
Submitting a new owner address does not automatically change ownership. Instead, it is a notice to the guardians. Traditionally, each guardian signs a message, including the new owner's address, and submits it to the smart contract. Once the threshold is reached, the smart contract verifies all signatures and processes the transfer of ownership. The traditional approach is easy to implement, but it has several drawbacks
- If any guardian provides an invalid signature, all guardians may have to sign again, or the batch signature must be recalculated, reducing reliability.
- To verify signatures on-chain, the smart contract must store guardian addresses in plain form to compare with the address in the signature, which risks leaking sensitive information.
The proposed design uses ZKPs to overcome the limitations of the traditional approach. The smart contract stores the hash of each guardian's address instead of the plaintext address. Each guardian independently creates and submits their proof on-chain. The proof creation and verification process (referred to as the confirm change owner process, represented by the green square in
Figure undefined is discussed in detail in
Section undefined. The smart contract verifies each proof and records its validity. Once the number of valid confirmations reaches the required threshold, the smart contract unlocks the ownership change function.
Zero-Knowledge-Based Guardian Mechanism
In this section, we describe how ZKPs are implemented in our architecture and the reason behind several key design decisions.
As discussed in
Subsection undefined, storing plain guardian addresses on-chain is insecure. To eliminate this, we store only the hashed form of each guardian's address. However, verifying a guardian's authorization by comparing a submitted hash with a stored hash is not sufficient because everyone has access to the guardian's address, and they can compute the hash of the guardian's address. Even if they are equal, we cannot be certain that the sender actually controls the corresponding guardian account.
Figure undefined illustrates the overall confirm change owner process. The process has two primary phases:
- in the off-chain phase, a valid guardian signs a message and uses the signature to produce a proof.
- in the on-chain phase, the proof is verified, and if it is valid, the change owner process will be run.
To ensure the verification does not reveal any information about the guardians, the process is implemented through ZKPs (the dashed rectangle in
Figure undefined). By using ZKPs, the on-chain phase only needs to verify the proof, that is not reveal data about guardians.
The proof must include the guardian's address. This requirement exists for two reasons. First, the smart contract must compare the hash from the submitted proof to the hashes it stores to ensure that the guardian is an authorized guardian. Since the ZKP protocol does not have access to the list of hashes stored in the smart contract, the hash must be submitted to the contract. Second, the guardian's address should not be submitted directly to the smart contract without going through the ZKP protocol. If a guardian's address is compromised, an attacker could submit the guardian's address hash along with their own signature, which would be a valid signature but from an invalid guardian, to the smart contract. Based on the above argument, the proposed ZKP protocol must have three characteristics:
- It receives the signature and the guardian public key as the inputs.
- It verifies the signature to ensure that the guardian is the owner of the valid key pair.
- It hashes the guardian public key and returns it as public output to the smart contract can perform the comparison process.
The proposed ZKP protocol must perform two massive operations: (1) verifying the guardian's signature and (2) hashing the guardian's address. Inefficient cryptography can significantly reduce performance, so selecting the right components is critical. In particular, we faced two major design challenges:
- Choosing a sufficient hash function.
- Choosing a sufficient curve signature algorithm.
Choosing hash function and curve signature algorithm
ZK circuits are fundamentally built on addition and multiplication operations over finite fields, so it has many steps that depend on arithmetic computations. Therefore, the proposed hash function must simplify circuit construction, minimizing the number of constraints and the amount of computation burden in R1CS and QAP, as well as during the proof generation and verification processes.
To measure circuit efficiency, we used the snarkjs library
[undefined] to calculate the number of non-linear constraints, linear constraints, wires, labels, witness size, and constraint size. We also measured the time taken to generate and verify the proof.
We evaluate several hash functions: SHA256, Keccak256, pedersen, poseidon
[undefined], and poseidon2. We use the implementations of circomlib
[undefined] for SHA256, poseidon and pedersen, and hash-circuits
[undefined] for Keccak256 and poseidon2. All code is available in our open-source repository
[undefined].
Table undefined shows the result.
Hash function | SHA256 | Keccak256 | Pedersen | Poseidon | Poseidon2 |
non-linear constraints | 29412 | 145408 | 3124 | 216 | 480 |
linear constraints | 1852 | 17046 | 132 | 199 | 552 |
wires | 31209 | 155031 | 3513 | 417 | 1034 |
labels | 205033 | 654273 | 8129 | 583 | 1842 |
witness size | 975.36KB | 4.73MB | 109.86KB | 13.11KB | 32.39KB |
constraint size | 6.65MB | 27.81MB | 673.53KB | 51.96KB | 142.70KB |
generate proof time (ms) | 832.63 | 4882.06 | 269.72 | 124.31 | 164.19 |
verification time (ms) | 10.63 | 12.8 | 11.16 | 10.85 | 10.84 |
Information of some hash function's circuits
SHA256 and Keccak256, which are built on bitwise logic, require a significantly larger number of constraints, especially non-linear constraints, to be represented in a ZK circuit. In contrast, Pedersen, Poseidon, and Poseidon2 are designed with finite field arithmetic in mind and only require hundreds of constraints, leading to significantly better performance.
A suitable hash function for ZK circuits should rely as much as possible on arithmetic operations (addition and multiplication), avoiding bitwise and modular operations. This reduces the circuit's complexity and improves the performance of R1CS and QAP, directly impacting proof generation and verification times.
Similarly, choosing a curve signature algorithm must follow the same rule: minimizing bitwise and modular operations and ensuring compatibility with field arithmetic. However, the choice of curve can also depend on system-specific requirements. For instance, if guardians are required to use ECDSA for other parts of the system, it may be suitable despite its inefficiency in ZK circuits.
Curve signature | ECDSA | BabyJubJub |
non-linear constraints | 1508922 | 19095 |
linear constraints | 131701 | 615 |
wires | 1632054 | 20713 |
labels | 2129808 | 52949 |
witness size | 52.23MB | 647.36KB |
constraint size | 294.52MB | 3.90MB |
generate proof time (ms) | 44145.32 | 2098.61 |
verification time (ms) | 998.12 | 11.32 |
Information of ECDSA and EdDSA circuit
Table undefined compares the performance of ECDSA and BabyJubJub (EdDSA). ECDSA requires over a million constraints, and proof generation time is over 44 seconds, while EdDSA needs only tens of thousands of constraints and about 2 seconds to generate a proof. Unless there are specific requirements for ECDSA, EdDSA is a more efficient choice.
Based on the evaluation and the efficient design for the ZK protocol, we selected Poseidon as the hash function and BabyJubJub as the curve signature algorithm for our implementation.
The proposed confirm change owner process
In
Section undefined, we discussed the guardian mechanism. In this section, we explain the latest process from the previous section: the confirming change owner process. This proposed process is divided into two sub-processes
- Creation proof process: This occurs off-chain, where guardians generate their proof and submit it to the smart contract.
- Verification proof process: The smart contract validates the guardian's proof, and when all requirements are met, the system unlocks the change-owner transaction.
Figure undefined illustrates the creation proof and the verification proof processes. Normally, both Poseidon hash function and EdDSA do not require a fixed-size message as input. However, since circuits are static and do not support variable-length inputs, a fixed-size message is required. In this thesis, we define the fixed size to be 256 bits. Therefore, the proof creation process uses a fixed-size combination of increment and _tempNewOwner as input. In detail, the 256-bit message consists of two parts:
- The first 64-bit is padded increment, which is extended to 64 bits by adding zeros in front of it.
- The remaining 192 bits are padded _tempNewOwner, likely to increment, _tempNewOwner is padded to 192 bits by adding zeros in front of it.
This fixed-size message is then signed using EdDSA. Next, the proof generator takes the signature and the public key as inputs to create a zk-SNARK proof. All of this can happen off-chain. While anyone, including non-guardians, can generate a proof, only proofs created by guardians are accepted based on zk-SNARK protocol. In this setup, guardians act as provers attempting to convince the verifier, which is a smart contract.
In the first stage, firstly, the process checks whether there is enough confirmation or not; if they are enough, every following step will be stopped. Secondly, the smart contract verifies that the submitted proof belongs to a guardian and confirms that the signed message matches the current increment. Since the circuit was designed to output (or can be called public signals) the account address hash, the _tempNewOwner and the increment, this stage simply compares the proof's address hash with each guardian's hash stored in the smart contract, as well as the proof's increment and proof's _tempNewOwner with the current increment and current _tempNewOwner stored in the smart contract respectively. This stage acts as a barrier to block proofs submitted by non-guardians. Only the proof that comes from a guardian will be executed.
Before executing the main verification (illustrated in
Algorithm undefined), the system first checks if the proof has already been submitted. If it has, the verification is skipped to reduce the amount of computations. Otherwise, the system verifies the zk-SNARK proof using the constraints defined in the circuit. If the proof is valid, the number of confirmations is updated.
Algorithm undefined illustrates the basic circuit's logic. It receives four inputs: the 256-bit message msg, the plain public key A, and the EdDSA signature components R8 and S}. It returns three outputs: the Poseidon hash of the public key hashPublicKey, the increment, and the address (new owner address) derived from the message.
To conclude, the proposed confirm change owner process follows a non-interactive zero-knowledge proof protocol, in which guardians serve as provers and the smart contract acts as verifier. Guardians generate their proofs off-chain and submit them to the smart contract. The smart contract then validates these proofs and determines whether the submitting guardian is authorized. This approach ensures a secure and efficient verification process without revealing any sensitive information.
CONCLUSION AND FUTURE WORK
This thesis has demonstrated several problems with the current account model, EOA, and CA, how the problems can be addressed by account abstraction, and proposed an approach to secure and privacy-preserving wallet recovery by guardian-based recovery and zero-knowledge proof in the context of account abstraction wallet. Traditional social recovery, while effective, may expose potential vulnerabilities. By leveraging zero-knowledge proof, this research demonstrates how users can prove ownership to recover their assets without revealing sensitive information, ensuring a robust balance between usability, privacy, and security.
The proposed wallet focuses on storing hashes of the guardians' addresses on-chain, rather than storing the plain-text addresses directly. To verify that a guardian is valid, we use zero-knowledge proofs. Each guardian generates a proof using a ZKP, which is then submitted to the smart contract system to verify that the guardian is authorized. Once the smart contract collects enough valid proofs, it unlocks a special transaction to change ownership. At this point, the transaction can be executed by anyone, as all verifications have already been completed. Additionally, we also provide evaluations to select the hash function and elliptic curve algorithm that are friendly in the zero-knowledge circuit and suitable for the application requirements. In this thesis, we use the Poseidon hash function and the BabyJubJub elliptic curve to implement and evaluate our system.
However, the proposed wallet still has several drawbacks. A significant issue is in the change owner process (
Subsection undefined), the transaction of submission of the new owner address can only be performed by the current owner. However, if the current owner lost her/his private key and is unable to sign the submission transaction, so the current mechanism does not work. As a result, the current mechanism only works in situations that the owner still controls her/his account, such as in cases of key compromise or leakage to a hacker. The proposed solution is to remove this restriction, allowing anyone to submit the new owner address. This solution is based on the assumption that guardians are trusted and will only participate in the change owner process if they are confident that the authorized owner initiated the request.
The proposed architecture has much potential for improvement and development. The future works will focus on fixing existing problems and improving the gas cost and the time a transaction takes to execute. We will implement some novel features, such as paymaster, maximum amount of special transactions, or delay time after a massive transaction. Moreover, we will use zero-knowledge proof more extensively in the architecture. For example, in the current design, zero-knowledge proof is used to hide guardian addresses, but in the future version, zero-knowledge proof can be used to hide transaction parameters, such as amount, token address, and receive address.
References
Satoshi Nakamoto, "Bitcoin: A Peer-to-Peer Electronic Cash System," Decentralized Business Review, 2008. [Online]. Available: https://bitcoin.org/bitcoin.pdf.
Oleksandr Kuznetsov, Alex Rusnak, Anton Yezhov, Kateryna Kuznetsova, Dzianis Kanonik, Oleksandr Domin, "Merkle trees in blockchain: A Study of collision probability and security implications," Internet of Things, 2024. DOI: https://doi.org/10.1016/j.iot.2024.101193.
Vitalik Buterin, Yoav Weiss, Dror Tirosh, Shahaf Nacson, Alex Forshtat, Kristof Gazso, Tjaden Hess, "ERC-4337: Account Abstraction Using Alt Mempool," 2021-09-29. [Online]. Available: https://eips.ethereum.org/EIPS/eip-4337.
Panagiotis Chatzigiannis, Konstantinos Chalkias, Aniket Kate, Easwar Vivek Mangipudi, Mohsen Minaei, Mainack Mondal, "SoK: Web3 Recovery Mechanisms," Cryptology {ePrint} Archive, Paper 2023/1575, 2023. [Online]. Available: https://eprint.iacr.org/2023/1575.
Lorenzo Grassi, Dmitry Khovratovich, Christian Rechberger, Arnab Roy, Markus Schofnegger, "POSEIDON: A New Hash Function for Zero-Knowledge Proof Systems," . [Online]. Available: https://eprint.iacr.org/2019/458.pdf.
Sam Blackshear, Konstantinos Chalkias, Panagiotis Chatzigiannis, Riyaz Faizullabhoy, Irakliy Khaburzaniya, Eleftherios Kokoris Kogias, Joshua Lind, David Wong, and Tim Zakian, "Reactive Key-Loss Protection in Blockchains," Lecture Notes in Computer Science Financial Cryptography and Data Security. FC 2021 International Workshops, 2021, p. 431-450, .