---
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/ja/eip-2309/
lang: ja
tldr: ERC-721 のオプションイベント ConsecutiveTransfer。トークン ID の範囲全体のミント・転送・バーンを 1 つのログで報告し、巨大な 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 の範囲全体のミント・転送・バーンを 1 つのログで報告し、巨大な NFT バッチでもトークンごとに Transfer イベントを出さなくて済むようにする。

## 何を解決するのか

[ERC-721](/eip-721/) は、NFT の所有権が変わるたびに `Transfer` イベントを emit しなければならないと定めています。インデクサー、マーケットプレイス、ブロックエクスプローラーは、誰が何を所有しているかを知るためにこのイベントに依存しています。

このルールは大規模なバッチを高コストにします。コントラクトは巧妙なデータ構造により 1 回のトランザクションで 100 万個のトークンをミントできますが、ループで 100 万個の `Transfer` イベントを emit すればガスが尽きます。ERC-2309 は、そのようなコントラクトに、連続したトークン ID の範囲全体を一度に記述する標準イベントを 1 つ提供します。

## 仕組み

ERC-2309 が定義するのは 1 つのイベントだけです。バッチミントや転送をどう実装するかには触れず、それをどう通知するかだけを定めます。

```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
