Process an Exit

Processing an exit allows a user to release their funds locked in the Plasma Framework contract. Any exit bonds from the exit game are also paid out at this time.


1. Install omg-js

To access network features from your application, use our official libraries:

React Native

Requires Node >= 8.11.3 < 13.0.0

npm install @omisego/omg-js

You can add omg-js to a website using a script tag:

<script src=""></script>
React Native

You can easily integrate omg-js with React Native projects. First, add this postinstall script to your project's package.json:

"scripts": {
"postinstall": "omgjs-nodeify"

Then install the react native compatible library:

npm install @omisego/react-native-omg-js

2. Import dependencies, define constants

Processing exits involves using 2 omg-js objects. Here's an example of how to instantiate them:

import Web3 from "web3";
import { RootChain, OmgUtil } from "@omisego/omg-js";const web3 = new Web3(new Web3.providers.HttpProvider(web3_provider_url));
const rootChain = new RootChain({ web3, plasmaContractAddress });
const exitProcess = {
currency: "0xd92e713d051c37ebb2561803a3b5fbabc4962431",
maxExits: 1,
address: "0x8CB0DE6206f459812525F2BA043b14155C2230C0",
privateKey: "0xCD55F2A7C476306B27315C7986BC50BD81DB4130D4B5CFD49E3EAF9ED1EDE4F7"
  • web3_provider_url - the URL to a full Ethereum RPC node (local or from infrastructure provider, e.g. Infura).

  • plasmaContractAddress - CONTRACT_ADDRESS_PLASMA_FRAMEWORK for defined environment.

3. Process an exit

Exit processing is the same for both ETH and ERC20 UTXOs. This method demonstrates exit processing for ERC20 funds. If you want to process an ETH exit, change the currency value of the exitProcess object into OmgUtil.transaction.ETH_CURRENCY.

Before you start processing, you can check the exit queue to see how many available exits the OMG Network has at a given moment:

async function processExit() {
const ethQueue = await rootChain.getExitQueue(); if (ethQueue.length) {
const exitReceipt = await rootChain.processExits({
token: exitProcess.currency,
exitId: 0,
maxExitsToProcess: exitProcess.maxExits,
txOptions: {
privateKey: exitProcess.privateKey,
from: exitProcess.address
return exitReceipt;
} else {
console.log("Exit queue is empty");