elliptic-curve
zero-knowledge
account-abstraction

Table of Content

List of Figures

List of Figures

LIST OF ABBREVIATIONS

AbbreviationFull Expression
CAsContract accounts
dAppsDecentralized applications
ECDSAElliptic Curve Digital Signature Algorithm
EdDSAEdwards-curve Digital Signature Algorithm
EOAsExternally Owned Accounts
EVMEthereum Virtual Machine
HHHomomorphic hiding
MPCMulti-Party Computation
PoSProof of stake
PoWProof of work
QAPQuadratic arithmetic program
R1CSRank 1 Constraint System
RPCRemote Procedure Call
UserOpUser Operation
ZKPsZero knowledge proofs
zk-SNARKZero-Knowledge Succinct Non-Interactive Argument of Knowledge

Account Abstraction Wallet with Social Recovery based on Zero-Knowledge Proof

Acknowledgement

First, I would like to express my deepest gratitude to my supervisor, Dr. Trần Vĩnh Đức, at the School of Information and Technology, Hanoi University of Science and Technology, who gave me invaluable guidance and support throughout this thesis.
Special thanks to my friends and colleagues, who generously shared their knowledge and discussions during the development of this project. Your input and support were crucial in overcoming challenges and refining key ideas.
Thank you all.

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.
blockchain-structure
Blockchain structure
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.
utxo-model
UTXO 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.
eoa-structure
Structure of Externally owned account
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.
contract-account-structure
Structure of Contract account
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.
smart-contract-structure
Structure of Smart contract
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 undefined
ZKP 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.
izk-interaction
The interaction between prover and verifier in an interactive zero-knowledge proof protocol
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.
zk-overview
The interaction between prover and verifier in a non-interactive zero-knowledge proof protocol
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.
bitcoin-supply
Bitcoin supply (in million Bitcoin [undefined])
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.
hacking
Incident count and number of attacks in 2023
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.
account-abstraction-structure
Structure of Account abstraction
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.
multicall
Execute transaction by EOA
multicall1
Multicall by account abstraction
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.
erc-4337
The architecture of ERC-4337
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.
erc4337-smart-contract
ERC-4337 smart contract system
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

common-architecture
Overview architecture of the proposed system
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.
ParameterTypeDescription

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

the-updating-process
The 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

valueuint256Value of token sent with a transaction.
databytesTransaction's callData.
etauint256The closest time the owner can execute his transaction.
executedTypeuint8Executed transaction status. 0 - queue status, the transaction is pending to execute; 1 - success; 2 - fail; 3 - cancel.
_typeuint8Transaction 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.
relation-time-delay
The relation between delay, expirePeriod and eta.
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-change-ownership-process
The 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.

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.
overall-confirm-change-owner-process
Overall confirm change owner process.
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.
xor-circuit
XOR circuit.
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

SHA256Keccak256PedersenPoseidonPoseidon2

non-linear constraints

294121454083124216480

linear constraints

185217046132199552

wires

3120915503135134171034

labels

20503365427381295831842

witness size

975.36KB4.73MB109.86KB13.11KB32.39KB

constraint size

6.65MB27.81MB673.53KB51.96KB142.70KB

generate proof time (ms)

832.634882.06269.72124.31164.19

verification time (ms)

10.6312.811.1610.8510.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

ECDSABabyJubJub

non-linear constraints

150892219095

linear constraints

131701615

wires

163205420713

labels

212980852949

witness size

52.23MB647.36KB

constraint size

294.52MB3.90MB

generate proof time (ms)

44145.322098.61

verification time (ms)

998.1211.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.
creation-and-verification-proof-process
Creation and verification proof processes
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.

Generate proof

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.

The first stage

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.

The second stage

The common proposed circom logic

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.

IMPLEMENTATION AND EVALUATION

This section discusses the implementation and evaluation of our system. For the implementation, we design and build a zk-SNARK circuit that encapsulates all necessary logic. We also deploy a bundler and develop a user interface where guardians and users can easily create and interact with their accounts and EdDSA key pairs.
We have published the source code of the webpage, bundler, circuit, and smart contract under the MIT license. Specifically, smart contract (including circuit), webpage, and bundler can be found in [undefined], [undefined], and [undefined], respectively.

