Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contracts paying for user's gas (prepaid transactions) #1503

Closed
miloszm opened this issue Mar 4, 2024 · 1 comment
Closed

Contracts paying for user's gas (prepaid transactions) #1503

miloszm opened this issue Mar 4, 2024 · 1 comment
Assignees
Labels
module:contracts Issues related to the genesis contracts module:rusk Issues related to rusk module type:feature implementing a new feature

Comments

@miloszm
Copy link
Contributor

miloszm commented Mar 4, 2024

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).

@miloszm miloszm self-assigned this Mar 4, 2024
@miloszm miloszm added type:feature implementing a new feature team:Core module:rusk Issues related to rusk module labels Mar 4, 2024
@miloszm miloszm changed the title Free transaction for executing contract methods charged to a per-contract per-method user tab Free transaction for executing contract methods charged to a per-contract user tab Mar 5, 2024
@miloszm miloszm changed the title Free transaction for executing contract methods charged to a per-contract user tab Prepaid transactions for executing contract methods charged to a contract Mar 6, 2024
@miloszm miloszm changed the title Prepaid transactions for executing contract methods charged to a contract Contracts paying for user's gas (prepaid transactions) Mar 7, 2024
@HDauven HDauven added module:contracts Issues related to the genesis contracts and removed module:transfer-contract labels Apr 8, 2024
@HDauven HDauven modified the milestones: Economic Protocol, Mainnet Apr 10, 2024
@autholykos
Copy link
Member

Closing as Duplicate of #1644

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module:contracts Issues related to the genesis contracts module:rusk Issues related to rusk module type:feature implementing a new feature
Projects
None yet
Development

No branches or pull requests

3 participants