Contracts paying for user's gas (prepaid transactions) #1503
Labels
module:contracts
Issues related to the genesis contracts
module:rusk
Issues related to rusk module
type:feature
implementing a new feature
Summary
Currently, it is not possible to execute smart contract method call via transaction without having a valid Dusk note that could cover the gas cost, which implies that only users having a wallet can execute smart contract methods (other than queries). This is not convenient for scenarios like onboarding a new user or providing some free service to a user. It would be empowering for contract developers and for users to make it possible to interact with the blockchain without (at least initially) having an account (wallet) and without having any Dusk funds. Once onboarded, user could pay a fee later, not necessarily in Dusk currency.
Possible solution design or implementation
We already have a mechanism which stores funds on a per contract basis. Transfer contract is capable of keeping funds under its owner's public key and keeps tab of balances for each contract. Therefore, should a transaction need funds to cover gas cost, it could take the funds from the target contract's balance. The contract, on the other hand, would need
to implement a user tab, which will store users' "debt", including allowance, and possibly default allowance, which methods are supported, maybe allowance per method.
Additional context
This issue covers scenario 3 from the Economic Protocol In Dusk Smart Contracts document, which involves contract paying for user's gas and charging user a fee (which could be zero) not directly related to gas usage (meaning that gas usage cost is being covered by the contract).
The text was updated successfully, but these errors were encountered: