---
eip: 7679
label: ERC-7679
title: UserOperation Builder
status: Draft
type: Standards Track
category: ERC
created: 2024-04-05
requires: 4337
official: https://eips.ethereum.org/EIPS/eip-7679
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7679.md
canonical: https://eips.huatuo.xyz/ko/eip-7679/
lang: ko
tldr: "각 ERC-4337 스마트 계정이 자신의 nonce, calldata, 서명 인코딩 방식을 담은 온체인 \"builder\" 컨트랙트를 공개하게 해, 계정별 SDK 없이도 어떤 지갑이나 dapp이든 UserOperation을 만들 수 있게 한다."
tags: [account-abstraction, smart-accounts, userop, interoperability]
---

# ERC-7679: UserOperation Builder

> Construct UserOperations without being coupled with account-specific logic.

**TL;DR:** 각 ERC-4337 스마트 계정이 자신의 nonce, calldata, 서명 인코딩 방식을 담은 온체인 "builder" 컨트랙트를 공개하게 해, 계정별 SDK 없이도 어떤 지갑이나 dapp이든 UserOperation을 만들 수 있게 한다.

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

[ERC-4337](/eip-4337/)은 스마트 계정이 UserOperation(UserOp)을 보내도록 하지만, `nonce`, `callData`, `signature` 세 필드는 각 계정 구현에 맡겨 둡니다. 어떤 계정은 `executeFoo`를 노출하고 다른 계정은 `executeBar`를 노출합니다. nonce에 검증자 주소를 담는 계정도 있고, 서명에 추가 데이터를 덧씌우는 계정도 있습니다.

그 결과 UserOp를 보내려는 dapp이나 지갑은 상대가 어떤 계정 구현인지 알아야 하고, 그 벤더의 SDK를 함께 배포해야 합니다. 이는 벤더 종속이며 계정 추상화 생태계를 파편화합니다.

ERC-7679는 이런 계정별 인코딩 로직을 하나의 공통 인터페이스 뒤로 옮겨 온체인에 둡니다.

## 어떻게 동작하나요?

각 스마트 계정 구현은 `IUserOperationBuilder`를 구현하는 **UserOp builder** 컨트랙트를 제공합니다.

| 함수 | 반환값 |
| --- | --- |
| `entryPoint()` | 계정이 지원하는 ERC-4337 EntryPoint |
| `getNonce(account, context)` | 사용할 nonce |
| `getCallData(account, executions, context)` | `(target, value, callData)` 실행 묶음에 대한 `callData` |
| `formatSignature(account, userOp, context)` | 계정이 기대하는 형식으로 감싼 원본 서명 |

`context`는 계정 소유자(또는 그의 지갑)가 만드는 쪽에 넘겨 주는 불투명한 바이트 문자열입니다. 위임 인증처럼 builder에 필요한 정보를 담습니다.

만드는 쪽에 권장되는 흐름은 다음과 같습니다.

1. 계정 소유자로부터 builder 주소와 `context`를 받는다.
2. `getNonce`와 `getCallData`를 `eth_call`로 호출한다(가능하면 배치로).
3. 낮은 gas 값으로 UserOp를 채워 서명하고, `formatSignature`를 호출해 gas 추정용으로 올바른 형태의 **더미 서명**을 얻는다.
4. gas를 추정하고, 실제 gas 값을 넣어 다시 서명한 뒤, `formatSignature`를 한 번 더 호출해 최종적으로 유효한 UserOp를 얻는다.

그 밖의 UserOp 필드(gas, paymaster 등)는 범위 밖입니다. 아직 배포되지 않은 계정을 위해, 명세는 [ERC-6492](/eip-6492/)에서 착안한 `CounterfactualCall` 컨트랙트를 설명합니다. 이 컨트랙트는 `eth_call` 안에서 팩토리를 통해 계정을 배포한 뒤 builder를 조회합니다.

## 샘플 코드

ethers v6로 `callData`와 `nonce`를 만드는 예:

```ts
import { Contract, JsonRpcProvider } from "ethers";

const provider = new JsonRpcProvider(process.env.RPC_URL);
const builder = new Contract(builderAddress, [
  "function entryPoint() view returns (address)",
  "function getNonce(address smartAccount, bytes context) view returns (uint256)",
  "function getCallData(address smartAccount, (address target, uint256 value, bytes callData)[] executions, bytes context) view returns (bytes)",
], provider);

const executions = [
  { target: tokenAddress, value: 0n, callData: transferData },
];

const [nonce, callData] = await Promise.all([
  builder.getNonce(account, context),
  builder.getCallData(account, executions, context),
]);
// Fill the rest of the UserOp, then call formatSignature(...) for the dummy and final signatures.
```

## 알아둘 점

- **상태: Draft.** 인터페이스는 아직 바뀔 수 있습니다.
- 이 인터페이스는 EntryPoint v0.7(`PackedUserOperation`)을 대상으로 합니다. EntryPoint v0.6의 계정에는 v0.6 구조체를 쓰는 변형이 필요합니다.
- 더미 서명은 중요합니다. 실제 서명과 거의 같은 양의 gas를 소비해야 하므로, 고정값이 아니라 계정별 builder에서 가져옵니다.
- 더미 서명은 공개적으로 노출됩니다. 명세는 가로채이더라도 쓸모없도록 매우 낮은 gas 값으로 더미 UserOp에 서명할 것을 권장합니다.
- [ERC-7579](/eip-7579/) 같은 모듈형 계정 표준을 보완합니다. ERC-7579는 UserOp를 외부에서 만드는 방식이 아니라 계정 내부의 실행과 모듈을 표준화합니다.


---

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