Implementation

Circuit Implementation

We use circomlib [undefined], a library that provides a collection of cryptographic circuits and helper functions specifically designed for use with zk-SNARKs and zk-STARKs, as a tool to build our circuit.
The circuit has four inputs: msg, A, R8, and S, representing the fixed-size message, the public key, and the $R$ and $S$ components of the EdDSA signature, respectively. It produces three outputs: hashPublicKey, increment, and address. These correspond to the hashed guardian account address, the increment value, and the new owner address extracted from the 256-bit message signed by the guardian.
To implement the signature verification and hash computation, we use EdDSAVerifier and Poseidon provided by circomlib, as illustrated in Program undefined.

signal input msg[256];

signal input A[256];
signal input R8[256];
signal input S[256];

signal output hashPublicKey;
signal output increment;
signal output address;

// calculate guardian's address hash
component bitAToNum = Bits2Num(256);
component poseidon = Poseidon(1);

bitAToNum.in <== A;
poseidon.inputs[0] <== bitAToNum.out;
hashPublicKey <== poseidon.out;

// verify the signature
component verifier = EdDSAVerifier(256);
verifier.msg <== msg;
verifier.A <== A;
verifier.R8 <== R8;
verifier.S <== S;

// calculate increment and new owner address
calculationMessage.input <== msg;
increment <== calculationMessage.increment;
address <== calculationMessage.address;

The common structure of guardian circuit

To compile and integrate the circuit with a smart contract, we use circom and snarkjs [undefined]. First, the circuit is compiled into a WebAssembly file (.wasm) and a constraint file (.r1cs). The witness-calculator program uses secret data, containing the input file and WebAssembly, to generate a witness. The snarkjs tool compiles the constraints and witnesses to a Solidity file, enabling smart contracts to validate ZKPs (as illustrated in Figure undefined). The compilation and integration process are discussed in more detail in Section undefined.
architecture-circom-and-snarkjs
Architecture for generating and verifying proof using Circom and snarkjs.

Smart Contract Implementation

Our smart contract system is based on the Eth infinitism account abstraction architecture [undefined]. While the original architecture focuses on account abstraction, we extend it by introducing a zero-knowledge-based recovery mechanism.
Specifically, we modify the architecture in several elements. First, we implement a key-value store to map each owner address to its corresponding account address. Additionally, we override the original getAddress function to return the exact account address, instead of relying on the deterministic address returned by CREATE2 (as shown in Program undefined).

interface IAccountFactory {
    mapping(address => address) public owners;
    
    function createAccount(
        address owner, uint256 salt
    ) external returns (BaseAccount ret);
    
    function getAddress(
        address owner, 
        uint256 salt
    ) external view returns (address);

    function changeOwner(
        BaseAccount _account, 
        address _newOwner
    ) external;
}

The modified interface of AccountFactory

getAddress function

The getAddress function (Algorithm undefined) currently gets the account address by CREATE2 unless its owner address is not in mapping owners. Moreover, we create changeOwner function, this function will modify a mapping in owners when it is called by the guardian's smart contract.
Furthermore, we enhance the Account smart contract so it can deploy its associated Guardian contract. In practical applications, deploying a guardian contract requires an external deployer. It is a reasonable and secure design choice to allow the account itself to act as this deployer. The structure of Account smart contract is illustrated in Program undefined

contract Account is BaseAccount {
    address public owner;
    address public accountGuardian;

    modifier onlyAccountGuardian() {
        require(accountGuardian != address(0), 
        'guardian not setup yet');
        require(msg.sender == accountGuardian, 
        'only guardian manager');
    }

    function changeOwner(
    AccountFactory _accountFactory,
    address _newOwner
      ) public onlyAccountGuardian {
        require(_newOwner != owner && _newOwner != address(0), 'invalid newOwner');
        _accountFactory.changeOwner(this, _newOwner);
        owner = _newOwner;
      }

    function setUpGuardian(address _accountGuardian) public onlyOwner {
        require(accountGuardian == address(0), 'accountGuardian has been setup');
        accountGuardian = _accountGuardian;
        emit GuardianInitialized(_accountGuardian);
    }

    function deployGuardian(bytes32 _salt) public onlyOwner {
        ZKGuardian manager = (new ZKGuardian){salt: _salt}();
        manager.initialize(this);
        setUpGuardian(address(manager));
      }
}

