Build on Somnia with the stack you already use.
Order books, an oracle that resolves questions with AI, agents that validators check, and handlers that run in the same block all run as smart contracts on one EVM network. Build on any of them with Solidity, standard wallets and your existing tooling.
// Somnia mainnet for viemimport { defineChain } from "viem"; export const somnia = defineChain({ id: 5031, name: "Somnia Mainnet", nativeCurrency: { name: "Somnia", symbol: "SOMI", decimals: 18 }, rpcUrls: { default: { http: ["https://api.infra.mainnet.somnia.network"], webSocket: ["wss://api.infra.mainnet.somnia.network/ws"], }, }, blockExplorers: { default: { name: "Somnia Explorer", url: "https://new.explorer.somnia.network" }, },});Network
- Chain ID
- 5031
- Token
- SOMI
- RPC
- api.infra.mainnet.somnia.network
- WebSocket
- wss://…mainnet.somnia.network/ws
- Explorer
- new.explorer.somnia.network
Global testnet
STT
chain ID 50312 · explorer.testnet.somnia.network
Go from testnet to mainnet in three steps.
Mainnet and the Global testnet run the same EVM tooling, so your team can build and test everything before mainnet.
Open the quickstartAdd the network
Use chain ID 5031 for mainnet or 50312 for the Global testnet. Somnia is EVM-compatible, so your existing tooling works.
chainId 5031 · 50312Fund a wallet
Get STT from the testnet faucet, or bridge to mainnet through Stargate, Relay or LI.FI.
faucet · stargate · relay · li.fiDeploy and integrate
Deploy with Foundry, Hardhat or Remix. Then add Reactivity handlers, Agents calls or a Somnia Markets integration.
forge create --rpc-url $SOMNIA_RPC
Set up your coding agent with one prompt.
Paste this prompt into Claude Code, Cursor or any coding agent. It points your agent at the machine-readable docs and sets the rules for working on Somnia, so it builds against the real APIs.
- Docs index firstllms.txt is the source of truth
- Testnet firstasks before mainnet or real funds
- Gas sized per calleth_estimateGas, never Ethereum limits
- No hard-coded decimalsread from the contract
Agent setup
prompt.md
Help me build on Somnia, an EVM-compatible Layer 1. Start by fetching the docs index at https://new.docs.somnia.network/llms.txt (full text at https://docs.somnia.network/llms-full.txt) and treat it as the source of truth for APIs, contracts and addresses.
Networks: mainnet chain ID 5031, RPC https://api.infra.mainnet.somnia.network, explorer https://new.explorer.somnia.network. Global testnet chain ID 50312, RPC https://api.infra.testnet.somnia.network, faucet https://explorer.testnet.somnia.network/faucet.
Gas is paid in SOMI. Do not reuse Ethereum gas limits: reading uncached state costs 1,000,000 gas on Somnia, so always size transactions with eth_estimateGas. Never hard-code token decimals; read them from the contract.
Somnia-native features to use where they fit: Somnia Agents (call APIs, parse websites and run deterministic LLM inference from a contract, with results delivered to a callback), Somnia Reactivity (contracts that run a handler in the same block an event fires), and Somnia Markets (onchain order books; TypeScript SDK @somnia-chain/markets-sdk, docs at https://new.docs.somnia.network/markets/somnia-markets).
Build and test on the Global testnet first. Ask me before deploying to mainnet or spending real funds.
Take each product from first read to production.
Each product row has an explainer to start with, docs to build against and a live tool to run it in production.
Build with coding agents and onchain agents.
Somnia publishes its docs as a machine-readable index. Your coding agents work from the same source as your team, and your contracts call onchain agents directly.
llms.txt
Every docs page in a machine-readable index, so coding agents build against the real APIs.
Open llms.txtAPIs for agents
Somnia Markets puts REST, WebSocket and MCP interfaces in front of its contracts, so agents and automated systems connect the way they already do.
Read the API docsOnchain agents
Your contracts call APIs, run AI models and read websites through Somnia Agents, with a signed receipt for every result.
Agents quickstart
Keep using the tools you build with.
Somnia supports the endpoints, indexers, account abstraction, wallets, oracles and bridges you already use, so your team ships with providers it knows.
See every integrationRPC providers
Connect through the public Somnia endpoints or a third-party provider.
- Somnia public
- PublicNode
- Stakely
- Validation Cloud
Indexing
Query chain data through data APIs. Somnia Markets runs its own shared markets indexer.
- Ormi
- Protofire
Accounts and gas
Cut signing prompts with EIP-7702 and session transactions. Native gas sponsorship is coming soon.
- Thirdweb
Wallets and SDKs
Onboard users with embedded wallets, SDKs and hardware wallet support.
- Privy
- Thirdweb
- Sequence
- Ledger
- Zerion
Oracles
Settle on outcomes with Somnia Oracle, and add third-party price data and VRF.
- Somnia Oracle
- Stork
- Protofire
Bridges
Bring assets onto Somnia today through partner routes. Somnia Bridge is not yet available.
- Stargate (LayerZero)
- Relay
- LI.FI
Read how the core products work.
- ExplainerHow the Somnia Oracle resolves a questionFrom a natural-language question to an immutable onchain answer in minutes: the Somnia Oracle's lifecycle, step by step.Oracles and data6 min read
- ExplainerAgents inside consensus: how Somnia Agents workSomnia Agents let smart contracts call APIs, read websites and run deterministic AI models, with results agreed by a validator subcommittee and every step receipted.AI agents6 min read
- GuideReactivity explained: contracts that respond on their ownSomnia Reactivity runs contract handlers in the same block as the events they react to, and pushes events to apps over WebSocket. A practical guide to both modes.Developers6 min read
Ship your first market on testnet.
Ask the developer community on Discord, or read the docs. For anything else, talk to an expert.
Talk to an expert