1/5
_Follow along with the video_ --- ### Introduction In this lesson, we will be **manually deploying on ZKsync Sepolia**. Although scripts are highly recommended in order to avoid mistakes and save funds, we will proceed with typing command directly in the terminal since scripts do not work well on ZKsync at the moment of recording. As usual, we will deploy the contracts `BagelToken` and `MerkleAirdrop`, generate the message hash, sign it, and split our long signature into its _v, r, s_ components. We'll then mint and transfer tokens to the `MerkleAirdrop` contract, claim the tokens from a third party address and finally verify this claim. > 🗒️ **NOTE**:br > In MetaMask, you can create a wallet, for example, "updraft," using keystores where accounts are pre-saved, preventing the need to use the private key directly. For this demonstration, _updraft_ will deploy the contracts while _updraft 2_ will handle token claims. ### Deploying Contracts To deploy both contracts, specify the contract path and the necessary environment variables, then save the contract address as an environment variable: ```bash export ZKSYNC_SEPOLIA_RPC_URL=https://sepolia.era.zksync.dev forge create source/BagelToken --rpc-url ${ZKSYNC_SEPOLIA_RPC_URL} --account updraft --legacy --zksync export TOKEN_ADDRESS=0x7B66C3E36d026232408a655cF7cFdEeFA099D6d0 ``` Next, deploy the `MerkleAirdrop` contract and save its address: ```bash forge create source/MerkleAirdrop --constructor-args ${TOKEN_ADDRESS} ${ROOT_HASH} --rpc-url ${ZKSYNC_SEPOLIA_RPC_URL} --account updraft --legacy --zksync export AIRDROP_ADDRESS=<deployed_airdrop_address> ``` ### Message and Signature To claim tokens, get the message hash and then sign it using the second wallet: ```bash cast call ${AIRDROP_ADDRESS} "getMessageHash(address,uint256)" 0x2ea3970Ed82D5b30be821FAAD4a731D35964F7dd 25000000000000000000 --rpc-url ${ZKSYNC_SEPOLIA_RPC_URL} cast wallet sign --no-hash 0xb37630ae79f68b63ba0240a965dc09dbc188bc082fd2425d70c1885933fd66a1 --account updraft2 ``` After saving the signed message into a `signature.txt` file and removing its `0x` prefix, split it into its _v, r, s_ components with the `SplitSignature` script. Save the three environment variables `V`, `R`, and `S` for later use. ```bash forge script script/SplitSignature.s.sol:SplitSignature ``` ### Minting and Transferring Tokens Before claiming tokens, mint and transfer tokens to the airdrop contract: ```bash cast send ${TOKEN_ADDRESS} "mint(address,uint256)" 0x52d64ED1fd0877797e2030fc914259e052F2bD67 25000000000000000000 --account updraft --rpc-url ${ZKSYNC_SEPOLIA_RPC_URL} cast send ${TOKEN_ADDRESS} "transfer(address,uint256)" ${AIRDROP_ADDRESS} 25000000000000000000 --account updraft --rpc-url ${ZKSYNC_SEPOLIA_RPC_URL} ``` ### Claiming Tokens With everything set, perform the claim operation: ```bash cast send ${AIRDROP_ADDRESS} "claim(address,uint256,bytes32[],uint8,bytes32,bytes32)" 0x2ea3970Ed82D5b30be821FAAD4a731D35964F7dd 25000000000000000000 <proof> ${V} ${R} ${S} "[0x4fd31fee0e75780cd67704fbc43caee70fddcaa43631e2e1bc9fb233fada2394,0x81f0e530b56872b6fc3e10f8873804230663f8407e21cef901b8aeb06a25e5e2]" --account updraft --rpc-url ${ZKSYNC_SEPOLIA_RPC_URL} ``` ### Verifying the Claim To verify the claim, check the balance of the second account. If the balance reflects the claimed amount (25000000000000000000), the process is successful. ```bash cast call ${TOKEN_ADDRESS} "balanceOf(address)" 0x2ea3970Ed82D5b30be821FAAD4a731D35964F7dd --rpc-url ${ZKSYNC_SEPOLIA_RPC_URL} cast --to-dec 0x0000000000000000000000000015af1d78b58c40000 ```
Deploy and claim an airdrop on a zkSync Sepolia!
Previous lesson
Previous
Next lesson
Next
Give us feedback
Obtaining testnet funds -> Tenderly virtual testnets
Last updated on March 31, 2025
Course Overview
About the course
Advanced smart contract development
How to develop a stablecoin
How to develop a DeFi protocol
How to develop a DAO
Advanced smart contracts testing
Fuzz testing
Manual verification
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Security researcher
$49,999 - $120,000 (avg. salary)
Guest lecturers:
Juliette Chevalier
Lead Developer relations at Aragon
Nader Dabit
Director of developer relations at EigenLayer
Ally Haire
Developer relations at Protocol Labs
Harrison
Founder at GasliteGG
Last updated on March 26, 2025
Solidity Developer
Advanced FoundryDuration: 36min
Duration: 3h 06min
Duration: 5h 02min
Duration: 6h 02min
Duration: 2h 47min
Duration: 1h 23min
Duration: 4h 28min
Duration: 1h 19min
Duration: 1h 10min
Course Overview
About the course
Advanced smart contract development
How to develop a stablecoin
How to develop a DeFi protocol
How to develop a DAO
Advanced smart contracts testing
Fuzz testing
Manual verification
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Security researcher
$49,999 - $120,000 (avg. salary)
Guest lecturers:
Juliette Chevalier
Lead Developer relations at Aragon
Nader Dabit
Director of developer relations at EigenLayer
Ally Haire
Developer relations at Protocol Labs
Harrison
Founder at GasliteGG
Last updated on March 26, 2025
Testimonials
Read what our students have to say about this course.
Chainlink
Chainlink
Gustavo Gonzalez
Solutions Engineer at OpenZeppelin
Francesco Andreoli
Lead Devrel at Metamask
Albert Hu
DeForm Founding Engineer
Radek
Senior Developer Advocate at Ceramic
Boidushya
WalletConnect
Idris
Developer Relations Engineer at Axelar