building-on-abstract
Building on Abstract
Abstract is a ZK Rollup on ZK Stack with native account abstraction, paymasters, and session keys. The developer experience differs from standard Ethereum in important ways — this skill covers project setup, contract deployment, AGW integration, and the critical EVM differences.
Operating Rules
- Identify whether the task is smart contract development, frontend/SDK integration, or both before recommending tooling.
- Read references/evm-differences.md before advising on contract deployment or Solidity patterns — Abstract's ZKsync VM has significant differences from standard EVM.
- Read references/agw-integration.md for AGW client and React SDK setup.
- Read references/paymaster-guide.md for gasless transaction patterns.
- Read references/network-config.md for RPC URLs, chain IDs, and system contracts.
Quick Start
New project from scratch
npx @abstract-foundation/create-abstract-app@latest my-app
Scaffolds a Next.js app with AGW integration pre-configured.
Smart contract development
| Framework | Install | Notes |
|---|---|---|
| Foundry | foundry-zksync fork |
forge build --zksync, forge create --zksync |
| Hardhat | @matterlabs/hardhat-zksync |
Plugin handles zksolc compilation |
Network configuration
| Network | Chain ID | RPC | Explorer |
|---|---|---|---|
| Mainnet | 2741 | https://api.mainnet.abs.xyz |
https://abscan.org |
| Testnet | 11124 | https://api.testnet.abs.xyz |
https://sepolia.abscan.org |
Contract Deployment via AGW CLI
Preview then deploy:
agw contract deploy --json '{
"abi": [...],
"bytecode": "0x..."
}' --dry-run
agw contract deploy --json '{
"abi": [...],
"bytecode": "0x..."
}' --execute
Verify on Abscan after deployment.
Key Architecture Decisions
Native Account Abstraction
Every account on Abstract is a smart contract implementing IAccount. This is built into the protocol (not ERC-4337). Enables passkey wallets, session keys, batch transactions, and gas sponsorship natively.
Paymasters
Smart contracts that pay gas on behalf of users. Two flows:
- General: Sponsor all transactions (e.g., onboarding)
- Approval-Based: Users pay gas with ERC-20 tokens (e.g., USDC)
Provider: Zyfi (https://zyfi.org)
Session Keys
Temporary, scoped credentials for pre-approved tx execution without user confirmation. Mainnet requires security review + registration with Session Key Policy Registry at 0xA146c7118A46b32aBD0e1ACA41DF4e61061b6b93.
EVM Differences (Critical)
Abstract uses ZKsync VM, not standard EVM. Key differences:
- Contract deployment routes through
ContractDeployersystem contract factoryDepsfield required in deployment transactions- CREATE/CREATE2 address derivation differs from Ethereum
- Gas model: dual off-chain + on-chain cost
- Unsupported opcodes:
SELFDESTRUCT,CALLCODE
Read references/evm-differences.md before writing contracts.
AGW Integration
Client SDK (@abstract-foundation/agw-client)
npm install @abstract-foundation/agw-client viem
Key actions: sendTransaction, writeContract, deployContract, sendCalls (batch), signMessage.
React SDK (@abstract-foundation/agw-react)
npm install @abstract-foundation/agw-react
Key hooks: useLoginWithAbstract, useAbstractClient, useWriteContractSponsored, useCreateSession, useRevokeSessions.
Read references/agw-integration.md for setup details and code examples.
Escalation
- Route transaction execution questions to
executing-agw-transactions. - Route wallet/balance queries to
reading-agw-wallet. - Route Uniswap trading to
trading-on-uniswap. - Route bridging to
bridging-to-abstract.
More from abstract-foundation/agw-cli
mining-with-bigcoin
Interact with the Bigcoin virtual mining game on Abstract — buy facilities, purchase miners, claim rewards, check hashrate, and manage mining operations. Use when a user wants to play Bigcoin, mine $BIG tokens, buy a facility or miner, claim mining rewards, check pending rewards, view hashrate, upgrade their facility, sell miners, or interact with the Bigcoin game contracts on Abstract. Trigger for requests mentioning Bigcoin, $BIG, BIG token, virtual mining, hashrate, facility, miner purchase, mining rewards, claim BIG, or Bigcoin game on Abstract.
22upvoting-on-abstract
Vote for apps on the Abstract Portal using the AbstractVoting contract. Use when a user wants to upvote an app, check remaining votes, see vote counts for apps, check the current epoch or vote cost, or interact with Abstract Portal voting. Trigger for requests mentioning upvote, vote for app, Abstract voting, Portal voting, vote cost, epoch, voteForApp, votes remaining, or app popularity on Abstract.
22reading-agw-wallet
Read AGW wallet identity, balances, and token inventory with field trimming and pagination. Use when a user wants to know which wallet is linked, inspect balances, list tokens, confirm the current account before another workflow, or gather read-only wallet context without blowing the context window. Trigger for requests mentioning `agw wallet address`, `agw wallet balances`, `agw wallet tokens list`, portfolio inspection, token inventory, or linked wallet identity.
21trading-on-uniswap
Compose AGW wallet and contract commands for token swaps, price quotes, and liquidity on Abstract via Uniswap V2 and V3. Use when a user wants to trade tokens, swap ETH for USDC, swap USDC for ETH, check token prices, get swap quotes, add or remove liquidity, or interact with any Uniswap contract on Abstract. Trigger for requests mentioning swap, trade, exchange, Uniswap, DEX, liquidity pool, price quote, token pair, amountOut, slippage, or AGW trading actions on Abstract mainnet or testnet.
21authenticating-with-agw
Bootstrap, inspect, troubleshoot, and revoke AGW sessions through the companion approval flow. Use when a user needs to connect this machine to an AGW wallet, check session readiness, diagnose missing signer or delegated-access issues, inspect local session state, or explicitly revoke access. Trigger for requests mentioning `agw auth init`, `agw session status`, `agw session doctor`, onboarding, companion approval, or session revoke.
21bridging-to-abstract
Guide users through bridging assets to and from Abstract using the native bridge or third-party bridges (Relay, Stargate, Jumper, Symbiosis, thirdweb, deBridge). Use when a user wants to move funds onto Abstract, bridge ETH or tokens from Ethereum or another chain, withdraw from Abstract to L1, get a bridge quote, fund their Abstract wallet from another network, or needs guidance on bridge timing and costs. Trigger for requests mentioning bridge, bridging, deposit, withdraw, fund wallet, move funds, cross-chain transfer, L1 to L2, or any of the bridge providers (Relay, Stargate, Jumper, Symbiosis, deBridge).
21