{"id":19498061,"url":"https://github.com/patrickalphac/minimal-account-abstraction","last_synced_at":"2026-02-20T17:02:39.623Z","repository":{"id":237582391,"uuid":"794811858","full_name":"PatrickAlphaC/minimal-account-abstraction","owner":"PatrickAlphaC","description":null,"archived":false,"fork":false,"pushed_at":"2024-06-20T23:12:18.000Z","size":14443,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-17T12:21:38.676Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PatrickAlphaC.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-05-02T02:13:56.000Z","updated_at":"2024-09-28T07:20:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"4560c828-e584-4bd9-bda6-b6c565ee7761","html_url":"https://github.com/PatrickAlphaC/minimal-account-abstraction","commit_stats":null,"previous_names":["patrickalphac/minimal-account-abstraction"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PatrickAlphaC/minimal-account-abstraction","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatrickAlphaC%2Fminimal-account-abstraction","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatrickAlphaC%2Fminimal-account-abstraction/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatrickAlphaC%2Fminimal-account-abstraction/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatrickAlphaC%2Fminimal-account-abstraction/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PatrickAlphaC","download_url":"https://codeload.github.com/PatrickAlphaC/minimal-account-abstraction/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatrickAlphaC%2Fminimal-account-abstraction/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29658167,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T16:33:43.953Z","status":"ssl_error","status_checked_at":"2026-02-20T16:33:43.598Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T21:49:06.135Z","updated_at":"2026-02-20T17:02:39.604Z","avatar_url":"https://github.com/PatrickAlphaC.png","language":"Solidity","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e [!IMPORTANT]  \n\u003e This repo is for demo purposes only. \n\n# Account Abstraction\n\n- [Account Abstraction](#account-abstraction)\n  - [What is Account Abstraction?](#what-is-account-abstraction)\n  - [What's this repo show?](#whats-this-repo-show)\n  - [What does this repo not show?](#what-does-this-repo-not-show)\n- [Getting Started](#getting-started)\n  - [Requirements](#requirements)\n  - [Installation](#installation)\n- [Quickstart](#quickstart)\n  - [Vanilla Foundry](#vanilla-foundry)\n    - [Deploy - Arbitrum](#deploy---arbitrum)\n    - [User operation - Arbitrum](#user-operation---arbitrum)\n  - [zkSync Foundry](#zksync-foundry)\n    - [Deploy - zkSync local network](#deploy---zksync-local-network)\n      - [Additional Requirements](#additional-requirements)\n      - [Setup - local node](#setup---local-node)\n      - [Deploy - local node](#deploy---local-node)\n    - [Deploy - zkSync Sepolia or Mainnet](#deploy---zksync-sepolia-or-mainnet)\n- [Example Deployments](#example-deployments)\n  - [zkSync (Sepolia)](#zksync-sepolia)\n  - [Ethereum (Arbitrum)](#ethereum-arbitrum)\n- [Account Abstraction zkSync Contract Deployment Flow](#account-abstraction-zksync-contract-deployment-flow)\n  - [First time](#first-time)\n  - [Subsequent times](#subsequent-times)\n- [FAQ](#faq)\n  - [What if I don't add the contract hash to factory deps?](#what-if-i-dont-add-the-contract-hash-to-factory-deps)\n  - [Why can't we do these deployments with foundry or cast?](#why-cant-we-do-these-deployments-with-foundry-or-cast)\n  - [Why can I use `forge create --legacy` to deploy a regular contract?](#why-can-i-use-forge-create---legacy-to-deploy-a-regular-contract)\n- [Acknowledgements](#acknowledgements)\n- [Disclaimer](#disclaimer)\n\n## What is Account Abstraction?\n\nEoAs are now smart contracts. That's all account abstraction is.\n\nBut what does that mean?\n\nRight now, every single transaction in web3 stems from a single private key. \n\n\u003e account abstraction means that not only the execution of a transaction can be arbitrarily complex computation logic as specified by the EVM, but also the authorization logic.\n\n- [Vitalik Buterin](https://ethereum-magicians.org/t/implementing-account-abstraction-as-part-of-eth1-x/4020)\n- [EntryPoint Contract v0.6](https://etherscan.io/address/0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789)\n- [EntryPoint Contract v0.7](https://etherscan.io/address/0x0000000071727De22E5E9d8BAf0edAc6f37da032)\n- [zkSync AA Transaction Flow](https://docs.zksync.io/build/developer-reference/account-abstraction.html#the-transaction-flow)\n\n## What's this repo show?\n\n1. A minimal EVM \"Smart Wallet\" using alt-mempool AA\n   1. We even send a transactoin to the `EntryPoint.sol`\n2. A minimal zkSync \"Smart Wallet\" using native AA\n   1. [zkSync uses native AA, which is slightly different than ERC-4337](https://docs.zksync.io/build/developer-reference/account-abstraction.html#iaccount-interface)\n   2. We *do* send our zkSync transaction to the alt-mempool\n\n## What does this repo not show?\n\n1. Sending your userop to the alt-mempool \n   1. You can learn how to do this via the [alchemy docs](https://alchemy.com/?a=673c802981)\n\n# Getting Started \n\n## Requirements\n\n- [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)\n  - You'll know you did it right if you can run `git --version` and you see a response like `git version x.x.x`\n- [foundry](https://getfoundry.sh/)\n  - You'll know you did it right if you can run `forge --version` and you see a response like `forge 0.2.0 (816e00b 2023-03-16T00:05:26.396218Z)`\n- [foundry-zksync](https://github.com/matter-labs/foundry-zksync)\n  - You'll know you did it right if you can run `forge-zksync --help` and you see `zksync` somewhere in the output\n\n## Installation\n\n```bash\ngit clone https://github.com/PatrickAlphaC/minimal-account-abstraction\ncd minimal-account-abstraction\nmake\n```\n\n# Quickstart \n\n## Vanilla Foundry\n\n```bash\nfoundryup\nmake test\n```\n\n### Deploy - Arbitrum\n\n```bash\nmake deployEth\n```\n\n### User operation - Arbitrum\n\n```bash\nmake sendUserOp\n```\n\n## zkSync Foundry\n\n```bash\nfoundryup-zksync\nmake zkbuild\nmake zktest\n```\n\n### Deploy - zkSync local network\n\n#### Additional Requirements\n- [npx \u0026 npm](https://docs.npmjs.com/cli/v10/commands/npm-install)\n  - You'll know you did it right if you can run `npm --version` and you see a response like `7.24.0` and `npx --version` and you see a response like `8.1.0`.\n- [yarn](https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable)\n  - You'll know you did it right if you can run `yarn --version` and you see a response like `1.22.17`.\n- [docker](https://docs.docker.com/engine/install/)\n  - You'll know you did it right if you can run `docker --version` and you see a response like `Docker version 20.10.7, build f0df350`.\n  - Then, you'll want the daemon running, you'll know it's running if you can run `docker --info` and in the output you'll see something like the following to know it's running:\n```bash\nClient:\n Context:    default\n Debug Mode: false\n```\n\nInstall dependencies:\n```bash\nyarn\n```\n\n#### Setup - local node\n\n```bash\n# Select `in memory node` and nothing else\nnpx zksync-cli dev start\n```\n\n#### Deploy - local node\n\n\u003e [!IMPORTANT]  \n\u003e *Never* have a private key associated with real funds in plaintext. \n\n```bash\n# Setup your .env file, see the .env.example for an example\nmake zkdeploy\n```\n\n\u003e Note: Sending an account abstraction transaction doesn't work on the local network, because we don't have the system contracts setup on the local network. \n\n### Deploy - zkSync Sepolia or Mainnet\n\nMake sure your wallet has at least 0.01 zkSync ETH in it.\n\n1. Encrypt your key \n\nAdd your `PRIVATE_KEY` and `PRIVATE_KEY_PASSWORD` to your `.env` file, then run:\n\n```bash\nmake encryptKey\n```\n\n\u003e [!IMPORTANT]\n\u003e NOW DELETE YOUR PRIVATE KEY AND PASSWORD FROM YOUR `.env` FILE!!!\n\u003e Don't push your `.encryptedKey.json` up to GitHub either!\n\n1. Un-Comment the Sepolia or Mainnet section (depending on which you'd like to use) of `DeployZkMinimal.ts` and `SendAATx.ts`:\n\n```javascript\n// // Sepolia - uncomment to use\n```\n\n3. Deploy the contract\n```bash\nmake zkdeploy\n```\n\nYou'll get an output like:\n```\nzkMinimalAccount deployed to: 0x4768d649Da9927a8b3842108117eC0ca7Bc6953f\nWith transaction hash: 0x103f6d894c20620dc632896799960d06ca37e722d20682ca824d428579ba157c\n```\n\nGrab the address of the `zkMinimalAccount` and add it to the `ZK_MINIMAL_ADDRESS` of `SendAATx.ts`.\n\n4. Fund your account\n\nSend it `0.005` zkSync sepolia ETH.\n\n5. Send an AA transaction\n\n```bash\nmake sendTx\n```\n\nYou'll get an out put like this:\n\n```\nLet's do this!\nSetting up contract details...\nThe owner of this minimal account is:  0x643315C9Be056cDEA171F4e7b2222a4ddaB9F88D\nPopulating transaction...\nSigning transaction...\nThe minimal account nonce before the first tx is 0\nTransaction sent from minimal account with hash 0xec7800e3a01d5ba5e472396127b656f7058cdcc5a1bd292b2b49f76aa19548c8\nThe account's nonce after the first tx is 1\n```\n\n# Example Deployments\n\n## zkSync (Sepolia)\n- [ZkMinimal Account (Sepolia)](https://sepolia.explorer.zksync.io/address/0x5249Fd99f1C1aE9B04C65427257Fc3B8cD976620)\n- [USDC Approval via native zkSync AA (Sepolia)](https://sepolia.explorer.zksync.io/tx/0x43224b566a0b7497a26c57ab0fcea7d033dccd6cd6e16004523be0ce14fbd0fd)\n- [Contract Deployer](https://explorer.zksync.io/address/0x0000000000000000000000000000000000008006)\n\n## Ethereum (Arbitrum)\n- [Minimal Account](https://arbiscan.io/address/0x03Ad95a54f02A40180D45D76789C448024145aaF#code)\n- [USDC Approval via EntryPoint](https://arbiscan.io/tx/0x03f99078176ace63d36c5d7119f9f1c8a74da61516616c43593162ff34d1154b#eventlog)\n\n# Account Abstraction zkSync Contract Deployment Flow\n\n## First time\n1. Calls `createAccount` or `create2Account` on the `CONTRACT_DEPLOYER` system contract \n   1. This will deploy the contract *to the L1*.\n   2. Mark the contract hash in the `KnownCodesStorage` contract\n   3. Mark it as an AA contract \n   4. [Example](https://sepolia.explorer.zksync.io/tx/0xec0d587903415b2785d542f8b41c21b82ad0613c226a8c83376ec2b8f90ffdd0#eventlog)\n      1. Notice 6 logs emitted? \n\n## Subsequent times\n1. Calls `createAccount` or `create2Account` on the `CONTRACT_DEPLOYER` system contract \n   1. The `CONTRACT_DEPLOYER` will check and see it's deployed this hash before\n   2. It will put in another system contract that this address is associated with the first has\n   3. [Example](https://sepolia.explorer.zksync.io/tx/0xe7a2a895d9854db5a6cc60df60524852d9957dd17adcc5720749f60b4da3eba7)\n      1. Only 3 logs emitted!\n   \n# FAQ\n\n## What if I don't add the contract hash to factory deps? \nThe transaction will revert. The `ContractDeployer` checks to see if it knows the hash, and if not, it will revert! The `ContractDeployer` calls the `KnownCodesStorage` contract, which keeps track of *every single contract hash deployed on the zkSync chain. Crazy right!*\n\n## Why can't we do these deployments with foundry or cast? \nFoundry and cast don't have support for the `factoryDeps` transaction field, or support for type `113` transactions. \n\n## Why can I use `forge create --legacy` to deploy a regular contract?\n`foundry-zksync` is smart enough to see a legacy deployment (when you send a transaction to the 0 address with data) and transform it into a contract call to the deployer. It's only smart enough for legacy deployments as of today, not the new `EIP-1559` type 2 transactions or account creation.\n\n# Acknowledgements \n- [Types of AAs on different chains](https://www.bundlebear.com/factories/all)\n- [eth-infinitism](https://github.com/eth-infinitism/account-abstraction/)\n- [Dan Nolan](https://www.youtube.com/watch?v=b4KWkIAPa3U)\n  - [Twitter Video](https://x.com/BeingDanNolan/status/1795848790043218029)\n- [zerodevapp](https://github.com/zerodevapp/kernel/)\n- [Alchemy LightAccount](https://github.com/alchemyplatform/light-account/)\n\n# Disclaimer\n*This codebase is for educational purposes only and has not undergone a security review.*","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickalphac%2Fminimal-account-abstraction","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatrickalphac%2Fminimal-account-abstraction","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickalphac%2Fminimal-account-abstraction/lists"}