The Account smart contract core


modifier isPublicSignalCorrect(uint _guardian, uint256 _increment, uint256 _hash);
        
    function isEnoughConfirm() public view returns (bool);
    
    function submitNewOwner(
        address _newOwner,
        AccountFactory accountFactory,
        uint256 salt
    ) public onlyOwner

    function confirmChangeOwner(
        uint[2] calldata _pA, 
        uint[2][2] calldata _pB, 
        uint[2] calldata _pC, 
        uint[3] calldata _pubSignals
    ) external payable isPublicSignalCorrect(
        _pubSignals[0], 
        _pubSignals[1], 
        _pubSignals[2]);

    function changeOwner(AccountFactory accountFactory) public payable;

    function setupGuardians(
        uint[] memory _guardians,
        uint256 _threshold,
        uint256 _expirePeriod,
        uint256 _delay
    ) public onlyOwner;

    function setThreshold(uint256 _threshold) external onlyOwner;
    function addGuardian(uint _guardian) external onlyOwner;
    function removeGuardian(uint _guardian) external onlyOwner;
}

The ZKGuardian smart contract core

The ZKGuardian smart contract (as shown in Program undefined) provides the core logic for the recovery process. Its interface includes functions for submitting and confirming a new owner address via a zk-SNARK proof, as well as for managing the guardian set. The verification of proofs uses public signals to ensure that only valid, authorized requests are accepted. The contract supports guardian setup, threshold configuration, and dynamic management of the guardian list.
All contracts are implemented in Solidity and deployed on the Binance Smart Chain Testnet. Table undefined illustrates the deployed contract addresses used in our implementation.
EntryPoint0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789
AccountFactory0x6320A83b3Ad58a58AfDC898320914EB282100AD6

Deployed contracts' address on BSC Testnet

Bundler Implementation

The Bundler service is based on the Eth infinitism bundler [undefined]. In the scope of this thesis, the bundler is implemented following the JSON-RPC model. The bundler supports two types of methods:
  • User methods, prefixed with eth_, are used by users directly.
  • Debug methods, prefixed with debug_, are primarily for development and maintenance purposes, used by bundler operators or developers.
Table undefined lists the currently supported methods provided by our bundler implementation.
MethodDescription
eth_chainIdReturn network chainId.
eth_supportedEntryPointsReturn a list of the EntryPoint addresses supported by the bundler.
eth_sendUserOperationAdd a UserOp to the mempool.
eth_estimateUserOperationGasEstimates the gas values for a UserOp. Given a UserOp, which may not specify gas limits and gas prices, this function returns the necessary gas limits. The wallet ignores the signature field, so the operation does not need the user's approval.
eth_getUserOperationReceiptReturn a UserOp receipt based on a userOpHash returned by eth_sendUserOperation.
eth_getUserOperationByHashReturn a UserOp response based on a userOpHash returned by eth_sendUserOperation.
web3_clientVersionReturn bundler's version.
debug_bundler_clearStateClears the bundler mempool and reputation data.
debug_bundler_dumpMempoolDump the current UserOps mempool.
debug_bundler_clearMempoolClear mempool's state.
debug_bundler_setReputationSets reputation of given addresses.
debug_bundler_dumpReputationReturns the reputation data of all observed addresses.
debug_bundler_clearReputationClear reputation's state.
debug_bundler_setBundlingModeSets bundling mode. After setting mode to “manual”, an explicit call to debug_bundler_sendBundleNow is required to send a bundle.
debug_bundler_setBundleIntervalChange bundler's interval.
debug_bundler_sendBundleNowForces the bundler to build and execute a bundle from the mempool as handleOps() transaction.
debug_bundler_getStakeStatusReturn stake information.

Bundler supported methods

Comparison with Existing Architectures

This section discusses and compares the differences between the proposed architecture and several existing architectures. In detail, we will compare with (we overview the existing architectures in appendix Appendix undefined).
  • KELP: a guardian-less smart contract recovery solution. KELP is based on smart contracts without the need for external guardians.
  • OKX wallet: an MPC wallet, which divides the private key into three shares to improve tolerance.
  • Soul wallet: an ERC-4337 smart contract wallet with guardian-based recovery but not ZKP implementation.
  • Clave wallet: an ERC-4337 smart contract wallet with guardian-based recovery and ZKP, but using email accounts as guardians instead of web3 accounts.
