A no-code Paymaster that allows decentralized applications (Dapps) on Ethereum, Layer 2s, and EVM equivalent chains to define Gas Policies to directly sponsor gas for Smart Wallet end-users, without the need for API calls or custom code in the dapp client app.
InstaGas receives User Operations from end-users’ wallets and checks for applicable gas policies set up by sponsors. If a matching policy is found, InstaGas returns a valid sponsorship signature. Gas policies are configured using customizable rules, ranging from generic to account-based, access-based, and transaction-specific rules. Simple gas policies require only a few basic rules to set up, while more complex ones may involve transaction rules that scan for contract interactions, input parameters, and predefined limits. InstaGas, by design, is secured against draining attacks, provided that the gas policy is properly configured to enforce the desired behavior.
The Problem
Without a Paymaster, anyone sending an Ethereum transaction must possess ETH to cover gas fees, forcing new users to complete KYC processes and purchase ETH before accessing any Dapp. With the growing demand for better user experiences and the introduction of the Account Abstraction standard, Smart Wallets have emerged to cover gas fees on behalf of their users. However, this shift places Dapps in a challenging position, as they lose control over their user onboarding processes. To sponsor gas for end-user Smart Wallets, Dapps have had to implement complex, custom code for each wallet integration, and some even resort to offering their own embedded wallets to enhance user experience.
Real-World Applications of Gas Policies
Gas Policies enable a wide range of possibilities across sectors where onboarding, marketing, incentives, and privacy are critical. InstaGas offers diverse use cases across multiple industries:
-
DeFi Exchanges: Cover gas fees for token swaps or liquidity provision. This is useful for marketing campaigns, new user onboarding, or high-volume traders.
-
NFT Drops: Sponsor gas fees for fresh mints, even during high network congestion. This helps your collection find more participants and reduces all friction for collectors.
-
Lending Protocols: Sponsor key actions such as loan creation, collateral adjustments, or repayments by setting a minimum for deposits and withdrawals.
-
Games: Gas-free in-game transactions, allowing players to mint NFTs, transfer assets, or make a minimum purchase without needing to manage native tokens.
-
Charity and Donations: Nonprofits can sponsor gas fees for donors. A minimum donation threshold can be set to apply for sponsorship.
-
DAO Governance Participation: Sponsor gas fees for governance actions like voting, submitting proposals, or delegating tokens.
-
Subscription Services: Any recurring actions, such as Dollar Cost Averaging (DCA), can automate and cover recurring transaction fees for users.
-
Private Actions: By covering gas fees, users don’t need to complete KYC to purchase ETH. It also enables ETH-less token withdrawals sent to stealth addresses.
Architecture
Gas Policies
A Gas Policy is a set of customizable rules designed to sponsor gas for targeted actions. A Gas Policy can be configured as public, allowing it to be used by anyone calling the pm_sponsorUserOperation endpoint, or as private, accessible only through a unique policy ID. Gas Policies are set up for a defined time period and can include various rule types. These include account-based rules, which set limits per account; access-based rules that whitelist specific accounts, domains, or IP addresses; and transaction-based rules, which customize policies based on the dapp’s contract, callable methods, input parameters, and transaction limits.
The steps to set up a Gas Policy are as follows:
- Sign up on the dashboard.
- Create a new Gas Policy on a specific network.
- Configure the policy rules.
- Fund the policy and activate it.
Smart Wallet Client
User Operations are transactions specific to Smart Wallets. The wallet client constructs the User Operation based on calldata provided by the Dapp, either through the browser provider, a WalletConnect connection, or an internally integrated Dapp. The wallet then sends a request with the User Operation to InstaGas to determine if a matching gas policy exists. If a policy is found, InstaGas returns a valid sponsorship signature. If no match is found, the wallet falls back to private gas policies, or offers the end-user the option to pay gas in different ERC-20 tokens.
InstaGas Verifier
The traditional Paymaster design sponsors gas indiscriminately, allowing anyone with access to the API endpoint on the client side to consume gas with minimal verification. This exposes both the Paymaster provider and its customers to draining attacks. We consider the use of rules and policies enforced by a Paymaster verifier a secure solution. The verifier checks all applicable gas policies against the submitted User Operation, offering protection against malicious actors attempting to exploit policies that were not intended or properly configured for specific use cases. This ensures that gas policies are enforced as intended.
InstaGas Contracts
The paymaster contracts hold both a deposit and a stake within the global ERC-4337 EntryPoint contract. The deposit, used to cover gas fees, is distinct from the stake, which is locked to ensure security. The EntryPoint can withdraw from the Paymaster’s deposit if it determines that the Paymaster has sufficient ETH to cover the gas for the operation via the handleOps method. It then calls validatePaymasterUserOp on the Paymaster contract to confirm the Paymaster’s willingness to sponsor the operation. If validatePaymasterUserOp returns a context, the EntryPoint’s handleOps method subsequently calls postOp on the Paymaster after executing the main operation. The stake serves as protection against malicious Paymasters, ensuring that if a Paymaster behaves maliciously or attempts to launch a denial-of-service (DoS) attack on the system, its stake can be slashed as a penalty.
Next Steps
To learn more about InstaGas, head over to the following resources:
- Dapps: Sign up for early access and help shape the future of Ethereum UX.
- Wallets: To learn how to integrate InstaGas with your wallet, see the API methods, the SDK reference, and the guide showing how to sponsor a user operation.