---
eip: 5189
label: ERC-5189
title: Account Abstraction via Endorsed Operations
status: Draft
type: Standards Track
category: ERC
created: 2022-06-29
official: https://eips.ethereum.org/EIPS/eip-5189
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-5189.md
canonical: https://eips.huatuo.xyz/ko/eip-5189/
lang: ko
tldr: "프로토콜 변경 없는 계정 추상화: 지갑이 Operation을 공개 mempool에 제출하고, 지갑별 \"endorser\" 컨트랙트가 각 Operation이 비용을 지불할지, 어떤 상태에 의존하는지를 bundler에게 알려 준다."
tags: [account-abstraction, wallets, mempool, bundlers, erc]
---

# ERC-5189: Account Abstraction via Endorsed Operations

> An account abstraction proposal that avoids protocol changes while maintaining compatibility with existing smart contract wallets.

**TL;DR:** 프로토콜 변경 없는 계정 추상화: 지갑이 Operation을 공개 mempool에 제출하고, 지갑별 "endorser" 컨트랙트가 각 Operation이 비용을 지불할지, 어떤 상태에 의존하는지를 bundler에게 알려 준다.

## 어떤 문제를 해결하나요?

스마트 컨트랙트 지갑에는 트랜잭션을 온체인에 보내고 가스비를 돌려받는 누군가, 즉 **bundler**가 필요합니다. 어려운 부분은 서비스 거부 공격입니다. bundler는 Operation 전체를 실행하거나 상태가 바뀔 때마다 다시 실행하지 않고도 그 Operation이 실제로 비용을 지불할지 어떻게 알 수 있을까요?

[ERC-4337](/eip-4337/)은 고정된 `UserOperation` 형식, 공유 EntryPoint, opcode와 스토리지에 대한 엄격한 검증 규칙으로 이에 답합니다. 기존 지갑은 그 모델을 채택해야 합니다. ERC-5189는 다른 길을 택합니다. 합의 변경이나 지갑 코드에 대한 제약 없이, **이미 배포된 지갑을 그대로** 지원하는 것을 목표로 합니다. 대신 각 지갑 개발자가 자기 지갑의 Operation을 보증하는 컨트랙트를 제공합니다.

## 어떻게 동작하나요?

**Operation.** 전용 mempool로 보내는 오프체인 구조체입니다. 필드에는 `entrypoint` + `callData`(무엇을 호출할지, 보통 지갑 자신), `fixedGas`와 `gasLimit`, [EIP-1559](/eip-1559/)와 비슷한 수수료 필드(`maxFeePerGas`, `priorityFeePerGas`), ERC-20으로 지불하기 위한 스케일링 계수가 있는 `feeToken`, `chainId`, 그리고 참조할 `endorser`가 포함됩니다.

**Endorser.** 지갑 개발자가 배포하는 컨트랙트입니다. bundler는 이에 대한 호출을 오프체인에서 **시뮬레이션**하며, 온체인에서는 절대 호출하지 않습니다.

- `simulationSettings(op)`는 시뮬레이션 전에 적용할 코드와 스토리지 오버라이드를 반환합니다.
- `isOperationReady(op)`는 `readiness`와 그 Operation의 **의존성**을 반환합니다. 의존성에는 전역적인 것(base fee, 타임스탬프, 블록 번호, `maxBlockNumber` 등)과 주소별 의존성(잔액, 코드, nonce, 특정 스토리지 슬롯, 또는 `constraints`라 불리는 값 범위)이 있습니다.

`readiness`가 true이면 그 Operation은 반드시 실행되어야 하고, bundler에게 최소한 다음을 지불해야 합니다.

```
gasUnits  = fixedGas + min(gasUsed, gasLimit)
feePerGas = min(maxFeePerGas, baseFee + priorityFeePerGas)
repayment = gasUnits * feePerGas * feeScalingFactor / feeNormalizationFactor
```

bundler는 의존성 중 하나가 바뀔 때만 Operation을 다시 확인합니다. 포함하기 전에 실제 블록 안에서 최종 시뮬레이션을 실행합니다. endorser가 "ready"라고 했는데 Operation이 실패하거나 지불이 부족하면, bundler는 **그 endorser를 차단**하고 해당 endorser의 모든 Operation을 버립니다. endorser를 버리는 데 비용이 들도록, `EndorserRegistry`에서 **ETH를 소각**할 수 있으며, 얼마나 소각해야 하는지는 각 mempool 운영자가 정합니다.

endorser가 완전히 검증할 수 없는 코드 경로에서는 `UntrustedStarted` / `UntrustedEnded`를 emit할 수 있습니다. 그 구간 안에서 bundler는 모든 상태 접근을 자동으로 의존성으로 기록합니다.

## 샘플 코드

사양의 레지스트리 컨트랙트(약간 줄임):

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.15;

contract EndorserRegistry {
    event Burned(address indexed endorser, address indexed sender, uint256 added, uint256 total);
    mapping(address => uint256) public burn;

    function addBurn(address endorser) external payable returns (uint256 total) {
        total = burn[endorser] + msg.value;   // ETH is locked here forever
        burn[endorser] = total;
        emit Burned(endorser, msg.sender, msg.value, total);
    }
}
```

bundler의 수용 검사(의사 코드):

```python
settings = endorser.simulationSettings(op)                     # eth_call
ready, glob, deps = simulate(endorser.isOperationReady, op, overrides=settings)
if ready and registry.burn(op.endorser) >= MIN_ENDORSER_BURN:
    mempool.add(op, watch=deps, valid_until=(glob.maxBlockNumber, glob.maxBlockTimestamp))
```

## 알아둘 점

- **상태: Draft.** 실제로는 생태계 대부분이 [ERC-4337](/eip-4337/)을, EOA에 대해서는 [EIP-7702](/eip-7702/)를 택했습니다.
- 사양은 리플레이 방지나 지갑 배포 로직을 정의하지 않습니다. 이들은 각 지갑과 그 entrypoint에 맡겨집니다.
- 안전성은 최소 소각량, 의존성 한도, 재평가 한도, endorser 차단 같은 bundler 자체 정책에 달려 있습니다. 사양은 `MAX_ENDORSER_GAS`와 `MIN_ENDORSER_BURN` 같은 상수를 제안하지만 값은 주지 않습니다.
- Operation은 여러 번 실행될 수 있습니다. 프로토콜은 이를 막지 않습니다. 리플레이 방지는 지갑의 몫이며, 예를 들어 의존성으로 나타나는 nonce를 사용합니다.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-5189
