> ## 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`을 사용하면 멀티체인 기능을 **로컬**에서 테스트할 수 있습니다. 이전에는 멀티체인 기능을 테스트하려면 복잡한 docker 설정이 필요하거나 testnet을 사용해야 했습니다. 실제 사용 방법을 확인하기 위해 이 튜토리얼에서는 L1에서 L2로 ETH를 보내는 과정을 안내합니다.

## L1에서 L2로 ETH 입금(디파짓)하기 (L1에서 L2로의 메시지 전달)

**1. L2(chain 901)의 초기 잔액 확인하기**

L2에서 발신자 계정의 잔액을 조회합니다.

```sh theme={null}
cast balance 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --rpc-url http://127.0.0.1:9545
```

**2. Ether 보내기**

이 작업은 `OptimismPortal` 또는 `L1StandardBridge`의 두 가지 방법 중 하나로 수행할 수 있습니다.

#### 첫 번째 방법: `OptimismPortal`

* 해당 L2의 `OptimismPortal` 컨트랙트(chain 900에 있음)로 Ether를 보냅니다.

> [!NOTE]
>
> chain 901의 경우 컨트랙트는 `0x37a418800d0c812A9dE83Bc80e993A6b76511B57`입니다.

* L1에서 bridge 트랜잭션을 시작합니다.

```sh theme={null}
cast send 0x37a418800d0c812A9dE83Bc80e993A6b76511B57 --value 0.1ether --rpc-url http://127.0.0.1:8545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
```

#### 두 번째 방법: `L1StandardBridge`

* L1(chain 900)에 있는 해당 L2의 `L1StandardBridgeProxy` / `L1StandardBridge` 컨트랙트에서 `bridgeETH` 함수를 호출합니다.

> [!NOTE]
>
> chain 901의 경우 컨트랙트는 `0x8d515eb0e5F293B16B6bBCA8275c060bAe0056B0`입니다.

* L1에서 bridge 트랜잭션을 시작합니다.

```sh theme={null}
cast send 0x8d515eb0e5F293B16B6bBCA8275c060bAe0056B0 "bridgeETH(uint32 _minGasLimit, bytes calldata _extraData)" 50000 0x --value 0.1ether --rpc-url http://127.0.0.1:8545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
```

**3. L2(chain 901)의 잔액 확인하기**

L2에서 발신자의 ETH 잔액이 증가했는지 확인합니다.

```sh theme={null}
cast balance 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --rpc-url http://127.0.0.1:9545
```

## chain 901에서 902로 상호운용 가능한 ERC20 토큰 보내기 (L2에서 L2로의 메시지 전달)

일반적인 L2 간 크로스체인 전송에는 두 개의 트랜잭션이 필요합니다.

1. 소스 체인의 전송 트랜잭션 – Chain 901에서 토큰 전송을 시작합니다.
2. 대상 체인의 메시지 릴레이 트랜잭션 – 전송 세부 정보를 Chain 902로 릴레이합니다.

이 과정을 단순화하려면 `--interop.autorelay` 플래그를 사용할 수 있습니다. 이 플래그는 소스 체인에서 최초 전송 트랜잭션이 완료되면 메시지 릴레이 트랜잭션을 자동으로 트리거합니다. 따라서 릴레이 메시지를 수동으로 보낼 필요가 없어 개발자 경험이 향상됩니다.

**1. autorelayer를 활성화하여 `supersim` 시작하기**

```sh theme={null}
  supersim --interop.autorelay 
```

**2. chain 901에서 전송할 토큰 발행하기**

다음 명령을 실행하여 수신자 주소로 테스트 ERC20 토큰 1000개를 발행합니다.

```sh theme={null}
cast send 0x420beeF000000000000000000000000000000001 "mint(address _to, uint256 _amount)"  0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 1000  --rpc-url http://127.0.0.1:9545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80

```

**3. chain 901에서 전송 트랜잭션 시작하기**

다음 명령을 사용하여 Chain 901에서 Chain 902로 토큰을 보냅니다.

```sh theme={null}
cast send 0x4200000000000000000000000000000000000028 "sendERC20(address _token, address _to, uint256 _amount, uint256 _chainId)" 0x420beeF000000000000000000000000000000001 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 1000 902 --rpc-url http://127.0.0.1:9545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
```

**4. chain 902에 릴레이된 메시지가 나타날 때까지 기다리기**

몇 초 후 chain 902에서 RelayedMessage를 확인할 수 있습니다.

```sh theme={null}
# example
INFO [08-30|14:30:14.698] SuperchainTokenBridge#RelayERC20 token=0x420beeF000000000000000000000000000000001 from=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 to=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 amount=1000 source=901
```

**5. chain 902의 잔액 확인하기**

chain 902에서 테스트 ERC20의 잔액이 증가했는지 확인합니다.

```sh theme={null}
cast balance --erc20 0x420beeF000000000000000000000000000000001 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --rpc-url http://127.0.0.1:9546
```

위 단계를 통해 `supersim`을 사용하여 L1에서 L2로의 ETH bridge와 L2 간 상호운용 가능한 ERC20 토큰 전송을 모두 로컬에서 성공적으로 완료했습니다. 이 방식은 멀티체인 테스트를 단순화하여, 복잡한 설정이나 외부 testnet에 의존하지 않고 개발에 집중할 수 있게 해 줍니다.

## 다음 단계

* [vanilla(non-forked) 모드](https://docs.optimism.io/ko/app-developers/reference/tools/supersim/vanilla.md) 또는 [forked 모드](https://docs.optimism.io/ko/app-developers/reference/tools/supersim/fork.md)로 Supersim을 시작하는 방법을 알아보십시오.
* OP Stack 환경을 재현하는 데 사용되는 Supersim의 [포함된 컨트랙트](https://docs.optimism.io/ko/app-developers/reference/tools/supersim/included-contracts.md)를 살펴보십시오.
