Have two different ways of paying fees

Description:
Adding a watch ads as second option to replace fees.

Purpose:
This would help people who don’t really know how to use gas fees facilitate their payments with ease. A case whereby they watch ads equivalent to the fee they are going to pay.

Extension/Mobile/Both:
Mobile

Images/Attachments:

Welcome to the MetaMask community
I personally feel you are insightful unique, but based on the user experience and technology implementation may not be simple.
Just a discussion and purely personal opinion.

6 Likes

It’s an interesting idea. While I don’t think it’s something that really aligns with the ConsenSys values (eg: I can suggest it to development teams, but I dont think it’s something we are likely to build internally) I can see a few paths that this might become a viable feature.

The easiest way to add new capabilities to MetaMask is through a feature called MM Snaps. You’ll also need some of the features offered by upcoming Pectra upgrade, namely sponsored txns. They allow for a “paymaster” to pay gas fees for another wallet.

So what I’m envisioning is a Snap that creates a Pectra compliant “smart account.” Viewing ads would build up “gas credit” that could then be used to pay for txns. We host internal & external hackathons, and this sounds like a textbook entry there.

In your shoes, I would get in touch with the Linea Builders Club, get a team together, and get hacking. LBC is run by a group of our developers that work with community teams to help get their ideas built into projects built & on-chain. You can get linked up with them in the Developer channels on the Linea Discord - Linea

If you’re not interested in trying to build the thing yourself, and just want the feature to exist; I can also pass the suggestion along to some people that might be interested.

2 Likes

The feature would really be nice. Two options for covering gas fees👍

class MetamaskLikeApp:
def init(self):
self.gas_price = self.get_current_gas_price() # Get current gas price
self.ad_service = AdService() # Assume an ad service integration

def get_current_gas_price(self):
    # In a real application, this would fetch the current gas price
    return 0.00002 # Example gas price in ETH

def initiate_transaction(self, recipient, amount):
    gas_required = self.calculate_gas_for_transaction(recipient, amount)
    total_cost = amount + gas_required

    print(f"Transaction details:\n  Recipient: {recipient}\n  Amount: {amount} ETH\n  Estimated Gas Fee: {gas_required} ETH\n  Total Cost: {total_cost} ETH")

    if self.prompt_user_for_gas_fee_option():
        if self.watch_ads_to_cover_gas(gas_required):
            print("Gas fee covered by watching ads.")
            self.submit_transaction(recipient, amount, gas_fee=0) # Submit with zero gas fee for the user
        else:
            print("Failed to cover gas fee with ads. Transaction cancelled.")
    else:
        self.submit_transaction(recipient, amount, gas_fee=gas_required)

def calculate_gas_for_transaction(self, recipient, amount):
    # In a real application, this would estimate gas based on transaction complexity
    return 0.00001 # Example gas units

def prompt_user_for_gas_fee_option(self):
    user_input = input("Do you want to watch ads to cover the gas fee? (yes/no): ").lower()
    return user_input == "yes"

def watch_ads_to_cover_gas(self, gas_required):
    required_ads = self.ad_service.calculate_required_ads(gas_required)
    print(f"You need to watch {required_ads} ads to cover the gas fee.")
    ads_watched = self.ad_service.watch_ads(required_ads)
    if ads_watched >= required_ads:
        if self.ad_service.verify_ads_watched(ads_watched):
            # In a real application, this would trigger the gas fee coverage mechanism
            print("Ads watched and verified.")
            return True
        else:
            print("Ad verification failed.")
            return False
    else:
        print("Not enough ads watched.")
        return False

def submit_transaction(self, recipient, amount, gas_fee):
    print(f"Submitting transaction to {recipient} for {amount} ETH with gas fee: {gas_fee} ETH")
    # In a real application, this would interact with the blockchain to submit the transaction

class AdService:
def calculate_required_ads(self, gas_amount):
# This would depend on the ad service’s reward system
# Example: 1 ad covers 0.000005 ETH of gas
return int(gas_amount / 0.000005) + 1

def watch_ads(self, num_ads):
    print(f"Watching {num_ads} ads...")
    # Simulate watching ads
    return int(input("Enter the number of ads you have watched: "))

def verify_ads_watched(self, watched_count):
    # In a real application, this would communicate with the ad service for verification
    # For simplicity, we'll just assume verification is successful if the count matches
    return True

Example usage

MetaMask_like_app = MetamaskLikeApp()
MetaMask_like_app.initiate_transaction(“0x123…”, 0.01)