Gas fee abstraction examples
Requiring end-users of a system to maintain balances of various gas tokens such as ETH or MATIC or other native L1 coins to interact with dApps and other blockchain usage is very often a major blocker for many projects, especially where the end-users are not already crypto users. There are already some implementations of gas fee abstraction and substitution implemented at L1 level, but they come with some significant tradeoffs such as increased gas consumption and spam related problems. The Coinweb protocol has a structurally different execution model that allows for atomic gas-fee abstraction at both the protocol and application level and across different blockchains, wallets and dApp ecosystems. Applying gas-fee abstraction across a wider range of the blockchain ecosystem will further lower the barrier of entry for non-tech-savvy users and likely increase the overall adoption of the technology. For individual projects, it will ease the composability of other dApps allowing users to interact with a larger set of applications within specific projects uniform user experience.
-
Using CWEB to abstract away L1 native fees for writing Coinweb transactions into underlying blockchains.
-
Abstract away CWEB for Coinweb L2 operations by using L2 token - L2 CWEB DEX (bonding curve, liquidity pools).
-
Abstract away L1 fees and CWEB for L1 native transactions for Coinweb enabled L1 tokens by using L1 - Coinweb L2 DEX to exchange L1 token for CWEB.
-
For each covered token spec API (i.e ERC20, ERC721, ERC1155 ..etc) method (transfer,approved, burn...) will have equivalent methods that the user will be able to use without costing him native l1 fees; while using Coinweb enabled software the equivalent methods will look the same as the spec methods.
-
While using Coinweb enabled software, on Coinweb enabled L1 tokens, it will be possible to use Uniswap (and Uniswap compatible) smartcontract without using native l1 gas. It will NOT be possible to use it without native l1 gas when using Uniswap frontend.
-
It will be possible to use any contract using well-defined gas-less standards like ERC2771
-
It will be possible to construct a (Gnosis) Safe-like contract for a user and power any external action by this Safe without using L1 gas.
-
-
Abstract away L1 fees and CWEB for L1 native transactions for non-Coinweb enabled L1 tokens by using L1 - Coinweb L2 dex to exchange L1 token for CWEB.
Terminology around wrapping
The term wrapping is used in several different contexts, below is a clarification for this document
Common usage of the term wrapped coins or tokens:
Typically a wrapped coin is a representation of a coin or token from one chain that can be used on a different chain. The best example of this is probably Wrapped Bitcoin that is an ERC20 token on the Ethereum blockchain, where one Wrapped Bitcoin (WBTC) on the Ethereum chain represents one native Bitcoin on the Bitcoin chain. There are several ways that the wrapping mechanism can work. It can be done using bridges and smart contracts, or it can be done more manually. In the case of WBTC it works as follows: The WBTC ecosystem consists of custodians, merchants and customers. Merchants buy and sell Bitcoin and WBTC between Custodians and customers. The custodians hold native Bitcoin in custody and also mint and burn WBTC according to the amount of native Bitcoin they hold in custody. The following processes happen when customers buy or sell WBTC (or something similar)
WBTC wrapping example
Customer wants to buy WBTC with native Bitcoin:
- The customer requests to buy WBTC from a merchant and includes their Ethereum address in the request
- The merchant verifies the customer and sends them a Bitcoin deposit address
- The customer sends native Bitcoin to the merchant on the Bitcoin blockchain
- The merchant sends the native Bitcoin to the Custodian and requests that the custodian mints the corresponding amount of WBTC on the Ethereum blockchain
- !Wrapping happens here! The Custodian receives the Bitcoin on the Bitcoin blockchain and mints an equivalent amount of WBTC on the Ethereum blockchain
- The merchant receives the newly minted WBTC on the Ethereum blockchain and sends it to the customers Ethereum address on the Ethereum blockchain.
Customer wants to sell WBTC on the Ethereum chain and receive native Bitcoin on the Bitcoin blockchain:
- The customer requests to sell WBTC to a merchant and includes their Bitcoin address in the request
- The merchant verifies the customer and gives them an Ethereum deposit address
- The customer sends WBTC to the merchant on the Ethereum Blockchain
- The merchant sends the WBTC to the custodian and requests to receive the corresponding amount of native Bitcoin on the Bitcoin blockchain
- !Unwrapping happens here! The custodian receives the WBTC on the Ethereum blockchain and burns the WBTC
- The Custodian sends the corresponding amount of native Bitcoin to the merchant on the Bitcoin blockchain
- The merchant sends the native Bitcoin to the customers wallet
Wrapping/unwrapping with bridges. The above example of WBTC is a centralised solution. Decentralised solutions are typically implemented as bridges. These bridges work in much as the same way as the merchants and custodians in the WBTC example. But instead of merchants and custodians, the system is made of smart contracts that can lock and mint or burn and mint tokens on the source and destination blockchains. The locking/burning/minting in the smart contracts are controlled by nodes that have to sign for the smart contracts to execute the wrapping and unwrapping. Typically, these nodes have provided staked collateral that is slashed in case they misbehave.
Coinweb's different ways wrapping/unwrapping
-
dApp wrappers:
- These are interfaces that makes it easier for the users to interact with L1-dApps and pay in the dApp token
- Consists of:
- Visual elements within the game UI, for example iframes or data fetched from L1 blockchain or API
- Transaction composer
- Creates the necessary L1 and or L2 transactions
- Exchange dApp token for L1 or L2 to pay for gas
- Exchange the dApp token to the token for payment
- Send the payment transaction on behalf of the user
- Creates the necessary L1 and or L2 transactions
- Interface with Coinweb wallet-lib
- Interface with third party wallets
-
Coinweb wrapped tokens:
- Can be both L1 tokens wrapped as Coinweb L2 tokens and Coinweb L2 tokens
wrapped as L1 tokens (depending on which is defined as the source of truth)
- For example, if Bitcoin is wrapped as an Coinweb L2 token, Bitcoin would be the source of truth and the Coinweb L2 token would be wrapped Bitcoin
- If the Coinweb token is issued as the main token for a dApp, it is a blockchain agnostic token and can be wrapped down to various L1 blockchains. In this
- Can be both L1 tokens wrapped as Coinweb L2 tokens and Coinweb L2 tokens
wrapped as L1 tokens (depending on which is defined as the source of truth)
Sequence diagrams for the different options
Reference to EIP's Dynamic checks
- Address properties, either include in invoice or query through L2
- Functionality like lightningnetwork with Reactive smart contracts as watchtower
- Does the sender address have L2 tokens?
- Is the receipient willing to pay the fees?
- Fee substitution calculated in L2 smart contract
Example use case Web3 Game
The following use cases can to a certain extent be combined and used simultanously to leverage off existing user bases and Web3 tools while also benefitting from Coinweb platform advantages.
Example 1 shows how a typical user experience without Coinweb improvements is often fractioned between different dApp interfaces and other ecosystem services. This is reducing valuable "screen-time realestate" from many Web3 dApps and games. This is especially critical for the onboarding of new users, that often have to learn to use several different applications to obtain the necessary Game and gas tokens to interact with the game.
Existing Web3 solutions and wallets improved by Coinweb
Coinweb gas-fee abstraction can be used with existing Web3 solutions and be kept invisble to the user. The user need only interact with the game token issued by the Web3 Game application. The game token is seamlessly exchanged for gas tokens and other tokens necessary to interact with other dApps. While still providing significant gas savings, a deeper integration with Coinweb enables a much higher level of gas savings and more advanced game logic. If the Web3 dApp uses proxycontracts, retrofitting these solutions are easier. In some cases, where meta transactions are already supported, retrofitting can potentially be done without changes in the L1 contracts. Example of intergration without gas-abstraction https://li.fi/knowledge-hub/planet-ix-integrates-li-fi-cross-chain-swap-widget/