We refer [undefined] to propose six criteria: (1) Proactive vs. Reactive, (2) Account recovery vs. Fund recovery, (3) Standard wallet accounts vs. Smart contract accounts, (4) Recovery using guardians, (5) Multi-key recovery, (6) Key-custody. Moreover, we propose one more criterion: (7) Zero-knowledge proof.
  • (1) Proactive vs. Reactive: Proactive approaches require users to take initial actions to enable recovery, such as off-chain backups. In contrast, reactive approaches do not require any initial action from users. Instead, these systems are designed to provide recovery with a minimal initial system setup to configure the recovery solution.
  • (2) Account recovery vs. Fund recovery: Account recovery aims to protect and restore the key pair associated with a user's funds, enabling the recovery of assets linked to that key pair. In contrast, fund recovery focuses on retrieving funds, such as key rotation. In key rotation, the old key must be disabled, and any future actions tied to the old key should be revoked.
  • (3) Standard accounts vs. Contract accounts
  • (4) Recovery using guardians
  • (5) Multi-key recovery: In MPC, multi-signature or threshold signature wallets, transactions require multiple keys instead of one. If a single key is lost, the remaining keys can be used to recover or replace it.
  • (6) Key-custody: Referring [undefined], we divide wallets into three types: custodial, non-custodial, and self-custodial. A custodial wallet is managed entirely by a third party, which holds the user's private keys and can restrict access or freeze funds. A non-custodial wallet splits control between the user and a service provider, allowing shared signing. In contrast, a self-custodial wallet gives the user full control of their private keys, with no external party able to block or modify actions.
  • (7) Zero-knowledge proof: In the context of wallet recovery, ZKPs can be used to improve privacy guarantees and enhance the trustworthiness of decentralized recovery systems.
CriteriaKELPOKX walletSoul walletClave walletProposed wallet
ActionReactiveProactiveReactiveReactiveReactive
Recovery Type FundAccountFundFundFund
Account TypeContractStandardContractContractContract
GuardianNoNoYesYesYes
Multiple-keyNoYesNoNoNo
CustodySelf-custodialNon-custodialSelf-custodialSelf-custodialSelf-custodial
ZKPNoNoNoYesYes

Comparison between proposed architecture and existing wallet architectures

Table undefined presents the differences between the proposed wallet and existing solutions based on seven criteria. As shown in the table, five solutions represent different recovery methods. KELP is a guardian-less smart contract wallet, based on smart contracts without guardians. Soul wallet, Clave wallet, and the proposed wallet are guardian-based ERC-4337 wallets, though each differs in several aspects. In the remainder of the section, we will discuss in more detail the differences between the proposed wallet and others.

KELP vs. the proposed wallet

KELP is a smart contract-based framework that enables on-chain recovery of lost keys without relying on off-chain backups or on-chain guardians. KELP employs a three-phase protocol, consisting of Commit, Reveal, and Claim, to initiate a recovery. During this process, the original owner can cancel the request if it seems malicious. Designed to be fully decentralized and transparent, KELP is a lightweight, secure alternative for account recovery in blockchain systems.
KELP represents a guardian-less smart contract recovery solution that is entirely implemented on-chain. Unlike guardian-based systems, KELP does not rely on third-party approvals or off-chain backup. Its main advantage over the proposed wallet is that it is simple and easy to implement. However, because KELP is based on a time-delay mechanism to prevent unauthorized recovery, it typically requires a longer delay period than guardian-based systems to maintain equivalent security, which may reduce responsiveness in urgent recovery scenarios.

OKX wallet vs. the proposed wallet

