> ## Documentation Index
> Fetch the complete documentation index at: https://docs.optimism.io/llms.txt
> Use this file to discover all available pages before exploring further.

# 포크 모드

> Supersim을 포크하는 방법을 알아봅니다.

Supersim 포크 모드를 사용하면 컨트랙트를 다시 배포하거나 수정하지 않고도 체인의 상태를 시뮬레이션하고 상호작용할 수 있습니다. 이는 testnet / mainnet 체인에 이미 배포된 컨트랙트를 사용하는 경우에 가능합니다.

```sh theme={null}
supersim fork
```

## 작동 방식

`supersim` fork 명령은 OP Stack 생태계의 여러 체인을 동시에 포크하는 과정을 단순화합니다. 각 체인에 적합한 블록 높이를 결정하고, 이 값을 기반으로 L1 및 L2 체인을 모두 실행합니다.

이를 통해 [superchain registry](https://github.com/ethereum-optimism/superchain-registry)의 superchain 네트워크에 속한 모든 체인을 로컬에서 포크할 수 있으며, 기본값은 `mainnet` 버전입니다.

### 시작 로그 예시

```
Available Accounts
-----------------------
(0): 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
--- truncated for brevity ---

Private Keys
-----------------------
(0): 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
--- truncated for brevity ---

Orchestrator Config:
L1:
  Name: mainnet    Chain ID: 1    RPC: http://127.0.0.1:8545    LogPath: /var/folders/0w/ethers-phoenix/T/anvil-chain-1-1521250718
L2:
  Name: op    Chain ID: 10    RPC: http://127.0.0.1:9545    LogPath: /var/folders/0w/ethers-phoenix/T/anvil-chain-10
  Name: base    Chain ID: 8453    RPC: http://127.0.0.1:9546    LogPath: /var/folders/0w/ethers-phoenix/T/anvil-chain-8453
  Name: zora    Chain ID: 7777777    RPC: http://127.0.0.1:9547    LogPath: /var/folders/0w/ethers-phoenix/T/anvil-chain-7777777
```

## 구성

```
NAME:
   supersim fork - Locally fork a network in the superchain registry

USAGE:
   supersim fork [command options]

OPTIONS:

          --l1.fork.height value              (default: 0)                       ($SUPERSIM_L1_FORK_HEIGHT)
                L1 height to fork the superchain (bounds L2 time). `0` for latest

          --chains value                                                         ($SUPERSIM_CHAINS)
                chains to fork in the superchain, mainnet options: [arena-z, automata, base,
                bob, cyber, ethernity, funki, hashkeychain, ink, lisk, lyra, metal, mint, mode,
                op, orderly, polynomial, race, redstone, shape, soneium, sseed, swan, swell, tbn,
                unichain, worldchain, xterio-eth, zora]. In order to replace the public rpc endpoint
                for a chain, specify the ($SUPERSIM_RPC_URL_<CHAIN>) env variable. i.e
                SUPERSIM_RPC_URL_OP=http://optimism-mainnet.infura.io/v3/<API-KEY>

          --network value                     (default: "mainnet")               ($SUPERSIM_NETWORK)
                superchain network. options: mainnet, sepolia, sepolia-dev-0. In order to
                replace the public rpc endpoint for the network, specify the
                ($SUPERSIM_RPC_URL_<NETWORK>) env variable. i.e
                SUPERSIM_RPC_URL_MAINNET=http://mainnet.infura.io/v3/<API-KEY>

          --interop.enabled                   (default: true)                    ($SUPERSIM_INTEROP_ENABLED)
                enable interop predeploy and functionality

          --admin.port value                  (default: 8420)                    ($SUPERSIM_ADMIN_PORT)
                Listening port for the admin server

          --interop.l2tol2cdm.override value                                     ($SUPERSIM_INTEROP_L2TO2CDM_OVERRIDE)
                Path to the L2ToL2CrossDomainMessenger build artifact that overrides
                the default implementation

          --l1.port value                     (default: 8545)                    ($SUPERSIM_L1_PORT)
                Listening port for the L1 instance. `0` binds to any available port

          --l2.count value                    (default: 2)                       ($SUPERSIM_L2_COUNT)
                Number of L2s. Max of 5

          --l2.starting.port value            (default: 9545)                    ($SUPERSIM_L2_STARTING_PORT)
                Starting port to increment from for L2 chains. `0` binds each chain to any
                available port

          --interop.autorelay                 (default: false)                   ($SUPERSIM_INTEROP_AUTORELAY)
                Automatically relay messages sent to the L2ToL2CrossDomainMessenger using
                account 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720

          --interop.delay value               (default: 0)                       ($SUPERSIM_INTEROP_DELAY)
                Delay before relaying messages sent to the L2ToL2CrossDomainMessenger

          --logs.directory value                                                 ($SUPERSIM_LOGS_DIRECTORY)
                Directory to store logs

          --l1.host value                     (default: "127.0.0.1")             ($SUPERSIM_L1_HOST)
                Host address for the L1 instance

          --l2.host value                     (default: "127.0.0.1")             ($SUPERSIM_L2_HOST)
                Host address for L2 instances

          --odyssey.enabled                   (default: false)                   ($SUPERSIM_ODYSSEY_ENABLED)
                Enable odyssey experimental features

          --dependency.set value                                                 ($SUPERSIM_DEPENDENCY_SET)
                Override local chain IDs in the dependency set.(format: '[901,902]' or '[]')

          --log.level value                   (default: INFO)                    ($SUPERSIM_LOG_LEVEL)
                The lowest log level that will be output

          --log.format value                  (default: text)                    ($SUPERSIM_LOG_FORMAT)
                Format the log output. Supported formats: 'text', 'terminal', 'logfmt', 'json',
                'json-pretty',

          --log.color                         (default: false)                   ($SUPERSIM_LOG_COLOR)
                Color the log output if in terminal mode

          --log.pid                           (default: false)                   ($SUPERSIM_LOG_PID)
                Show pid in the log

          --help, -h                          (default: false)
                show help
```

## 참고 사항

### 포크 높이

포크 높이는 L1 블록 높이(기본값 `latest`)에 의해 결정됩니다. 이 값은 시작할 해당 L2 블록을 도출하는 데 사용됩니다.

### 상호운용성 컨트랙트

기본적으로 포크된 네트워크에는 상호운용성(interop) 컨트랙트가 배포되지 않습니다. 이를 포함하려면 `--interop.enabled` 플래그와 함께 `supersim`을 실행합니다.

```sh theme={null}
supersim fork --chains=op,base,zora --interop.enabled
```

## 다음 단계

* OP Stack 환경을 재현하는 데 사용되는 Supersim [포함된 컨트랙트](https://docs.optimism.io/ko/app-developers/reference/tools/supersim/included-contracts.md)를 살펴보십시오.

- derivation pipeline을 우회하는 훨씬 간단한 방식으로 Supersim에서 [트랜잭션을 입금(디파짓)하는 방법](https://docs.optimism.io/ko/app-developers/tutorials/bridging/deposit-transactions.md)을 알아보십시오.
