---
eip: 2309
label: ERC-2309
title: ERC-721 Consecutive Transfer Extension
status: Final
type: Standards Track
category: ERC
created: 2019-10-08
requires: 721
official: https://eips.ethereum.org/EIPS/eip-2309
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-2309.md
canonical: https://eips.huatuo.xyz/ko/eip-2309/
lang: ko
tldr: 선택적 ERC-721 이벤트 ConsecutiveTransfer. 토큰 ID 범위 전체의 민팅, 전송, 소각을 로그 하나로 알려, 거대한 NFT 배치에서도 토큰마다 Transfer 이벤트를 내지 않아도 되게 한다.
tags: [nft, erc721, events, batch, minting]
---

# ERC-2309: ERC-721 Consecutive Transfer Extension

> A standardized event emitted when creating/transferring one, or many non-fungible tokens using consecutive token identifiers.

**TL;DR:** 선택적 ERC-721 이벤트 ConsecutiveTransfer. 토큰 ID 범위 전체의 민팅, 전송, 소각을 로그 하나로 알려, 거대한 NFT 배치에서도 토큰마다 Transfer 이벤트를 내지 않아도 되게 한다.

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

[ERC-721](/eip-721/)은 어떤 NFT든 소유권이 바뀔 때마다 `Transfer` 이벤트를 emit해야 한다고 규정합니다. 인덱서, 마켓플레이스, 블록 탐색기는 누가 무엇을 소유하는지 알아내기 위해 이 이벤트에 의존합니다.

이 규칙 때문에 대량 배치는 비용이 많이 듭니다. 컨트랙트는 영리한 자료구조로 한 트랜잭션에서 토큰 100만 개를 민팅할 수 있지만, 루프에서 `Transfer` 이벤트 100만 개를 emit하면 가스가 바닥납니다. ERC-2309는 이런 컨트랙트에 연속된 토큰 ID 범위 전체를 한 번에 설명하는 표준 이벤트 하나를 제공합니다.

## 어떻게 동작하나요?

ERC-2309는 이벤트 하나만 정의합니다. 배치 민팅이나 전송을 어떻게 구현할지는 정하지 않고, 이를 어떻게 알릴지만 정합니다.

```solidity
event ConsecutiveTransfer(
    uint256 indexed fromTokenId,
    uint256 toTokenId,
    address indexed fromAddress,
    address indexed toAddress
);
```

규칙:

- `fromTokenId`부터 `toTokenId`까지는 연속된 ID 범위여야 합니다.
- 민팅은 `fromAddress == address(0)`, 소각은 `toAddress == address(0)`을 사용합니다.
- `fromTokenId`, `fromAddress`, `toAddress`는 indexed이고, `toTokenId`는 indexed가 아니며 로그 데이터에 들어갑니다.
- 호출자는 범위 안의 모든 토큰을 소유하고 있거나 승인된 오퍼레이터여야 합니다.
- 어떤 토큰 집합에 대해 `ConsecutiveTransfer`를 emit했다면, 같은 토큰에 대해 `Transfer`를 함께 emit해서는 **안 됩니다**. 컨트랙트는 일반적인 단일 토큰 이동에는 여전히 `Transfer`를 쓸 수 있습니다.

이 이벤트는 토큰 하나에도 쓸 수 있습니다. `ConsecutiveTransfer(1, 1, address(0), alice)`는 토큰 1을 민팅합니다.

## 샘플 코드

배치를 민팅할 때 이벤트 emit하기(장부 관리는 설명을 위해 단순화):

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

contract BatchNFT {
    event ConsecutiveTransfer(
        uint256 indexed fromTokenId,
        uint256 toTokenId,
        address indexed fromAddress,
        address indexed toAddress
    );

    uint256 public nextId = 1;
    // A real contract stores ownership compactly, e.g. one entry per batch.
    mapping(uint256 => address) internal batchOwner; // keyed by first id of batch

    function mintBatch(address to, uint256 quantity) external {
        require(quantity > 0, "qty");
        uint256 first = nextId;
        uint256 last = first + quantity - 1;
        batchOwner[first] = to;
        nextId = last + 1;
        emit ConsecutiveTransfer(first, last, address(0), to); // one log for the whole range
    }
}
```

인덱서에서 리스닝하기(ethers v6):

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

const provider = new JsonRpcProvider(process.env.RPC_URL);
const nft = new Contract(nftAddress, [
  "event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed fromAddress, address indexed toAddress)",
], provider);

nft.on("ConsecutiveTransfer", (fromId, toId, from, to) => {
  console.log(`tokens ${fromId}..${toId}: ${from} -> ${to}`);
});
```

## 알아둘 점

- 상태는 Final이지만 지원은 선택 사항입니다. `Transfer`만 리스닝하는 인덱서는 `ConsecutiveTransfer`로 알려진 소유권 변경을 놓치므로, 도구는 둘 다 감시해야 합니다.
- OpenZeppelin의 `ERC721Consecutive` 확장은 생성 중 배치 민팅에 이 이벤트를 사용합니다.
- 스펙은 이를 [ERC-1155](/eip-1155/)와 비교합니다. ERC-1155는 준대체 가능 아이템의 배치 처리에는 좋지만 ID별 데이터를 여전히 로그로 남기며, ERC-2309는 아주 많은 수의 고유 토큰을 민팅하는 경우를 겨냥합니다.
- 컨트랙트가 NFT인지 감지하는 일은 여전히 [ERC-165](/eip-165/)의 `supportsInterface`로 합니다. 이 이벤트 자체에는 인터페이스 ID가 없습니다.


---

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