OKX is an MPC wallet. An MPC wallet splits the private key into multiple secret shares stored across different devices or parties. Unlike traditional wallets, the full private key is never reconstructed at any point. when a user signs a transaction, the involved parties collaborate through cryptographic computation to produce a valid signature, without exposing or combining their individual key shares.
MPC recovery intends to recover the ability to sign. For example, a user has an OKX wallet with three key shares: $A$, $B$, and $C$ stored in the user's device, OKX's server, and cloud storage. The user loses the phone that keeps the key share $A$. By using MPC recovery, the user can generate a new key share in the new device, so recover the ability to sign. The intention is also the biggest difference between the OKX wallet and the proposed wallet. While the proposed wallet is a fund recovery type, it switches the user's funds from the compromised key pair to the new secure key pair.
The key difference is the reliance on OKX's centralized server to verify and generate a new key share. The proposed wallet minimizes the risks by decentralizing the recovery logic: decentralized guardians must generate a zero-knowledge proof by themselves and submit it to the smart contract system.

Soul wallet vs. the proposed wallet

Soul Wallet is a guardian-based ERC-4337 wallet that uses Web3 accounts as guardians. Similar to the proposed wallet in this thesis, guardians in Soul Wallet only participate when the owner initiates a change to a new address. Both wallets adopt a delayed execution mechanism, meaning that actions such as adding or removing a guardian are not performed immediately but instead require a predefined waiting period.
However, in Soul Wallet, the guardian addresses are stored in the smart contract in a hashed form (using the Keccak256 hash function) and are only revealed during the ownership change process. In contrast, the proposed wallet uses ZKP to verify guardians without ever revealing their identities on-chain, thereby enhancing privacy.
common-recovery-process
Common recovery process used by Soul wallet and the proposed wallet
Figure undefined shows the common recovery process used by Soul wallet and the proposed wallet. Both wallets divide the recovery process into three steps, with several differences:
  • Submit new owner: A transaction is executed to store the new address in the smart contract. In Soul wallet, the transaction can be executed by anyone instead of only by the owner in the proposed wallet.
  • Confirm change owner: In both Soul Wallet and the proposed wallet, guardians perform the recovery process by submitting proof or a signature. Specifically, in the proposed wallet, guardians submit zero-knowledge proofs, whereas in Soul Wallet, they provide signatures. Once the threshold is met, both wallets unlock a function that allows the owner address to be changed.
    An important difference is how guardian identities are handled during this process. In Soul Wallet, guardians must reveal their raw addresses (as shown in Program Program undefined, where the rawGuardian parameter and signature are used to verify their identity). This approach exposes guardian information on-chain, which can potentially be linked to the owner through external analysis. In contrast, the proposed wallet hides guardian identities by using ZKP, ensuring that guardian identities remain hidden even during the recovery process.
  • Change owner: In both wallets, the transaction to change owner can be executed by anyone. The difference is the delay time before executing the transaction in Soul wallet. In the proposed wallet, the delay time is unnecessary because enough valid guardians agree to change owner, so a delay time is inconvenient.

function scheduleRecovery(
    address wallet,
    bytes32[] calldata newOwners,
    bytes calldata rawGuardian,
    bytes calldata guardianSignature
) external override returns (bytes32 recoveryId)

Schedules a recovery operation for a wallet

In conclusion, the two wallets differ in three key aspects:
  • In Soul Wallet, anyone can execute the submission of a new owner, whereas in the proposed wallet, only the current owner can perform this action.
  • In Soul Wallet, guardians' addresses are revealed after they confirm the ownership change, while in the proposed wallet, this does not occur.
  • Soul Wallet enforces a delay before the ownership change transaction can be executed, whereas the proposed wallet does not.
Difference (1) is an advantage of Soul wallet, as guardians are considered trusted entities and only confirm when they recognize that the submission comes from an authorized owner. Differences (2) and (3) are advantages of the proposed wallet, as they enhance privacy and improve user convenience.

Clave wallet vs. the proposed wallet

Clave wallet is a guardian-based ERC-4337 wallet powered by ZKsync. Clave uses zkEmail[undefined], a powerful system that helps users verify emails using ZKP. Clave wallet recovery solution still relies on guardians and ERC-4337 architecture, but guardians are email accounts instead of web3 accounts.
When creating a Clave wallet, users register their email address as the recovery method. If a user loses access to their device or keys:
  • They initiate a recovery request via Clave's interface.
  • Clave's server sends a recovery email to the user's registered address (guardian). This email includes a DKIM (DomainKeys Identified Mail) signature from the email provider (like Gmail).
