You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Metatransactions are coming to the Cosmos SDK to solve a fundamental issue with cross-chain UX: transactions fees.
Each chain accepts only a restricted set of denoms to pay for transactions fees (e.g. ATOM on the Cosmos Hub, AKT on Akash, LUNA and UST on Terra, etc.). The problem is that users generally own a few assets, and not necessarily the ones they need to pay for fees. For example, if a user does not own ROWAN, they can't trade using Sifchain DEX.
To solve this, the SDK will introduce a new type of transaction: metatransactions. Metatransactions are transactions that are signed by the end-user without a transaction fee. Instead of a fee, they can add a tip in whatever currency they own. Then, anyone (in most cases, it will be a backend service that we operate) can pick it up, add a transaction fee countersign the tx and broadcast it. When the tx is processed on chain, whoever signed the tx fee will automatically claim the provided tip.
Example: User A wants to do a simple swap on Sifchain DEX, but they only own ATOM. In this example, we assume the standard tx fee on Sifchain is 0.1 ROWAN, worth $0.1
(frontend)
User A creates a metatransaction for the swap, and adds a tip of 0.05 ATOM, worth $0.11.
User A signs the metatransaction, which is sent to Emeris backend.
(backend)
3. The metatx functionality in Emeris backend picks up the tx, checks that the tip is sufficient.
4. The metatx function adds a transaction fee of 0.1 ROWAN, countersigns the tx.
5. The tx is broadcasted to Sifchain
6. Transaction is processed, Emeris backend balance looses 0.1 ROWAN and gains 0.05 ATOM.
Description of the Metatx Backend Service
First, we will need a separate endpoint for broadcasting metatxs from the frontend. This endpoint relays the metatx to the Metatx Backend Service (called Service in the rest of this issue), which processes it.
In the first version, the Service will do the following:
Run /simulate on the tx, which checks validity of the tx and returns gas estimation.
If /simulate returns without error, fetch the fee token for the chain the tx needs to be submitted to from the CNS, as well as the gas-price for this token.
Multiply the gas value returned by /simulate with the gas-price obtained previously. Convert the value to dollars using the price oracle.
Convert the value of the tip provided in the metatx in dollars using the price oracle.
In later versions, we will want to make this service a P2P service, i.e. enable third parties to act as metatx relayers themselves. This is needed primarily for legal reasons.
In essence, we "just" need to add a step 2.5. to the process above:
2.5. broadcast raw metatx to peers
Obviously, we would need to open source this service as a standalone software.
The text was updated successfully, but these errors were encountered:
Context
Metatransactions are coming to the Cosmos SDK to solve a fundamental issue with cross-chain UX: transactions fees.
Each chain accepts only a restricted set of denoms to pay for transactions fees (e.g. ATOM on the Cosmos Hub, AKT on Akash, LUNA and UST on Terra, etc.). The problem is that users generally own a few assets, and not necessarily the ones they need to pay for fees. For example, if a user does not own ROWAN, they can't trade using Sifchain DEX.
To solve this, the SDK will introduce a new type of transaction: metatransactions. Metatransactions are transactions that are signed by the end-user without a transaction fee. Instead of a fee, they can add a tip in whatever currency they own. Then, anyone (in most cases, it will be a backend service that we operate) can pick it up, add a transaction fee countersign the tx and broadcast it. When the tx is processed on chain, whoever signed the tx fee will automatically claim the provided tip.
Example: User A wants to do a simple swap on Sifchain DEX, but they only own ATOM. In this example, we assume the standard tx fee on Sifchain is 0.1 ROWAN, worth $0.1
(frontend)
(backend)
3. The metatx functionality in Emeris backend picks up the tx, checks that the tip is sufficient.
4. The metatx function adds a transaction fee of 0.1 ROWAN, countersigns the tx.
5. The tx is broadcasted to Sifchain
6. Transaction is processed, Emeris backend balance looses 0.1 ROWAN and gains 0.05 ATOM.
Description of the Metatx Backend Service
First, we will need a separate endpoint for broadcasting metatxs from the frontend. This endpoint relays the metatx to the Metatx Backend Service (called Service in the rest of this issue), which processes it.
In the first version, the Service will do the following:
Evolution of the Backend Service
In later versions, we will want to make this service a P2P service, i.e. enable third parties to act as metatx relayers themselves. This is needed primarily for legal reasons.
In essence, we "just" need to add a step 2.5. to the process above:
2.5. broadcast raw metatx to peers
Obviously, we would need to open source this service as a standalone software.
The text was updated successfully, but these errors were encountered: