🏦Paymaster extension

Ethereum introduces 'paymasters' to cover transaction fees, enhancing user experience. The system enforces rigorous checks for these sponsored transactions, ensuring security and paymaster integrity.

Extended Logic for Transaction Sponsorship

The entry point's capabilities are expanded to cater to 'paymasters'. Paymasters are entities that can cover transaction fees on behalf of others. This is especially handy for:

  • Developers Subsidizing Fees: Application creators can cover the fees to enhance user experience.

  • Paying Fees with ERC-20 Tokens: Users can offset transaction fees using different types of tokens.

  • Other Uses: This feature opens up various transaction fee-related possibilities.

If the paymaster isn't just a placeholder (not a zero address), the entry point follows a special procedure to manage these sponsored transactions.

Enhanced Verification for Paymaster-Sponsored Transactions

In the verification loop, the handleOps execution takes on some extra tasks when dealing with paymaster-sponsored transactions:

  1. Initial Verification: Besides just calling validateUserOp, it checks if the paymaster has enough ETH deposited at the entry point to cover the transaction.

  2. Paymaster's Approval: The handleOps execution calls validatePaymasterUserOp on the paymaster. This ensures the paymaster agrees to bear the operation's costs. Notably, the validateUserOp is now invoked with a missingAccountFunds set to 0, showing the account's deposit isn't used for this particular transaction.

  3. Context Handling: If the paymaster's validatePaymasterUserOp sends back a “context”, then after the main execution call, handleOps needs to invoke postOp on the paymaster. For guaranteed execution of postOp, the main execution is run in an inner call context. If this inner context is reverted, handleOps tries again using an outer call context.

  4. Security Against Malicious Paymasters: There are concerns about paymasters intentionally disrupting the system. To handle this, a reputation mechanism is in place. Any paymaster must either:

    • Keep their storage usage in check, or

    • Maintain a certain stake.

    Further details can be found in the section about reputation, throttling, and banning.

Last updated