On the guardian's device, Clave's app parses the email and verifies its DKIM signature to ensure it came from the correct domain and hasn't been tampered with. Using a zk-SNARK circuit, the client generates a ZKP, without revealing the actual email address or email content.
The guardian submits the generated proof to Clave's smart contract to validate the proof. If the proof is valid and meets all conditions, the contract transfers ownership of the wallet to a new user-controlled address.
Using email accounts as guardians can significantly expand the pool of potential guardians, as not everyone has an on-chain account, but almost everyone has an email account. This solution is also highly convenient for users, especially those who are not familiar with Web3. Guardians can view the plain-text content of the email to understand the context of the recovery request before using the Clave app to generate a proof.
However, the solution becomes more complex due to the integration of the email-based recovery factor, compared to the proposed wallet, which is based only on smart contracts, even though most of the complexity is hidden away from the user. Moreover, the Clave solution depends on a server to send recovery emails to guardians (users do not send these emails directly; this responsibility belongs to the Clave server), which could become a bottleneck in the architecture.

Performance Evaluation

To evaluate the efficiency of our proposed system, we conduct the experiences to measure the gas cost for some critical transactions performed in the system, involving the first transaction with deploying account, the transaction for deploying guardian contract and verification proof, as well as the time taken for generating proofs, number of constraints and proof size. Experiments were carried out on a local machine, a MacBook M1 Pro with 16GB of memory and 8 cores. The results regarding the number of constraints in the circuit, the witness size, the constraint size, and the average time taken to generate and verify the proof are shown in Table undefined
FieldResult
non-linear constraints19311
linear constraints817
public inputs0
private inputs1024 (1020 belong to witness)
public outputs3
wires21131
labels54047
witness size660.42KB
constraint size3.97MB
average time taken to generate proof2047.09ms
average time taken to verify proof14.88ms

Information about the proposed main circuit

TransactionGas used (unit of gas)Average cost (USD)
The first transfer 0.1BNB transaction with deploying account transaction2925740.572
The transfer 0.1BNB transaction1008670.197
Deploying guardian transaction28588395.587
Verifying proof transaction2714720.513

Gas cost on local network

TransactionGas used (unit of gas)Average cost (USD)
The first transfer 0.1BNB transaction with deploying account transaction2880880.563
The transfer 0.1BNB transaction969420.189
Deploying guardian transaction28548905.579
Verifying proof transaction2720740.532

Gas cost on BSC testnet

In conclusion, we presented the implementation process of the system, which includes building a zk-SNARK circuit, deploying smart contracts, and setting up a bundler. The experiments were conducted using realistic inputs and were successfully verified on-chain, demonstrating that the zero-knowledge proof verification process is feasible and meets security requirements without revealing sensitive information. Both the proof generation time and verification time are within acceptable limits for practical deployment in blockchain environments.

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

Stuart Haber, W. Scott Stornetta, "How To Time-Stamp a Digital Document," Journal of Cryptology, 1991. DOI: https://doi.org/10.1007/BF00196791.

Satoshi Nakamoto, "Bitcoin: A Peer-to-Peer Electronic Cash System," Decentralized Business Review, 2008. [Online]. Available: https://bitcoin.org/bitcoin.pdf.

Ahmed Afif Monrat, Olov Schelén, Karl Andersson, "A Survey of Blockchain From the Perspectives of Applications, Challenges, and Opportunities," IEEE Access, 2019. DOI: https://doi.org/10.1109/ACCESS.2019.2936094.

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.

Nick Szabo, "Smart Contracts: Building Blocks for Digital Markets," 2018. [Online]. Available: https://api.semanticscholar.org/CorpusID:198956172.

Vitalik Buterin, "A next-generation smart contract and decentralized application platform," 2014. [Online]. Available: https://ethereum.org/en/whitepaper/.

ReWallet, "3 Crazy Cryptocurrency Statistics in 2024 - How Much Bitcoin Has Been Lost?," 2023. [Online]. Available: https://rewallet.de/en/blog/bitcoin-statistics-2023/.

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.

Semaphore team, "semaphore," . [Online]. Available: https://docs.semaphore.pse.dev/.

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.

iden3, "iden3/snarkjs: zkSNARK implementation in JavaScript and WASM," Last updated in Nov 2024. [Online]. Available: https://github.com/iden3/snarkjs.

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.

