Fees
Users are charged a fee to transact on the OMG Network. The OMG Network supports a variety of different tokens that the fee can be paid with. The fees charged are currently pegged to some factor of the gas price of ETH. This can be updated as transaction volume on the network grows.
Supported Tokens
There are two ways to find a list of supported tokens:
Block explorer of the corresponding environment
Calling the
getFees
function using one of the available libraries.omg-js
includes a helper method to call thefees.all
endpoint on the Watcher. Note that the returned response will be indexed by the transaction type.
Fees must meet the exact amount defined in the fee spec, or the transaction will be rejected.
Merge transactions are free and fees are not charged. It is highly encouraged for users to maintain the smallest count of UTXOs possible. This acts as a mitigation for the mass exit vulnerability.
The
getFees
function returns an array that contains numbered objects with the following structure:
Defining Fees in a Transaction
Because fees cannot be explicitly defined in a transaction, they are implicit in the difference between transaction inputs and outputs.
For example:
Alice has
UTXO1
worth 100 wei.Alice wants to send 10 WEI to Bob using
UTXO1
inTX1
. This transaction will cost 5 wei in fees.The transaction body of
TX1
is constructed as follows:
Bob receives
UTXO2
of 10 wei as his payment, and Alice receivesUTXO3
as a change from the transaction.As you can see, the difference between the sum of the inputs (100 wei) to the sum of the outputs (95 wei) is the implicit fee (5 wei).
A Multi-Currency Transaction Example
It is possible to make a payment in one currency and pay the fee in another. This is possible as long as the UTXO used to pay the fee is a supported fee token.
For example:
Alice has
UTXO1
worth 100 wei.Alice has
UTXO2
worth 100 OMG.Alice wants to send 10 wei to Bob using
UTXO1
inTX1
and pay the fee using OMG.At current prices, the fee for paying in OMG costs 10 OMG per transaction.
The transaction body of
TX1
is constructed as follows:
Bob receives
UTXO3
of 10 wei as his payment, and Alice receivesUTXO4
andUTXO5
as a change from the transaction.As you can see, the difference between the sum of the inputs (100 wei & 100 OMG) to the sum of the outputs (100 wei && 90 OMG) is the implicit fee (10 OMG).
The most common use cases for defining custom fees are during merging or splitting UTXOs. You can find more details and demo project here.
Last updated