Skip to main content

1. Prerequisites

  • You have Bun installed.
  • A funded L1 wallet with ETH for both the deposit amount and L1 gas fees
Use a test network like Sepolia for experimentation.

2. Installation

Choose your adapter and install the SDK + adapter package:
Create a .env file in your project root:
Never commit your .env file to source control.

3. Write the deposit script

4. Run it

Execute the script using bun.
You’ll see logs for the L1 transaction, then L2 execution, followed by updated balances.

5. Troubleshooting

  • Insufficient funds on L1: Ensure enough ETH for the deposit and L1 gas.
  • Invalid PRIVATE_KEY: Must be 0x + 64 hex chars.
  • Stuck at wait(…, { for: 'l2' }): Verify L2_RPC_URL and network health; check sdk.deposits.status(handle) to see the current phase.
  • ERC-20 deposits: Make sure you have an L1 token deployed and a sufficient balance.