Gasless Transaction #899
Closed
wenyuanhust
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background
As is known to all, to send trasactions in Blockchains, users need to pay some transaction gas fee. This requires users holding asset of the Blockchain beforehand. This extra requirement may block lots of potential people interested in the Blockchain or dApp from engaging in it. For dApp developers, they definitely wish to have as many participants as possible. To help them, we proposed a way to let users sending trasactions, participate in dApp for example, without paying gas fee.
Solution
The general idea is to let the developer pre-payes the gas fee for their autheticated users. We can describe the solution as follows:
Design
1. SponsorWhitelistControl
This is a system contract which should be deployed in the genesis block. It offers many interfaces to manage the elements needed to realize gas-less transaction. We call the account which will pay the gas fee for the contract callers sponsor.
2. Developer deployed contract
To enable users calling contract freely, the contract must offer the interface to add users to the whitelist.
3. User End
There is no need to do extra work.
4. Miner End
Instead of checking transaction sender’s account balance to pay gas fee, miners will firstly check the SponsorWhitelistControl to see wheather the gas fee can be payed by others(the sponsor stored in the system contract). If not, the miner will check the sender’s account balance aferwards.
Implementation
1. SponsorWhitelistControl
setSponsorForGas
: set the gas fee sponsor account, the amount and the upper limit of the amount for each transaction.It has four parameters:
Generally, the contract(dApp) developer will call this function to pre-pay the gas fee. The sponsor account is in control of the developer.
2. Developer’s contract
To enable gas-less transaction, the contract must have the addPrivilege method:
Generally, only the contract owner can call this method to add address to the whitelist.
3. Transaction assembler
No need to change.
4. Miner
Add extra mechanism as follows:
Beta Was this translation helpful? Give feedback.
All reactions