iden3, "iden3/circomlib: Library of basic circuits for circom," Last updated in Oct 2024. [Online]. Available: https://github.com/iden3/circomlib.

bkomuves, "bkomuves/hash-circuits: Hashing circuits implemented in circom," 2023. [Online]. Available: https://github.com/bkomuves/hash-circuits.

Phạm Hồng Phúc, "phamhongphuc1999/account-abstraction-contract," June 2025. [Online]. Available: https://github.com/phamhongphuc1999/account-abstraction-contract.

Phạm Hồng Phúc, "phamhongphuc1999/account-abstraction-app," June 2025. [Online]. Available: https://github.com/phamhongphuc1999/account-abstraction-app.

Phạm Hồng Phúc, "phamhongphuc1999/bundler," June 2025. [Online]. Available: https://github.com/phamhongphuc1999/bundler.

Eth Infinitism, "Eth infinitism account abstraction v0.6.0," . [Online]. Available: https://github.com/eth-infinitism/account-abstraction/tree/releases/v0.6/.

Eth Infinitism, "Eth infinitism bundler v0.6.0," . [Online]. Available: https://github.com/eth-infinitism/bundler/tree/releases/0.6.0.

Soul team, "Elytro-eth/soul-wallet-contract," July, 2025. [Online]. Available: https://github.com/Elytro-eth/soul-wallet-contract.

zkemail team, "zkEmail official document," July, 2025. [Online]. Available: https://prove.email/.

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, .

okx team, "OKX official document," July, 2025. [Online]. Available: https://web3.okx.com/.

zengjiajun, "Introducing the Soul Wallet Smart Contract Design," Jun 30, 2023. [Online]. Available: https://hackmd.io/@soulwallet/contract.

clave team, "Clave official document," July, 2025. [Online]. Available: https://docs.getclave.com/en/welcome-to-clave.

Appendix

Arithmetic Circuit Design and Implementation in Circom

This appendix provides an overview of Circom. It also explains the specific circuits used in the thesis.

Circom

Circom (short for Circuit Compiler) is a high-level language and compiler used to write arithmetic circuits for ZKPs, especially zk-SNARKs. Circom is maintained by iden3 and widely used in projects like Semaphore, zk-rollups, ZK Identity, and private voting systems. Circom allows for defining circuits, compiling those circuits into R1CS, and creating a smart contract. Circom includes several key features.
  • signal: Signals carry a value during computation. Signals are divided into two types: public signals and private signals. Private signals are values that the prover knows and wants to keep hidden from the verifier. Public signals or public inputs/outputs are known to both provers and verifiers.

template XorCircuit() {
    // private signal
    signal input x;
    signal input y;

    // intermediate signal
    signal t1 <== x + y;
    signal t2 <== x * y;
    signal t3 <== -2 * t2;

    // output signal
    signal output t4 <== t1 + t3;
}

$f = x + y - 2xy$ circuit implemented through Circom

To serve the on-chain verification, Circom can compile Circom circuit into Solidity smart contract. The process has four steps (as illustrated in Figure undefined): (1) Compiling circuit, (2) computing witness, (3) proving a Trusted Setup, and (4) exporting verifier smart contract.
the-process-of-circom-compiling-smart-contract
The process of compiling a Circom circuit to a smart contract
First, the Circom compiler translates the high-level circuit definition into several low-level representations required for the following steps, including two important entities:
  • R1CS: Encodes the circuit as a set of rank-1 quadratic constraints over a finite field.
  • WebAssembly: A program used to generate witnesses.
Second, Circom tool uses WebAssembly to calculate a witness. The process requires the inputs, and WebAssembly generated in the first step will calculate all the intermediate signals and output signals. The group of signals (inputs, outputs, and intermediate signals) is called a witness.
For zk-SNARKs, a trusted setup is required to generate proving and verification keys. This process includes converting the circuit to a QAP internally and producing keys for proof generation and verification. In more detail, the trusted setup contains two parts:
  • The Powers of Tau, which is independent of the circuit.Phase 2, which depends on the circuit.
The final step is to generate a Solidity smart contract from the verification key. This contract includes the cryptographic logic required to validate proofs on-chain.

arithmetic-circuit-in-the-thesis


