Build on X Layer
Quickstart

Quickstart#

Welcome to X Layer developer documentation.

X Layer is a zkEVM Layer 2 network built on Ethereum, powered by Polygon CDK - a zkEVM stack for building Ethereum L2 scaling solutions. Developers can easily deploy their existing contracts on zkEVM, and users can move their assets from Ethereum and conduct transactions off-chain. These transactions are bundled into groups with a zero-knowledge proof to verify their validity.

Why build on X Layer?#

  • Boundless scalability: enable ZK-powered DApps on X Layer, with 100% EVM compatibility and easy-to-use developer tools for deployment
  • Powered by OKX: seamless OKX product integrations, all-in-one Web3 gateway, and access to 50M+ users in the OKX ecosystem
  • Security: rely on robust secure mechanisms from Ethereum, with trustless interoperability
  • Low fee: same coding experience as Ethereum, with 100x less in costs
  • Portal to Web3: enter the world of Web3 via OKX Wallet, built with compact infrastructure modules to create innovative DApps
  • Powered by Polygon: zkEVM Layer 2 based on Polygon CDK, ensuring near-instant finality, unified liquidity, and independent data availability

What's the difference between building on X Layer vs. Ethereum for developers?#

Building DApps on X Layer is just like building them on Ethereum. All you have to do is switch to the X Layer RPC and begin your development on X Layer, that offers faster transactions, lower costs, and robust security. X Layer offers a user experience similar to the Ethereum Virtual Machine (EVM) for both developers and users. This means you won't need any new tools or wallets to create or use DApps on zkEVM.

Note
You can visit Polygon's Differences between EVM and zkEVM for detailed differences in terms of supported EIPs, opcodes, and additional changes to build on zkEVM.

Acquiring testnet OKB#

To start building on X Layer, you'll first need some testnet OKB. See the Faucet guide for the steps to get testnet OKB on X Layer.

Connecting to X Layer (Mainnet)#

You can add X Layer mainnet by inputting the following network info:

PropertiesNetwork details
Network nameX Layer mainnet
RPC URLhttps://rpc.xlayer.tech
Chain ID196
Token symbolOKB
Block explorer URLhttps://www.okx.com/explorer/xlayer

Connecting to X Layer (Testnet)#

You can add X Layer testnet by inputting the following network info:

PropertiesNetwork details
Network nameX Layer testnet
RPC URLhttps://testrpc.xlayer.tech
Chain ID195
Token symbolOKB
Block explorer URLhttps://www.okx.com/explorer/xlayer-test

You can connect to the X Layer Testnet through the RPC service provider ZAN Node or simply add X Layer Testnet to MetaMask through Chainlist

The next step is to bridge your assets from Ethereum → X Layer. You can use the X Layer Bridge to bridge your assets.

Deploying smart contracts#

Developing on X Layer is seamless and identical to Ethereum Virtual Machine (EVM). Developers can use their existing code and toolings to deploy on X Layer with much better performance and lower fees. Check out how to deploy smart contracts on X Layer:

Deploy using Hardhat
Guide to deploy contract using Hardhat
Deploy using Truffle
Guide to deploy contract using Truffle
Deploy using Foundry
Guide to deploy contract using Foundry

Developer support#

If you need help with anything related to X Layer, you can raise your questions on our Discord channel:

  1. Join the X Layer Discord server here.
  2. Select "Yes" when asked if you are a developer.
  3. Navigate to the #dev-support channel. You can now contact X Layer tech support staff with your questions and concerns. We will actively monitor for issues and work to resolve them asap.