Discussion on KIP-247

Summary of KIP-247

This proposal facilitates users without KAIA to swap their tokens into KAIA. Only swaps from whitelisted tokens are supported. The user lends some KAIA from proposer, which enables sending transactions. Then, user pays back from the swap output.

Technical Outlook

Gasless transaction is a specially treated transaction where .
GaslessTx comprises two components: an optional approval transaction (GaslessApproveTx) and a necessary swap transaction (GaslessSwapTx). To use gasless swap, the swap transaction must have to address to GaslessSwapRouter contract.

When a proposer detects GaslessTx, it lends the user KAIA (LendTx) and bundles it with GaslessTx (via the bundling mechanism from KIP-245). The GaslessSwapRouter ensures the repayment of both the lent KAIA and the gas fee spent by the proposer.

LendTx: transfer from proposer to user XX KAIA.
GaslessApproveTx: user approves the token to GaslessSwapRouter. It can be ommitted if already approved.
GaslessSwapTx: user swaps token into KAIA, and repays the proposer (XX + gas fee) KAIA.

FAQ

  • Q. Can a user swap any tokens into KAIA?
    A. No, the token needs to be whitelisted.
  • Q. How is a token whitelisted?
    A. For now, only Consensus Liquidity tokens are considered (KIP-226).
  • Q. Can it be only used by users without KAIA?
    A. No, any users can send gasless transaction.
  • Q. Does this require a hardfork?
    A. No. It does not introduce a new type of transactions nor EVM modification.
  • Q. How does a DApp enable this?
    A. It must support wallets which provide this functionality.
  • Q. Which tokens are supported?
    A. Basically, ERC-20 compatible tokens. Non-compliant tokens may or may not be supported. FoT tokens are not supported.
2 Likes

Which tokens are going to be supported by KIP-247 or GaslessSwapRouter?

Can any kind of ERC-20 tokens be supported if whitelisted? Are there any properties that the token has to follow?

1 Like

so, what happens when gas price spikes and the gas fees < amount borrowed?

or is there a way for proposers to know that a particular transaction will fail? like does KIP-245 support an execution of bundled transaction in simulation? this is because the atomicity of KIP-245 works similar to multicall, if a particular transaction in the bundle fails, the entire transaction fails and the fees paid by the proposer to initiate the LendTx won’t be repaid.

2 Likes

What specific infrastructure or wallet integrations are required for DApps to support gasless transactions? can this be integrated into existing wallets with certain updates?

2 Likes

Good question. If any of the gasless transactions (approve or swap) reverts, then none of the transactions will be included in the block, so it’ll be like the transactions were never sent.
For example, given txs = [ A1 S1 A2 S2 A3 S3 ] (Approve and Swap txs for user 1-3), If S2 reverts, then block will include only [ A1 S1 A3 S3 ].
This is enforced by KIP-245; reverting txs in bundle will be excluded from block.
Note that KIP-245 does not “simulate” the transaction execution; it is difficult to predict if a tx will revert. Instead, transactions in a bundle are actually executed, and rolled-back to pre-execution upon revert.

1 Like

kaia-sdk will support gasless transaction feature. DApps and wallets can use it in their services.

2 Likes

okay, I get it.

how about the gas spikes possibility? predicting network gas costs could avoid issues here or what do you think?

If the gas cost rises, gasless transactions will be discarded just like regular transactions. Predicting gas costs could help.

yeah, I am hyped up about this already.

1 Like

I personally think KIP-247 offers a smart way to help new users who don’t have KAIA yet. The system where someone lends KAIA to a user, then gets paid back from the swap is very and really practical. I like that it works without changing the core protocol and only allows trusted tokens.

However I do wonder about a few things though - what happens if like a transaction fails? How will wallets add this feature? I would be happy to see more or some examples or your ideas showing how to add this feature to the DApps. This could really make it easier for new users to join the network. But such a nice proposal @ian_song1 I fully support on this :smiley: