Comparing ens with optimism
ens
View full →Author
@0xinit
Stars
53
Repository
0xinit/cryptoskills
ENS (Ethereum Name Service)
ENS maps human-readable names (alice.eth) to Ethereum addresses, content hashes, and arbitrary metadata. It is the identity layer for Ethereum — used for wallets, dApps, and onchain profiles. The architecture separates the registry (who owns a name) from resolvers (what data a name points to).
What You Probably Got Wrong
- ENS uses
namehash, not plain strings -- The registry and resolvers never see "alice.eth" as a string. Names are normalized (UTS-46), then hashed with the recursivenamehashalgorithm (EIP-137). If you pass a raw string to a contract call, it will not work. viem handles this automatically in its ENS actions but you must usenamehash()andlabelhash()for direct contract calls. - Registry vs Resolver vs Registrar -- three different contracts -- The Registry tracks name ownership and which resolver to use. The Resolver stores records (address, text, contenthash). The Registrar handles
.ethname registration and renewal. Confusing these is the most common ENS integration bug. .ethregistrar uses commit-reveal, not a single transaction -- Registration requires two transactions separated by at least 60 seconds: firstcommit(secret), wait, thenregister(name, owner, duration, secret, ...). This prevents frontrunning. Skipping the wait or reusing a secret will revert.- Reverse resolution is opt-in -- An address only has a "primary name" if the owner explicitly set it via the Reverse Registrar. Do not assume every address has a reverse record. Always handle
nullreturns fromgetEnsName(). - Name Wrapper changes ownership semantics -- Since 2023, ENS names can be "wrapped" as ERC-1155 tokens via the Name Wrapper contract. Wrapped names have fuses that permanently restrict operations (cannot unwrap, cannot set resolver, etc.). Check
isWrappedbefore assuming standard ownership patterns. - CCIP-Read (ERC-3668) enables offchain resolution -- Resolvers can return an
OffchainLookuperror that instructs the client to fetch data from an offchain gateway and verify it onchain. This powers offchain subdomains, L2 resolution, and gasless record updates. viem handles CCIP-Read automatically. - Wildcard resolution (ENSIP-10) is real -- Resolvers can implement
resolve(bytes name, bytes data)to handle any subdomain dynamically, even ones not explicitly registered. This is how services like cb.id and lens.xyz work. - ENS names expire --
.ethnames require annual renewal. Expired names enter a 90-day grace period, then a 21-day premium auction, then become available. Do not cache resolution results indefinitely. normalize()before any ENS operation -- Names must be UTS-46 normalized before hashing. "Alice.ETH" and "alice.eth" produce different hashes. viem normalizes automatically, but if you build raw calldata you must normalize first using@adraffy/ens-normalize.
Quick Start
Installation
npm install viem
viem has built-in ENS support -- no additional packages needed for resolution.
Forward Resolution (Name to Address)
import { createPublicClient, http } from "viem";
import { mainnet } from "viem/chains";
const client = createPublicClient({
chain: mainnet,
transport: http(process.env.RPC_URL),
});
const address = await client.getEnsAddress({
name: "vitalik.eth",
});
// "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
Reverse Resolution (Address to Name)
const name = await client.getEnsName({
address: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
});
// "vitalik.eth" (or null if no primary name set)
Get Avatar
const avatar = await client.getEnsAvatar({
name: "vitalik.eth",
});
// HTTPS URL to avatar image, or null
Name Resolution
Forward Resolution with Coin Types
ENS can store addresses for any blockchain, not just Ethereum. Each chain has a SLIP-44 coin type.
const ethAddress = await client.getEnsAddress({
name: "vitalik.eth",
});
// BTC address (coin type 0)
const btcAddress = await client.getEnsAddress({
name: "vitalik.eth",
coinType: 0,
});
// Solana address (coin type 501)
const solAddress = await client.getEnsAddress({
name: "vitalik.eth",
coinType: 501,
});
Text Records
ENS text records store arbitrary key-value metadata. Standard keys are defined in ENSIP-5.
const twitter = await client.getEnsText({
name: "vitalik.eth",
key: "com.twitter",
});
const github = await client.getEnsText({
name: "vitalik.eth",
key: "com.github",
});
const email = await client.getEnsText({
name: "vitalik.eth",
key: "email",
});
const url = await client.getEnsText({
name: "vitalik.eth",
key: "url",
});
const description = await client.getEnsText({
name: "vitalik.eth",
key: "description",
});
// Avatar is also a text record (ENSIP-12 supports NFT references)
const avatarRecord = await client.getEnsText({
name: "vitalik.eth",
key: "avatar",
});
// Can be HTTPS URL, IPFS URI, or NFT reference like
// "eip155:1/erc721:0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d/1234"
Standard Text Record Keys
| Key | Description |
|---|---|
email | Email address |
url | Website URL |
avatar | Avatar image (HTTPS, IPFS, or NFT reference) |
description | Short bio |
display | Display name (may differ from ENS name) |
com.twitter | Twitter/X handle |
com.github | GitHub username |
com.discord | Discord username |
org.telegram | Telegram handle |
notice | Contract notice text |
keywords | Comma-separated keywords |
header | Profile header/banner image |
Content Hash
import { createPublicClient, http, parseAbi } from "viem";
import { mainnet } from "viem/chains";
import { namehash } from "viem/ens";
const client = createPublicClient({
chain: mainnet,
transport: http(process.env.RPC_URL),
});
const RESOLVER_ABI = parseAbi([
"function contenthash(bytes32 node) view returns (bytes)",
]);
const node = namehash("vitalik.eth");
// First get the resolver address
const resolverAddress = await client.getEnsResolver({
name: "vitalik.eth",
});
const contenthash = await client.readContract({
address: resolverAddress,
abi: RESOLVER_ABI,
functionName: "contenthash",
args: [node],
});
// Encoded content hash (IPFS, Swarm, Arweave, etc.)
Batch Resolution with Multicall
import { createPublicClient, http, parseAbi } from "viem";
import { mainnet } from "viem/chains";
import { namehash } from "viem/ens";
const client = createPublicClient({
chain: mainnet,
transport: http(process.env.RPC_URL),
});
const RESOLVER_ABI = parseAbi([
"function addr(bytes32 node) view returns (address)",
"function text(bytes32 node, string key) view returns (string)",
]);
const node = namehash("vitalik.eth");
const resolverAddress = await client.getEnsResolver({
name: "vitalik.eth",
});
const results = await client.multicall({
contracts: [
{
address: resolverAddress,
abi: RESOLVER_ABI,
functionName: "addr",
args: [node],
},
{
address: resolverAddress,
abi: RESOLVER_ABI,
functionName: "text",
args: [node, "com.twitter"],
},
{
address: resolverAddress,
abi: RESOLVER_ABI,
functionName: "text",
args: [node, "com.github"],
},
{
address: resolverAddress,
abi: RESOLVER_ABI,
functionName: "text",
args: [node, "url"],
},
],
});
const [addr, twitter, github, url] = results.map((r) => r.result);
Registration
Commit-Reveal Process
ENS .eth registration uses a two-step commit-reveal to prevent frontrunning. You must wait at least 60 seconds between commit and register.
import {
createPublicClient,
createWalletClient,
http,
parseAbi,
encodePacked,
keccak256,
parseEther,
} from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { mainnet } from "viem/chains";
const ETH_REGISTRAR_CONTROLLER =
"0x253553366Da8546fC250F225fe3d25d0C782303b" as const;
const CONTROLLER_ABI = parseAbi([
"function rentPrice(string name, uint256 duration) view returns (tuple(uint256 base, uint256 premium))",
"function available(string name) view returns (bool)",
"function makeCommitment(string name, address owner, uint256 duration, bytes32 secret, address resolver, bytes[] data, bool reverseRecord, uint16 ownerControlledFuses) pure returns (bytes32)",
"function commit(bytes32 commitment) external",
"function register(string name, address owner, uint256 duration, bytes32 secret, address resolver, bytes[] data, bool reverseRecord, uint16 ownerControlledFuses) payable",
]);
const PUBLIC_RESOLVER = "0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63" as const;
const account = privateKeyToAccount(
process.env.PRIVATE_KEY as `0x${string}`
);
const client = createPublicClient({
chain: mainnet,
transport: http(process.env.RPC_URL),
});
const walletClient = createWalletClient({
account,
chain: mainnet,
transport: http(process.env.RPC_URL),
});
async function registerName(label: string, durationSeconds: bigint) {
// 1. Check availability
const isAvailable = await client.readContract({
address: ETH_REGISTRAR_CONTROLLER,
abi: CONTROLLER_ABI,
functionName: "available",
args: [label],
});
if (!isAvailable) throw new Error(`${label}.eth is not available`);
// 2. Get price
const rentPrice = await client.readContract({
address: ETH_REGISTRAR_CONTROLLER,
abi: CONTROLLER_ABI,
functionName: "rentPrice",
args: [label, durationSeconds],
});
// Add 10% buffer for price fluctuation during commit-reveal wait
const totalPrice =
((rentPrice.base + rentPrice.premium) * 110n) / 100n;
// 3. Generate secret (random 32 bytes)
const secret = keccak256(
encodePacked(["address", "uint256"], [account.address, BigInt(Date.now())])
);
// 4. Create commitment
const commitment = await client.readContract({
address: ETH_REGISTRAR_CONTROLLER,
abi: CONTROLLER_ABI,
functionName: "makeCommitment",
args: [
label,
account.address,
durationSeconds,
secret,
PUBLIC_RESOLVER,
[], // data (encoded resolver calls to set records at registration)
true, // reverseRecord (set as primary name)
0, // ownerControlledFuses (0 = no fuses)
],
});
// 5. Submit commitment
const commitHash = await walletClient.writeContract({
address: ETH_REGISTRAR_CONTROLLER,
abi: CONTROLLER_ABI,
functionName: "commit",
args: [commitment],
});
await client.waitForTransactionReceipt({ hash: commitHash });
console.log("Commitment submitted. Waiting 60 seconds...");
// 6. Wait at least 60 seconds (minCommitmentAge)
await new Promise((resolve) => setTimeout(resolve, 65_000));
// 7. Register
const registerHash = await walletClient.writeContract({
address: ETH_REGISTRAR_CONTROLLER,
abi: CONTROLLER_ABI,
functionName: "register",
args: [
label,
account.address,
durationSeconds,
secret,
PUBLIC_RESOLVER,
[],
true,
0,
],
value: totalPrice,
});
const receipt = await client.waitForTransactionReceipt({
hash: registerHash,
});
if (receipt.status !== "success") {
throw new Error("Registration transaction reverted");
}
console.log(`Registered ${label}.eth for ${durationSeconds / 31536000n} year(s)`);
return receipt;
}
// Register for 1 year (365 days in seconds)
await registerName("myname", 31536000n);
Renewal
const CONTROLLER_ABI_RENEW = parseAbi([
"function rentPrice(string name, uint256 duration) view returns (tuple(uint256 base, uint256 premium))",
"function renew(string name, uint256 duration) payable",
]);
async function renewName(label: string, durationSeconds: bigint) {
const rentPrice = await client.readContract({
address: ETH_REGISTRAR_CONTROLLER,
abi: CONTROLLER_ABI_RENEW,
functionName: "rentPrice",
args: [label, durationSeconds],
});
// 5% buffer for price changes
const totalPrice = ((rentPrice.base + rentPrice.premium) * 105n) / 100n;
const hash = await walletClient.writeContract({
address: ETH_REGISTRAR_CONTROLLER,
abi: CONTROLLER_ABI_RENEW,
functionName: "renew",
args: [label, durationSeconds],
value: totalPrice,
});
const receipt = await client.waitForTransactionReceipt({ hash });
if (receipt.status !== "success") {
throw new Error("Renewal transaction reverted");
}
console.log(`Renewed ${label}.eth for ${durationSeconds / 31536000n} year(s)`);
return receipt;
}
Check Price Before Registering
async function getRegistrationCost(
label: string,
durationSeconds: bigint
): Promise<{ base: bigint; premium: bigint; total: bigint }> {
const rentPrice = await client.readContract({
address: ETH_REGISTRAR_CONTROLLER,
abi: CONTROLLER_ABI,
functionName: "rentPrice",
args: [label, durationSeconds],
});
return {
base: rentPrice.base,
premium: rentPrice.premium,
total: rentPrice.base + rentPrice.premium,
};
}
Working with Resolvers
Setting Text Records
import {
createPublicClient,
createWalletClient,
http,
parseAbi,
} from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { mainnet } from "viem/chains";
import { namehash } from "viem/ens";
const PUBLIC_RESOLVER = "0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63" as const;
const RESOLVER_ABI = parseAbi([
"function setText(bytes32 node, string key, string value) external",
"function setAddr(bytes32 node, address addr) external",
"function setAddr(bytes32 node, uint256 coinType, bytes value) external",
"function setContenthash(bytes32 node, bytes hash) external",
"function multicall(bytes[] data) external returns (bytes[])",
]);
const account = privateKeyToAccount(
process.env.PRIVATE_KEY as `0x${string}`
);
const client = createPublicClient({
chain: mainnet,
transport: http(process.env.RPC_URL),
});
const walletClient = createWalletClient({
account,
chain: mainnet,
transport: http(process.env.RPC_URL),
});
const node = namehash("myname.eth");
// Set a single text record
const hash = await walletClient.writeContract({
address: PUBLIC_RESOLVER,
abi: RESOLVER_ABI,
functionName: "setText",
args: [node, "com.twitter", "myhandle"],
});
await client.waitForTransactionReceipt({ hash });
Batch Update Records with Multicall
Setting multiple records in a single transaction using the resolver's built-in multicall.
import { encodeFunctionData } from "viem";
const node = namehash("myname.eth");
const calls = [
encodeFunctionData({
abi: RESOLVER_ABI,
functionName: "setText",
args: [node, "com.twitter", "myhandle"],
}),
encodeFunctionData({
abi: RESOLVER_ABI,
functionName: "setText",
args: [node, "com.github", "mygithub"],
}),
encodeFunctionData({
abi: RESOLVER_ABI,
functionName: "setText",
args: [node, "url", "https://mysite.com"],
}),
encodeFunctionData({
abi: RESOLVER_ABI,
functionName: "setText",
args: [node, "email", "me@mysite.com"],
}),
encodeFunctionData({
abi: RESOLVER_ABI,
functionName: "setText",
args: [node, "avatar", "https://mysite.com/avatar.png"],
}),
];
const hash = await walletClient.writeContract({
address: PUBLIC_RESOLVER,
abi: RESOLVER_ABI,
functionName: "multicall",
args: [calls],
});
const receipt = await client.waitForTransactionReceipt({ hash });
if (receipt.status !== "success") {
throw new Error("Multicall record update reverted");
}
Setting the Primary Name (Reverse Record)
const REVERSE_REGISTRAR = "0xa58E81fe9b61B5c3fE2AFD33CF304c454AbFc7Cb" as const;
const REVERSE_ABI = parseAbi([
"function setName(string name) external returns (bytes32)",
]);
const hash = await walletClient.writeContract({
address: REVERSE_REGISTRAR,
abi: REVERSE_ABI,
functionName: "setName",
args: ["myname.eth"],
});
await client.waitForTransactionReceipt({ hash });
Subdomains
Creating an Onchain Subdomain
import { parseAbi } from "viem";
import { namehash, labelhash } from "viem/ens";
const ENS_REGISTRY = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" as const;
const REGISTRY_ABI = parseAbi([
"function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external",
"function owner(bytes32 node) view returns (address)",
"function resolver(bytes32 node) view returns (address)",
]);
const parentNode = namehash("myname.eth");
const subLabel = labelhash("sub");
const hash = await walletClient.writeContract({
address: ENS_REGISTRY,
abi: REGISTRY_ABI,
functionName: "setSubnodeRecord",
args: [
parentNode,
subLabel,
account.address, // owner of sub.myname.eth
PUBLIC_RESOLVER, // resolver
0n, // TTL
],
});
await client.waitForTransactionReceipt({ hash });
// sub.myname.eth now exists and points to PUBLIC_RESOLVER
Offchain Subdomains (CCIP-Read / ERC-3668)
Offchain subdomains let you issue unlimited subdomains without gas costs. The resolver responds with an OffchainLookup error that directs the client to a gateway URL. The gateway returns signed data that is verified onchain.
This is how services like cb.id (Coinbase), uni.eth (Uniswap), and lens.xyz work.
For offchain resolution, viem handles CCIP-Read transparently -- no client-side changes needed:
// Resolving an offchain subdomain works identically to onchain names
const address = await client.getEnsAddress({
name: "myuser.cb.id",
});
// viem automatically:
// 1. Calls resolver.resolve(...)
// 2. Catches OffchainLookup revert
// 3. Fetches from the gateway URL
// 4. Calls resolver with the gateway proof
// 5. Returns the verified address
const avatar = await client.getEnsAvatar({
name: "myuser.cb.id",
});
To build your own offchain resolver, implement ERC-3668:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import {IExtendedResolver} from "@ensdomains/ens-contracts/contracts/resolvers/profiles/IExtendedResolver.sol";
/// @notice Offchain resolver that delegates lookups to a gateway
/// @dev Implements ERC-3668 (CCIP-Read) and ENSIP-10 (wildcard resolution)
contract OffchainResolver is IExtendedResolver {
string public url;
address public signer;
error OffchainLookup(
address sender,
string[] urls,
bytes callData,
bytes4 callbackFunction,
bytes extraData
);
constructor(string memory _url, address _signer) {
url = _url;
signer = _signer;
}
/// @notice ENSIP-10 wildcard resolve entry point
function resolve(
bytes calldata name,
bytes calldata data
) external view returns (bytes memory) {
string[] memory urls = new string[](1);
urls[0] = url;
revert OffchainLookup(
address(this),
urls,
data,
this.resolveWithProof.selector,
abi.encode(name, data)
);
}
/// @notice Callback that verifies the gateway signature
function resolveWithProof(
bytes calldata response,
bytes calldata extraData
) external view returns (bytes memory) {
// Verify signature from gateway matches expected signer
// Return decoded result
// Implementation depends on your signing scheme
}
}
Contract Addresses
Ethereum Mainnet. Last verified: 2025-03-01.
| Contract | Address | Purpose |
|---|---|---|
| ENS Registry | 0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e | Core registry -- maps names to owners and resolvers |
| Public Resolver | 0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63 | Default resolver for address, text, contenthash, and ABI records |
| ETH Registrar Controller | 0x253553366Da8546fC250F225fe3d25d0C782303b | Handles .eth name registration and renewal (commit-reveal) |
| Name Wrapper | 0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401 | Wraps names as ERC-1155 tokens with permission fuses |
| Reverse Registrar | 0xa58E81fe9b61B5c3fE2AFD33CF304c454AbFc7Cb | Manages reverse records (address-to-name mapping) |
| Base Registrar (NFT) | 0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85 | ERC-721 NFT for .eth second-level names |
| Universal Resolver | 0xce01f8eee7E30F8E3BfC1C22bCBc01faBc8680E4 | Batch resolution with CCIP-Read support |
Address Constants for TypeScript
const ENS_ADDRESSES = {
registry: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",
publicResolver: "0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63",
ethRegistrarController: "0x253553366Da8546fC250F225fe3d25d0C782303b",
nameWrapper: "0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401",
reverseRegistrar: "0xa58E81fe9b61B5c3fE2AFD33CF304c454AbFc7Cb",
baseRegistrar: "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85",
universalResolver: "0xce01f8eee7E30F8E3BfC1C22bCBc01faBc8680E4",
} as const satisfies Record<string, `0x${string}`>;
Sepolia Testnet
Last verified: 2025-03-01.
| Contract | Address |
|---|---|
| ENS Registry | 0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e |
| Public Resolver | 0x8FADE66B79cC9f707aB26799354482EB93a5B7dD |
| ETH Registrar Controller | 0xFED6a969AaA60E4961FCD3EBF1A2e8913DeBe6c7 |
| Name Wrapper | 0x0635513f179D50A207757E05759CbD106d7dFcE8 |
| Reverse Registrar | 0xA0a1AbcDAe1a2a4A2EF8e9113Ff0e02DD81DC0C6 |
Error Handling
Common Resolution Errors
async function safeResolve(name: string) {
try {
const address = await client.getEnsAddress({ name });
if (!address) {
console.log(`${name} has no address record set`);
return null;
}
return address;
} catch (error) {
if (error instanceof Error) {
// Name does not exist or is malformed
if (error.message.includes("Could not find resolver")) {
console.log(`${name} is not registered or has no resolver`);
return null;
}
// CCIP-Read gateway failure
if (error.message.includes("OffchainLookup")) {
console.log(`Offchain resolution failed for ${name}`);
return null;
}
}
throw error;
}
}
Common Registration Errors
| Error | Cause | Fix |
|---|---|---|
CommitmentTooNew | Called register() less than 60s after commit() | Wait at least 60 seconds between commit and register |
CommitmentTooOld | Commitment expired (older than 24 hours) | Submit a new commitment |
NameNotAvailable | Name is registered or in grace period | Check available() first |
DurationTooShort | Duration under minimum (28 days) | Use at least 2419200 seconds |
InsufficientValue | Sent less ETH than rentPrice() requires | Add a 5-10% buffer to rentPrice() result |
Unauthorised | Caller is not the name owner | Verify ownership via registry before writing records |
Validating ENS Names
import { normalize } from "viem/ens";
function isValidEnsName(name: string): boolean {
try {
normalize(name);
return true;
} catch {
return false;
}
}
// normalize() throws on invalid names
// Valid: "alice.eth", "sub.alice.eth", "alice.xyz"
// Invalid: names with zero-width characters, confusable Unicode, etc.
Key Constants
| Constant | Value | Notes |
|---|---|---|
| Min commitment age | 60 seconds | Wait between commit and register |
| Max commitment age | 86400 seconds (24h) | Commitment expires after this |
| Min registration duration | 2419200 seconds (28 days) | Shortest allowed registration |
| Grace period | 90 days | After expiry, owner can still renew |
| Premium auction | 21 days | After grace period, decaying price auction |
Namehash of eth | 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae | Used as parent node for .eth names |
References
- ENS Documentation -- official docs covering architecture, resolution, registration, and CCIP-Read
- EIP-137: ENS -- core ENS specification (registry, namehash, resolvers)
- EIP-181: Reverse Resolution -- reverse registrar and addr.reverse namespace
- EIP-2304: Multichain Address Resolution -- SLIP-44 coin type support in resolvers
- ERC-3668: CCIP-Read -- offchain data retrieval standard
- ENSIP-5: Text Records -- standardized text record keys
- ENSIP-10: Wildcard Resolution -- dynamic subdomain resolution
- ENSIP-12: Avatar Text Records -- NFT and IPFS avatar specification
- ENS Deployments -- official contract addresses per network
- viem ENS Actions -- built-in ENS resolution in viem
- @adraffy/ens-normalize -- reference UTS-46 normalization library used by viem
optimism
View full →Author
@0xinit
Stars
53
Repository
0xinit/cryptoskills
Optimism
Optimism is an EVM-equivalent Layer 2 using optimistic rollups. Transactions execute on L2 with data posted to Ethereum L1 for security. The OP Stack is the modular framework powering OP Mainnet, Base, Zora, Mode, and the broader Superchain. Smart contracts deploy identically to Ethereum — no custom compiler, no special opcodes.
What You Probably Got Wrong
- OP Mainnet IS EVM-equivalent, not just EVM-compatible — Your Solidity contracts deploy without modification. No
--legacyflag, no custom compiler.forge createandhardhat deploywork identically to Ethereum. If someone tells you to change your Solidity for "OP compatibility", they are wrong. - Gas has two components, not one — Every transaction pays L2 execution gas AND an L1 data fee for posting calldata/blobs to Ethereum. If you only estimate L2 gas via
eth_estimateGas, your cost estimate will be wrong. The L1 data fee often dominates total cost. Use theGasPriceOraclepredeploy at0x420000000000000000000000000000000000000F. - L2→L1 withdrawals take 7 days, not minutes — L1→L2 deposits finalize in ~1-3 minutes. L2→L1 withdrawals require a 7-day challenge period (the "fault proof window"). Users must prove the withdrawal, wait 7 days, then finalize. Three separate transactions on L1. If your UX assumes instant bridging both ways, it is broken.
block.numberreturns the L2 block number, not L1 — On OP Mainnet,block.numberis the L2 block number. To get the L1 block number, read theL1Blockpredeploy at0x4200000000000000000000000000000000000015. L2 blocks are produced every 2 seconds.msg.senderworks normally — there is notx.originaliasing on L2 — Cross-domain messages from L1 to L2 alias the sender address (add0x1111000000000000000000000000000000001111). But for normal L2 transactions,msg.senderbehaves exactly like Ethereum. Only worry about aliasing when receiving L1→L2 messages in your contract.- Predeploy contracts live at fixed addresses starting with
0x4200...— These are NOT deployed by you. They exist at genesis.L2CrossDomainMessenger,L2StandardBridge,GasPriceOracle,L1Block, and others all live at hardcoded addresses in the0x4200...range. Do not try to deploy them. - The sequencer is centralized but cannot steal funds — The sequencer orders transactions and proposes state roots. If it goes down, you cannot submit new transactions until it recovers (or until permissionless fault proofs allow forced inclusion). But the sequencer cannot forge invalid state — the fault proof system protects withdrawals.
- EIP-4844 blob data changed the gas model — After the Ecotone upgrade (March 2024), OP Mainnet posts data using EIP-4844 blobs instead of calldata. This reduced L1 data fees by ~10-100x. The
GasPriceOraclemethods changed. If you are reading pre-Ecotone documentation, the fee formulas are outdated. - SuperchainERC20 is not a standard ERC20 — It is a cross-chain token standard for OP Stack chains that enables native interop between Superchain members. Tokens must implement
ICrosschainERC20withcrosschainMintandcrosschainBurn. Do not assume a regular ERC20 works across chains.
Quick Start
Chain Configuration
import { defineChain } from "viem";
import { optimism, optimismSepolia } from "viem/chains";
// OP Mainnet is built-in
// Chain ID: 10
// RPC: https://mainnet.optimism.io
// Explorer: https://optimistic.etherscan.io
// OP Sepolia is also built-in
// Chain ID: 11155420
// RPC: https://sepolia.optimism.io
// Explorer: https://sepolia-optimistic.etherscan.io
Environment Setup
# .env
PRIVATE_KEY=your_private_key_here
OP_MAINNET_RPC=https://mainnet.optimism.io
OP_SEPOLIA_RPC=https://sepolia.optimism.io
ETHERSCAN_API_KEY=your_optimistic_etherscan_api_key
Viem Client Setup
import { createPublicClient, createWalletClient, http } from "viem";
import { optimism } from "viem/chains";
import { privateKeyToAccount } from "viem/accounts";
const account = privateKeyToAccount(`0x${process.env.PRIVATE_KEY}`);
const publicClient = createPublicClient({
chain: optimism,
transport: http(process.env.OP_MAINNET_RPC),
});
const walletClient = createWalletClient({
account,
chain: optimism,
transport: http(process.env.OP_MAINNET_RPC),
});
Chain Configuration
| Property | OP Mainnet | OP Sepolia |
|---|---|---|
| Chain ID | 10 | 11155420 |
| Currency | ETH | ETH |
| RPC | https://mainnet.optimism.io | https://sepolia.optimism.io |
| Explorer | https://optimistic.etherscan.io | https://sepolia-optimistic.etherscan.io |
| Block time | 2 seconds | 2 seconds |
| Withdrawal period | 7 days | ~12 seconds (testnet) |
Alternative RPCs
| Provider | Endpoint |
|---|---|
| Alchemy | https://opt-mainnet.g.alchemy.com/v2/<KEY> |
| Infura | https://optimism-mainnet.infura.io/v3/<KEY> |
| QuickNode | Custom endpoint per project |
| Conduit | https://rpc.optimism.io |
Deployment
OP Mainnet is EVM-equivalent. Deploy exactly as you would to Ethereum.
Foundry
# Deploy to OP Mainnet
forge create src/MyContract.sol:MyContract \
--rpc-url $OP_MAINNET_RPC \
--private-key $PRIVATE_KEY \
--broadcast
# Deploy with constructor args
forge create src/MyToken.sol:MyToken \
--rpc-url $OP_MAINNET_RPC \
--private-key $PRIVATE_KEY \
--constructor-args "MyToken" "MTK" 18 \
--broadcast
# Deploy via script
forge script script/Deploy.s.sol:DeployScript \
--rpc-url $OP_MAINNET_RPC \
--private-key $PRIVATE_KEY \
--broadcast \
--verify \
--etherscan-api-key $ETHERSCAN_API_KEY
Hardhat
// hardhat.config.ts
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
const config: HardhatUserConfig = {
solidity: "0.8.24",
networks: {
optimism: {
url: process.env.OP_MAINNET_RPC || "https://mainnet.optimism.io",
accounts: [process.env.PRIVATE_KEY!],
},
optimismSepolia: {
url: process.env.OP_SEPOLIA_RPC || "https://sepolia.optimism.io",
accounts: [process.env.PRIVATE_KEY!],
},
},
etherscan: {
apiKey: {
optimisticEthereum: process.env.ETHERSCAN_API_KEY!,
optimisticSepolia: process.env.ETHERSCAN_API_KEY!,
},
},
};
export default config;
npx hardhat run scripts/deploy.ts --network optimism
Verification
Foundry
# Verify after deployment
forge verify-contract <DEPLOYED_ADDRESS> src/MyContract.sol:MyContract \
--chain-id 10 \
--etherscan-api-key $ETHERSCAN_API_KEY
# Verify with constructor args
forge verify-contract <DEPLOYED_ADDRESS> src/MyToken.sol:MyToken \
--chain-id 10 \
--etherscan-api-key $ETHERSCAN_API_KEY \
--constructor-args $(cast abi-encode "constructor(string,string,uint8)" "MyToken" "MTK" 18)
Hardhat
npx hardhat verify --network optimism <DEPLOYED_ADDRESS> "MyToken" "MTK" 18
Blockscout
OP Mainnet also has a Blockscout explorer at https://optimism.blockscout.com. Verification works via the standard Blockscout API — set the verifier URL in Foundry:
forge verify-contract <DEPLOYED_ADDRESS> src/MyContract.sol:MyContract \
--verifier blockscout \
--verifier-url https://optimism.blockscout.com/api/
Cross-Chain Messaging
The CrossDomainMessenger is the canonical way to send arbitrary messages between L1 and L2. It handles replay protection, sender authentication, and gas forwarding.
Architecture
L1 → L2 (Deposits):
User → L1CrossDomainMessenger → OptimismPortal → L2CrossDomainMessenger → Target
L2 → L1 (Withdrawals):
User → L2CrossDomainMessenger → L2ToL1MessagePasser → [7 day wait] → OptimismPortal → L1CrossDomainMessenger → Target
L1 → L2 Message (Deposit)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface IL1CrossDomainMessenger {
function sendMessage(
address _target,
bytes calldata _message,
uint32 _minGasLimit
) external payable;
}
contract L1Sender {
IL1CrossDomainMessenger public immutable messenger;
constructor(address _messenger) {
messenger = IL1CrossDomainMessenger(_messenger);
}
/// @notice Send a message from L1 to a contract on L2.
/// @param l2Target The L2 contract address to call.
/// @param message The calldata to send to the L2 target.
/// @param minGasLimit Minimum gas for L2 execution. Overestimate — unused gas is NOT refunded to L1.
function sendToL2(
address l2Target,
bytes calldata message,
uint32 minGasLimit
) external payable {
messenger.sendMessage{value: msg.value}(l2Target, message, minGasLimit);
}
}
L2 → L1 Message (Withdrawal)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface IL2CrossDomainMessenger {
function sendMessage(
address _target,
bytes calldata _message,
uint32 _minGasLimit
) external payable;
function xDomainMessageSender() external view returns (address);
}
contract L2Sender {
/// @dev L2CrossDomainMessenger predeploy address — same on all OP Stack chains
IL2CrossDomainMessenger public constant MESSENGER =
IL2CrossDomainMessenger(0x4200000000000000000000000000000000000007);
function sendToL1(
address l1Target,
bytes calldata message,
uint32 minGasLimit
) external payable {
MESSENGER.sendMessage{value: msg.value}(l1Target, message, minGasLimit);
}
}
Receiving Cross-Chain Messages
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface ICrossDomainMessenger {
function xDomainMessageSender() external view returns (address);
}
contract L2Receiver {
ICrossDomainMessenger public constant MESSENGER =
ICrossDomainMessenger(0x4200000000000000000000000000000000000007);
address public immutable l1Sender;
constructor(address _l1Sender) {
l1Sender = _l1Sender;
}
modifier onlyFromL1Sender() {
require(
msg.sender == address(MESSENGER) &&
MESSENGER.xDomainMessageSender() == l1Sender,
"Not authorized L1 sender"
);
_;
}
function handleMessage(uint256 value) external onlyFromL1Sender {
// Process the cross-chain message
}
}
Sender Aliasing
When an L1 contract sends a message to L2, the apparent msg.sender on L2 is the aliased address:
l2Sender = l1ContractAddress + 0x1111000000000000000000000000000000001111
The CrossDomainMessenger handles un-aliasing internally. If you bypass the messenger and send directly via OptimismPortal, you must account for aliasing yourself.
Predeploy Contracts
These contracts exist at genesis on every OP Stack chain. Do not deploy them — they are already there.
| Contract | Address | Purpose |
|---|---|---|
| L2ToL1MessagePasser | 0x4200000000000000000000000000000000000016 | Initiates L2→L1 withdrawals |
| L2CrossDomainMessenger | 0x4200000000000000000000000000000000000007 | Sends/receives cross-chain messages |
| L2StandardBridge | 0x4200000000000000000000000000000000000010 | Bridges ETH and ERC20 tokens |
| L2ERC721Bridge | 0x4200000000000000000000000000000000000014 | Bridges ERC721 tokens |
| GasPriceOracle | 0x420000000000000000000000000000000000000F | L1 data fee calculation |
| L1Block | 0x4200000000000000000000000000000000000015 | Exposes L1 block info on L2 |
| WETH9 | 0x4200000000000000000000000000000000000006 | Wrapped ETH |
| L1BlockNumber | 0x4200000000000000000000000000000000000013 | L1 block number (deprecated, use L1Block) |
| SequencerFeeVault | 0x4200000000000000000000000000000000000011 | Collects sequencer fees |
| BaseFeeVault | 0x4200000000000000000000000000000000000019 | Collects base fees |
| L1FeeVault | 0x420000000000000000000000000000000000001A | Collects L1 data fees |
| GovernanceToken | 0x4200000000000000000000000000000000000042 | OP token on L2 |
Reading L1 Block Info
interface IL1Block {
function number() external view returns (uint64);
function timestamp() external view returns (uint64);
function basefee() external view returns (uint256);
function hash() external view returns (bytes32);
function batcherHash() external view returns (bytes32);
function l1FeeOverhead() external view returns (uint256);
function l1FeeScalar() external view returns (uint256);
function blobBaseFee() external view returns (uint256);
function baseFeeScalar() external view returns (uint32);
function blobBaseFeeScalar() external view returns (uint32);
}
// Usage
IL1Block constant L1_BLOCK = IL1Block(0x4200000000000000000000000000000000000015);
uint64 l1BlockNumber = L1_BLOCK.number();
uint256 l1BaseFee = L1_BLOCK.basefee();
Gas Model
Every OP Mainnet transaction pays two fees:
- L2 execution fee — Standard EVM gas, priced by L2
basefee+ optional priority fee. Calculated identically to Ethereum. - L1 data fee — Cost of posting the transaction's data to Ethereum L1 as calldata or blob data. This is the OP-specific component.
Post-Ecotone Formula (Current)
After the Ecotone upgrade (March 2024), L1 data fee uses a two-component formula based on calldata gas and blob gas:
l1DataFee = (l1BaseFeeScalar * l1BaseFee * 16 + l1BlobBaseFeeScalar * l1BlobBaseFee) * compressedTxSize / 1e6
l1BaseFee— Ethereum L1 base fee (fromL1Blockpredeploy)l1BlobBaseFee— EIP-4844 blob base fee (fromL1Blockpredeploy)l1BaseFeeScalar— System-configured scalar for calldata cost componentl1BlobBaseFeeScalar— System-configured scalar for blob cost componentcompressedTxSize— Estimated compressed size of the signed transaction
GasPriceOracle
interface IGasPriceOracle {
/// @notice Estimate L1 data fee for raw signed transaction bytes
function getL1Fee(bytes memory _data) external view returns (uint256);
/// @notice Get current L1 base fee (read from L1Block)
function l1BaseFee() external view returns (uint256);
/// @notice Ecotone: get blob base fee
function blobBaseFee() external view returns (uint256);
/// @notice Ecotone: get base fee scalar
function baseFeeScalar() external view returns (uint32);
/// @notice Ecotone: get blob base fee scalar
function blobBaseFeeScalar() external view returns (uint32);
/// @notice Check if Ecotone is active
function isEcotone() external view returns (bool);
/// @notice Check if Fjord is active
function isFjord() external view returns (bool);
/// @notice Fjord: estimate compressed size using FastLZ
function getL1GasUsed(bytes memory _data) external view returns (uint256);
}
IGasPriceOracle constant GAS_ORACLE =
IGasPriceOracle(0x420000000000000000000000000000000000000F);
Estimating Total Cost in TypeScript
import { createPublicClient, http, parseAbi } from "viem";
import { optimism } from "viem/chains";
const client = createPublicClient({
chain: optimism,
transport: http(),
});
const GAS_ORACLE = "0x420000000000000000000000000000000000000F" as const;
const gasPriceOracleAbi = parseAbi([
"function getL1Fee(bytes memory _data) external view returns (uint256)",
"function l1BaseFee() external view returns (uint256)",
"function blobBaseFee() external view returns (uint256)",
"function baseFeeScalar() external view returns (uint32)",
"function blobBaseFeeScalar() external view returns (uint32)",
]);
async function estimateTotalCost(serializedTx: `0x${string}`) {
const [l2GasEstimate, gasPrice, l1DataFee] = await Promise.all([
client.estimateGas({ data: serializedTx }),
client.getGasPrice(),
client.readContract({
address: GAS_ORACLE,
abi: gasPriceOracleAbi,
functionName: "getL1Fee",
args: [serializedTx],
}),
]);
const l2ExecutionFee = l2GasEstimate * gasPrice;
const totalFee = l2ExecutionFee + l1DataFee;
return {
l2ExecutionFee,
l1DataFee,
totalFee,
};
}
Gas Optimization Tips
- Minimize calldata: the L1 data fee scales with transaction data size. Fewer bytes = lower L1 fee.
- Use
0bytes when possible: zero bytes cost 4 gas in calldata vs 16 gas for non-zero bytes. - Batch operations: one large transaction costs less in L1 data fee overhead than many small ones.
- After Ecotone, blob pricing makes L1 data fees much cheaper and more stable than pre-Ecotone calldata pricing.
Standard Bridge
The Standard Bridge enables ETH and ERC20 transfers between L1 and L2. It is a pair of contracts: L1StandardBridge on Ethereum and L2StandardBridge (predeploy) on OP Mainnet.
Bridge ETH: L1 → L2
interface IL1StandardBridge {
/// @notice Bridge ETH to L2. Appears at recipient address on L2 after ~1-3 min.
function depositETH(uint32 _minGasLimit, bytes calldata _extraData) external payable;
/// @notice Bridge ETH to a different address on L2.
function depositETHTo(
address _to,
uint32 _minGasLimit,
bytes calldata _extraData
) external payable;
}
Bridge ETH: L2 → L1
interface IL2StandardBridge {
/// @notice Initiate ETH withdrawal to L1. Requires prove + finalize after 7 days.
function withdraw(
address _l2Token,
uint256 _amount,
uint32 _minGasLimit,
bytes calldata _extraData
) external payable;
}
// Withdraw ETH from L2 to L1
// _l2Token = 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000 (legacy ETH representation)
// Send ETH as msg.value, set _amount to the same value
Bridge ERC20: L1 → L2
interface IL1StandardBridge {
/// @notice Bridge ERC20 to L2. Token must have a corresponding L2 representation.
function depositERC20(
address _l1Token,
address _l2Token,
uint256 _amount,
uint32 _minGasLimit,
bytes calldata _extraData
) external;
function depositERC20To(
address _l1Token,
address _l2Token,
uint256 _amount,
address _to,
uint32 _minGasLimit,
bytes calldata _extraData
) external;
}
Bridge ERC20: L2 → L1
interface IL2StandardBridge {
function withdraw(
address _l2Token,
uint256 _amount,
uint32 _minGasLimit,
bytes calldata _extraData
) external payable;
function withdrawTo(
address _l2Token,
address _to,
uint256 _amount,
uint32 _minGasLimit,
bytes calldata _extraData
) external payable;
}
Withdrawal Lifecycle (L2 → L1)
Every L2→L1 withdrawal requires three L1 transactions:
- Initiate — Call
withdrawonL2StandardBridgeorL2CrossDomainMessenger. Produces a withdrawal hash. - Prove — After the L2 output root containing your withdrawal is proposed on L1 (~1 hour), call
proveWithdrawalTransactiononOptimismPortal. - Finalize — After the 7-day challenge period, call
finalizeWithdrawalTransactiononOptimismPortal.
import { getWithdrawals, getL2Output } from "viem/op-stack";
// After initiating withdrawal on L2, get the receipt
const l2Receipt = await publicClient.getTransactionReceipt({ hash: l2TxHash });
// Build withdrawal proof (after output root is proposed, ~1 hour)
const output = await getL2Output(l1Client, {
l2BlockNumber: l2Receipt.blockNumber,
targetChain: optimism,
});
// Prove on L1
const proveHash = await walletClient.proveWithdrawal({
output,
withdrawal: withdrawals[0],
targetChain: optimism,
});
// Wait 7 days, then finalize on L1
const finalizeHash = await walletClient.finalizeWithdrawal({
withdrawal: withdrawals[0],
targetChain: optimism,
});
SuperchainERC20
SuperchainERC20 is a cross-chain token standard enabling native token transfers between OP Stack chains in the Superchain. Tokens implementing this standard can move between chains without traditional bridge locking.
Interface
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/// @notice Interface for tokens that support cross-chain transfers within the Superchain.
interface ICrosschainERC20 {
/// @notice Emitted when tokens are minted via a cross-chain transfer.
event CrosschainMint(address indexed to, uint256 amount, address indexed sender);
/// @notice Emitted when tokens are burned for a cross-chain transfer.
event CrosschainBurn(address indexed from, uint256 amount, address indexed sender);
/// @notice Mint tokens on this chain as part of a cross-chain transfer.
/// @dev Only callable by the SuperchainTokenBridge.
function crosschainMint(address _to, uint256 _amount) external;
/// @notice Burn tokens on this chain to initiate a cross-chain transfer.
/// @dev Only callable by the SuperchainTokenBridge.
function crosschainBurn(address _from, uint256 _amount) external;
}
Implementation
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {ICrosschainERC20} from "./ICrosschainERC20.sol";
/// @dev SuperchainTokenBridge predeploy address — same on all OP Stack chains
address constant SUPERCHAIN_TOKEN_BRIDGE = 0x4200000000000000000000000000000000000028;
contract MySuperchainToken is ERC20, ICrosschainERC20 {
constructor() ERC20("MySuperchainToken", "MST") {
_mint(msg.sender, 1_000_000 * 1e18);
}
function crosschainMint(address _to, uint256 _amount) external override {
require(msg.sender == SUPERCHAIN_TOKEN_BRIDGE, "Only bridge");
_mint(_to, _amount);
emit CrosschainMint(_to, _amount, msg.sender);
}
function crosschainBurn(address _from, uint256 _amount) external override {
require(msg.sender == SUPERCHAIN_TOKEN_BRIDGE, "Only bridge");
_burn(_from, _amount);
emit CrosschainBurn(_from, _amount, msg.sender);
}
}
Cross-Chain Transfer Flow
- User calls
SuperchainTokenBridge.sendERC20on the source chain - Bridge calls
crosschainBurnon the token contract (burns on source) - A cross-chain message is relayed to the destination chain
- Bridge calls
crosschainMinton the destination chain's token contract (mints on destination)
OP Stack
The OP Stack is the modular, open-source framework for building L2 blockchains. OP Mainnet, Base, Zora, Mode, and others are all OP Stack chains forming the Superchain.
Key Components
| Component | Description |
|---|---|
| op-node | Consensus client — derives L2 blocks from L1 data |
| op-geth | Execution client — modified go-ethereum |
| op-batcher | Posts transaction data to L1 (calldata or blobs) |
| op-proposer | Proposes L2 output roots to L1 |
| op-challenger | Runs fault proof games to challenge invalid proposals |
Superchain
The Superchain is a network of OP Stack chains sharing:
- Bridge contracts on L1
- Sequencer coordination
- Governance via the Optimism Collective
- Interoperability messaging
Current Superchain members include OP Mainnet, Base, Zora, Mode, Fraxtal, Metal, and others. All share the same upgrade path and security model.
Building a Custom OP Chain
Use the OP Stack to launch your own chain:
# Clone the optimism monorepo
git clone https://github.com/ethereum-optimism/optimism.git
cd optimism
# Install dependencies
pnpm install
# Configure your chain (edit deploy-config)
# Deploy L1 contracts
# Start op-node, op-geth, op-batcher, op-proposer
Refer to the OP Stack Getting Started Guide for complete chain deployment.
Governance
The Optimism Collective governs the protocol through a bicameral system:
- Token House — OP token holders vote on protocol upgrades, incentive programs, and treasury allocations
- Citizens' House — Soulbound "citizen" badges vote on retroactive public goods funding (RetroPGF)
OP Token
| Property | Value |
|---|---|
| Address (L2) | 0x4200000000000000000000000000000000000042 |
| Address (L1) | 0x4200000000000000000000000000000000000042 is the L2 predeploy; L1 address is 0x4200000000000000000000000000000000000042 bridged |
| Total supply | 4,294,967,296 (2^32) |
| Type | Governance only (no fee burn or staking yield) |
Delegation
OP token holders delegate voting power to active governance participants:
import { parseAbi } from "viem";
const opTokenAbi = parseAbi([
"function delegate(address delegatee) external",
"function delegates(address account) external view returns (address)",
"function getVotes(address account) external view returns (uint256)",
]);
const OP_TOKEN = "0x4200000000000000000000000000000000000042" as const;
// Delegate voting power
const hash = await walletClient.writeContract({
address: OP_TOKEN,
abi: opTokenAbi,
functionName: "delegate",
args: [delegateAddress],
});
Key Differences from Ethereum
| Feature | Ethereum | OP Mainnet |
|---|---|---|
| Block time | 12 seconds | 2 seconds |
| Gas pricing | Single base fee | L2 execution + L1 data fee |
block.number | L1 block number | L2 block number |
| Finality | ~15 minutes (2 epochs) | 7 days for L2→L1 (challenge period) |
| Sequencing | Decentralized validators | Centralized sequencer (OP Labs) |
PREVRANDAO | Beacon chain randomness | Sequencer-set value (NOT random, do NOT use for randomness) |
PUSH0 | Supported (Shanghai+) | Supported |
block.difficulty | Always 0 post-merge | Always 0 |
Opcodes Differences
PREVRANDAO(formerlyDIFFICULTY) — Returns the sequencer-set value, NOT true randomness. Never use for on-chain randomness. Use Chainlink VRF or a commit-reveal scheme.ORIGIN/CALLER— Work normally for L2 transactions. For L1→L2 deposits, theoriginis aliased (see Sender Aliasing).- All other opcodes behave identically to Ethereum.
Unsupported Features
- No native account abstraction (EIP-4337) — Use third-party bundlers (Pimlico, Alchemy, Stackup).
- No
eth_getProofwith pending block tag — Uselatestinstead.