Scopes, accounts, and sessions
MetaMask Connect Multichain uses three CAIP standards: CAIP-2 scopes (like eip155:1 for Ethereum Mainnet or solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp for Solana Mainnet) to identify chains, CAIP-10 account IDs to identify accounts across chains, and CAIP-25 sessions to group authorized scopes and accounts into a single connection. Understanding these concepts helps you work with the multichain client.
Scopes (CAIP-2)
A scope is a chain identifier in namespace:reference format, as defined by
CAIP-2. It uniquely identifies
a blockchain across any ecosystem.
- The namespace identifies the ecosystem or standard (for example,
eip155for EVM,solanafor Solana). - The reference identifies a specific chain within that namespace.
You use scopes when connecting and when calling
invokeMethod to target a specific chain.
Supported scopes
| Ecosystem | Format | Examples |
|---|---|---|
| EVM | eip155:<chainId> | eip155:1 (Ethereum), eip155:59144 (Linea), eip155:137 (Polygon) |
| Solana | solana:<genesisHash> | solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp (Mainnet), solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1 (Devnet) |
Common EVM scopes
| Network | Scope |
|---|---|
| Ethereum Mainnet | eip155:1 |
| Linea Mainnet | eip155:59144 |
| Base Mainnet | eip155:8453 |
| Polygon Mainnet | eip155:137 |
| Arbitrum One | eip155:42161 |
| Optimism | eip155:10 |
| Sepolia testnet | eip155:11155111 |
Account IDs (CAIP-10)
An account ID extends a scope with an address, in namespace:reference:address format, as defined
by CAIP-10. It uniquely
identifies an account on a specific chain.
| Ecosystem | Example |
|---|---|
| EVM | eip155:1:0xab16a96D359eC26a11e2C2b3d8f8B8942d5Bfcdb |
| Solana | solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp:7S3P4HxJpyyigGzodYwHtCxZyUQe9JiBMHyRWXArAaKv |
To extract the address from a CAIP-10 account ID:
const accountId = 'eip155:1:0xab16a96D359eC26a11e2C2b3d8f8B8942d5Bfcdb'
const address = accountId.split(':')[2]
Sessions (CAIP-25)
A session is an authorized connection between your dapp and MetaMask that spans multiple scopes, as defined by CAIP-25. When a user approves a connection, MetaMask creates a session containing the approved scopes and accounts.
A session includes:
sessionScopes: The chains the user approved, each with its associated accounts.- Persistence: Sessions survive page reloads and new tabs.
- Lifecycle methods: Use
getSessionto retrieve session data anddisconnectto end or modify the session.
const session = await client.getSession()
const ethAccounts = session.sessionScopes['eip155:1']?.accounts || []
const solAccounts = session.sessionScopes['solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp']?.accounts || []
Next steps
- Quickstart: Set up MetaMask Connect Multichain.
- Send transactions: Send transactions on EVM and Solana.
- API reference: Full Multichain API reference.