Setup
Welcome to the Quickstart!
This section is designed for developers new to ZKsync and gives you the options of deploying to either a local node or a testnet using the most popular smart contract development frameworks.
You will learn how to:
Get setup with either the testnet or a local node.
Build an ERC-20 token contract.
Deploy the smart contract.
Interact with the contract using a script.
Interact with the contract in a simple frontend.
Setup
Choose between using testnet or a local node.
Prerequisites
Before you move onto the next section, make sure that you:
- Have a browser wallet extension installed. If you're not sure what wallet to use, try Metamask.
- Have configured the ZKsync OS Developer Preview testnet in your wallet.
- Have bridged at least 0.05 testnet ETH to your wallet on the ZKsync OS Developer Preview network.
Add ZKsync OS Developer Preview to your MetaMask wallet
You can add ZKsync OS Developer Preview to your MetaMask wallet using the button below:
If you are using a different in-browser wallet, the button above may also work for them.
Manually add ZKsync OS Developer Preview
To manually add ZKsync OS Developer Preview as a custom network in your wallet, follow these steps:
- Find the “Add Network” option in your wallet (in MetaMask, you can find this in the networks dropdown).
- Click on “Add Network" and "Add network manually".
- Fill in the following details for the ZKsync OS Developer Preview testnet:
Network details
| Property | Value |
|---|---|
| Network Name | ZKsync OS Developer Preview |
| RPC URL | https://zksync-os-testnet-alpha.zksync.dev/ |
| WebSocket URL | wss://zksync-os-testnet-alpha.zksync.dev/ws |
| Chain ID | 8022833 |
| Currency Symbol | ETH |
| Block Explorer URL | |
| Explorer Verification API | https://block-explorer-api.zksync-os-testnet-alpha.zksync.dev/api |
Get funds for your wallet
Once you have your wallet connected to the ZKsync OS Developer Preview environment, you can bridge testnet ETH from Sepolia Testnet. You can get testnet funds on Sepolia from one of many testnet faucets.
Bridging testnet ETH
The easiest way to bridge funds to the testnet is by using the ZKsync OS Portal to bridge testnet ETH over.
You can also bridge funds in your terminal with cast
or in a script using zksync-js as shown in the examples below.
Bridging with cast
export BRIDGEHUB_ADDRESS=0xc4fd2580c3487bba18d63f50301020132342fdbd
export CHAIN_ID=8022833
export SEPOLIA_RPC=<YOUR_SEPOLIA_RPC_ENDPOINT>
export ADDRESS=<YOUR_WALLET_ADDRESS>
export VALUE_TO_BRIDGE=<AMOUNT_TO_BRIDGE_IN_WEI>
cast send -r $SEPOLIA_RPC $BRIDGEHUB_ADDRESS "requestL2TransactionDirect((uint256,uint256,address,uint256,bytes,uint256,uint256,bytes[],address))" "($CHAIN_ID,$VALUE_TO_BRIDGE,$ADDRESS,50,0x,300000,800,[],$ADDRESS)" --value $VALUE_TO_BRIDGE --private-key=$PRIVATE_KEY
Bridging with zksync-js
You can find examples for bridging with ethers or viem in the zksync-js docs.