Start a Standard Exit
Last updated
Was this helpful?
Last updated
Was this helpful?
Exits allow a user to withdraw funds from the OMG Network back onto the root chain. There are two types of exits: standard exits and in-flight exits. This section will cover standard exits.
A standard exit can be initiated by a user for an output generated by a transaction that was included in a valid block.
To access network features from your application, use our official libraries:
Requires Node >= 8.11.3 < 13.0.0
Staring an exit on the OMG Network involves using 2 omg-js
objects. Here's an example of how to instantiate them:
Exits are processed in queues and contain tokens you can use to start an exit. Before you start an exit, the network has to verify that the exit queue for the token used in the UTXO exists.
The standard exit process is the same for both ETH and ERC20 UTXOs. The tutorial shows how to work with ERC20 tokens. For working with ETH, change
erc20Exit
intoethExit
.
A standard exit creates an exit receipt. The receipt has the following structure:
A user calls the hasToken
function on the PlasmaFramework
contract to check if there's an exit queue for the token in question. If no exit queue is registered, a user needs to register it using the addToken
function. The corresponding PlasmaFramework
contract functions used in this step are hasExitQueue
and addExitQueue
.
A user calls the getExitData
function on the Watcher to get the necessary exit data to start a standard exit. A transaction is termed "exitable" if it is correctly formed and properly signed by the owner(s) of the transaction input(s).
This section provides a demo project that contains a detailed implementation of the tutorial. If you consider integrating with the OMG Network, you can use this sample to significantly reduce the time of development. It also provides step-by-step instructions and sufficient code guidance that is not covered on this page.
To run a full omg-js
code sample for the tutorial, please use the following steps:
Run these commands:
Code samples for all tutorials use the same repository —
omg-js-samples
, thus you have to set up the project and install dependencies only one time.
Last updated on 12/4/2020 by Dmitry Baimuratov
web3_provider_url
- the URL to a full Ethereum RPC node (local or from infrastructure provider, e.g. ).
plasmaContractAddress
- CONTRACT_ADDRESS_PLASMA_FRAMEWORK
for defined .
watcherUrl
- the Watcher Info URL for defined (personal or from OMG Network).
You can exit only 1 UTXO at a time. Consider into 1 UTXO if you don't want to exit all of your funds at once. By default, priority is given to UTXOs that were created the earliest.
Every exit requires an extra fee called an as an incentive mechanism for users of the OMG Network to exit honestly and challenge dishonest exits. The bond is currently fixed at an amount estimated to cover the gas cost of submitting a challenge. You can check the current gas cost at .
gasLimit
- gas limit for your transaction. Please check the current data on or similar resources.
After a standard exit starts, you'll have to wait a certain amount of time before you can process that exit and receive your funds back on Ethereum Network. This time is called a and equals to two minExitPeriod
(2 weeks) on the mainnet and 1 day on the Ropsten testnet (see EXIT_PERIOD
in for the latest info). A challenge period is an incentivized security measure that allows other users to challenge anybody's exits for validity and honesty.
A user calls the startStandardExit
function on the PaymentExitGame
contract and commits an to the exit.
After a a user can this exit.
You can only exit one UTXO at a time. It is therefore recommended to if you would like to exit multiple ones.
Clone repository:
Create .env
file and provide the .
Open your browser at .
Select or on the left side, observe the logs on the right.