template Guardian() {
  signal input msg[256];

  signal input A[256];
  signal input R8[256];
  signal input S[256];

  signal output hashPublicKey;
  signal output increment;
  signal output address;

  // Calculate guardian's address hash
  component bitAToNum = Bits2Num(256);
  component poseidon = Poseidon(1);
  bitAToNum.in <== A;
  poseidon.inputs[0] <== bitAToNum.out;
  hashPublicKey <== poseidon.out;

  // Verify signature
  component verifier = EdDSAVerifier(256);
  verifier.msg <== msg;
  verifier.A <== A;
  verifier.R8 <== R8;
  verifier.S <== S;

  // Calculate increment
  component incrementAnalytic = AnalyticMessage(0, 7);
  incrementAnalytic.msg <== msg;
  increment <== incrementAnalytic.result;

  // Calculate new owner address
  component addressAnalytic = AnalyticMessage(8, 31);
  addressAnalytic.msg <== msg;
  address <== addressAnalytic.result;
}

Structure of main arithmetic circuit

Program undefined implements the guardian-based verification mechanism using EdDSA over BabyJubJub and Poseidon hash. Its main purpose is to allow a guardian to prove authorization by submitting a valid signature over a message, without leaking private keys.

template AnalyticMessage(begin, end) {
  signal input msg[256];

  signal output result;

  var _total = 0;
  var multiplicationLevel = 1;

  for (var i = end; i >= begin; i--) {
    var index = i * 8 + 7;
    var piece = msg[index];
    piece = piece * 2 + msg[index - 1];
    piece = piece * 2 + msg[index - 2];
    piece = piece * 2 + msg[index - 3];
    piece = piece * 2 + msg[index - 4];
    piece = piece * 2 + msg[index - 5];
    piece = piece * 2 + msg[index - 6];
    piece = piece * 2 + msg[index - 7];
    _total = _total + piece * multiplicationLevel;
    multiplicationLevel = multiplicationLevel * 256;
  }
  result <== _total;
}

Calculation increment and new owner address circuir

Program undefined is used to extract the increment parameter and the new owner address from the signature. The circuit reconstructs both values by combining 8-bit segments extracted from the signature.

Recovery Methods and Wallets

This appendix outlines several important account recovery methods and existing recovery wallets currently used in blockchain systems.

Recovery methods

  • Off-chain backup and recovery: This method is backing up private key ($sk$) to a secondary location for later restoration. This allows users to regain access if the key is lost, but it does not protect against theft or leakage. For example, storing the key on offline devices (e.g., USB drives), even encrypted keys requires managing an additional Key Encryption Key (KEK); devices can also be lost or damaged.
  • Pre-signed transactions: Users can create and store pre-signed transactions that transfer assets to a secondary account. These transactions remain offline until needed. However, secure management of secondary accounts is crucial to prevent further risks.
  • Guardian-based smart contract recovery: 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 but still uses smart contracts. A famous method is KELP[undefined], the method has four function logics: (1) commit, (2) reveal, (3) claim, and (4) challenge. This approach is fully on-chain, trustless, and setup-free, making it ideal for decentralized key management. However, it depends on the owner's ability to monitor and respond to unauthorized recovery attempts in time.

Recovery wallets

  • Soul wallet[undefined]: Soul wallet is an ERC-4337 smart contract wallet having the social recovery based on guardians. Soul wallet recovery smart contract stores the keccak256 hash of the guardian data. When users want to recover their wallet, their guardians sign an EIP-712-based signature, and the process also reveals guardian data.
  • Clave Wallet[undefined]: is a smart contract wallet built on ZKsync. Its architecture leverages ZKsync's native account abstraction, which is conceptually similar to ERC-4337. Clave Wallet offers two key recovery mechanisms: passkey-based recovery and guardian-based recovery.
    In the passkey-based method, when users create an account using a passkey, an encrypted version of their private key is automatically backed up to the cloud. If users lose their device, they can recover access on another trusted device by using the same passkey.
    The guardian-based solution in Clave allows email accounts, rather than traditional web3 addresses, to act as guardians. This is made possible through the use of zkEmail[undefined], which enables zero-knowledge proofs to verify email ownership without revealing the guardian's email address or content.

COPYRIGHT © 2025