ERC-6358 · Review · ERC · 2023-01-17
ERC-6358: Cross-Chain Token States Synchronization
Defines an "omniverse" token whose state is kept in sync across many chains via signed, nonce-ordered transactions relayed by off-chain synchronizers, instead of locking and minting through a bridge.
What problem does it solve?
Typical token bridges lock tokens on chain A and mint a wrapped copy on chain B. Liquidity ends up fragmented across many wrapped versions, and if the bridge or the other chain fails, the wrapped tokens can lose their backing.
ERC-6358 takes a different approach: synchronize state instead of moving tokens. Every participating chain keeps a full copy of the token's ledger. A user signs one transaction, it is executed on every chain, and all copies converge. The authors argue that as long as Ethereum keeps running, users' balances there remain valid even if other chains go down.
How it works
Omniverse account (o-account). Users are identified by a chain-independent public key, recommended to be a secp256k1 public key, with a mapping to local addresses on each chain.
Omniverse transaction (o-transaction). A struct signed by the user:
struct ERC6358TransactionData {
uint128 nonce; // must be the account's current nonce + 1
uint32 chainId; // chain where it was initiated
bytes initiateSC; // contract where it was initiated
bytes from; // o-account public key
bytes payload; // app-defined, e.g. (op, exData, amount)
bytes signature;
}
For fungible tokens, the recommended payload is op (0 transfer, 1 mint, 2 burn), exData (recipient) and amount. NFTs use tokenId instead of amount.
Flow.
- The user submits an o-transaction on any chain via
sendOmniverseTransaction. The contract checks the signature, nonce and balance, emitsTransactionSent, and does not execute it yet. - Off-chain synchronizers see it and deliver the same signed data to the contracts on other chains, competing for a reward set by the token deployer.
- After a waiting period, each chain executes it, and the account nonce advances everywhere.
If a user signs two different o-transactions with the same nonce on two chains, synchronizers propagate both, every chain sees the conflict, and the waiting period gives time to reject it.
Sample code
Core interface and a fungible read from TypeScript (ethers v6):
import { Contract, JsonRpcProvider } from "ethers";
const abi = [
"function getTransactionCount(bytes pk) view returns (uint256)",
"function omniverseBalanceOf(bytes pk) view returns (uint256)",
"function getChainId() view returns (uint32)",
"event TransactionSent(bytes pk, uint256 nonce)",
];
const provider = new JsonRpcProvider(process.env.RPC_URL);
const token = new Contract(process.env.OMNI_TOKEN!, abi, provider);
const pk = process.env.O_ACCOUNT_PUBKEY!; // 64-byte secp256k1 public key, hex
const nonce = await token.getTransactionCount(pk); // next o-transaction uses nonce + 1
const balance = await token.omniverseBalanceOf(pk);
console.log({ chain: await token.getChainId(), nonce, balance });
Things to know
- Status: Review. The interface is not final and may change.
- Security depends on the off-chain synchronizers and the waiting period. The spec assumes there are always honest synchronizers online; if delivery stalls past the waiting period, the conflicting transaction may already have executed and must be reverted by implementation-specific means.
- Punishing a cheating user (locking accounts, etc.) is left to each deployment, not defined by the standard.
- It is designed to coexist with ERC-20 or ERC-721 interfaces, but the omniverse balance and the local ERC balance are separate concepts that implementations must keep consistent.
- Signing may follow EIP-712 or a plain keccak256 over concatenated fields; check which scheme a given token uses.