Skip to main content

Changelog

  • 2020/08/18: Initial Draft
  • 2021/05/05: Removed height based expiration support and simplified naming.

Status

Accepted

Context

In order to make blockchain transactions, the signing account must possess a sufficient balance of the right denomination in order to pay fees. There are classes of transactions where needing to maintain a wallet with sufficient fees is a barrier to adoption. For instance, when proper permissions are setup, someone may temporarily delegate the ability to vote on proposals to a “burner” account that is stored on a mobile phone with only minimal security. Other use cases include workers tracking items in a supply chain or farmers submitting field data for analytics or compliance purposes. For all of these use cases, UX would be significantly enhanced by obviating the need for these accounts to always maintain the appropriate fee balance. This is especially true if we wanted to achieve enterprise adoption for something like supply chain tracking. While one solution would be to have a service that fills up these accounts automatically with the appropriate fees, a better UX would be provided by allowing these accounts to pull from a common fee pool account with proper spending limits. A single pool would reduce the churn of making lots of small “fill up” transactions and also more effectively leverages the resources of the organization setting up the pool.

Decision

As a solution we propose a module, x/feegrant which allows one account, the “granter” to grant another account, the “grantee” an allowance to spend the granter’s account balance for fees within certain well-defined limits. Fee allowances are defined by the extensible FeeAllowanceI interface:
Two basic fee allowance types, BasicAllowance and PeriodicAllowance are defined to support known use cases:
Allowances can be granted and revoked using MsgGrantAllowance and MsgRevokeAllowance:
In order to use allowances in transactions, we add a new field granter to the transaction Fee type:
granter must either be left empty or must correspond to an account which has granted a fee allowance to fee payer (either the first signer or the value of the payer field). A new AnteDecorator named DeductGrantedFeeDecorator will be created in order to process transactions with fee_payer set and correctly deduct fees based on fee allowances.

Consequences

Positive

  • improved UX for use cases where it is cumbersome to maintain an account balance just for fees

Negative

Neutral

  • a new field must be added to the transaction Fee message and a new AnteDecorator must be created to use it

References

  • Blog article describing initial work: Link
  • Initial public specification: Link
  • Original subkeys proposal from B-harvest which influenced this design: Link