Incentive Execution

Disclaimer: This is a summary of patterns we have observed during our research and should not be considered any form of technical or investment advice. Also, the given “known examples” do not imply they are the best implementations of the said pattern or any superior to any other implementation of the pattern not listed.

Summary

Offer a reward to the caller of a contract function for invoking it.

Context

Smart contracts are event-driven programs that cannot execute autonomously. Functions defined in a smart contract need to be triggered either by a transaction from an external account or another smart contract. Other than the functions that provide regular services to users, accessorial functions such as cleaning up expired records or making dividend payouts need to run asynchronously. Such functions usually involve a timer, after which the function should start.

Problem

The event-driven nature of smart contracts requires external triggers to run accessorial functions. However, users of a smart contract have no direct benefit from calling accessorial functions. If a public blockchain is used, executing these functions involve a monetary cost. Some accessorial functions are expensive to execute. While accessorial functions can be triggered through other regular functions called by users, regular funs may not be called at the desired time. How to make sure the accessorial functions are invoked on time?

Forces

  • Completeness – The regular services provided by a smart contract are supported by some accessorial functions.
  • Cost – Execution of accessorial functions causes extra costs for the users.

Solution

Reward the caller of an accessorial function defined in a smart contract for invoking it. For example, send back a percentage of payout to the caller as reimbursement of the execution cost. However, on public blockchains, the cost of invoking a function (i.e., transaction fee) is dynamic where it depends on factors such as the network congestion and the market value of a cryptocurrency. Hence, the reward has to be set accordingly to incentive the on-time execution.

Incentive execution pattern

Benefits

  • Completeness – The execution of the accessorial functions helps to complete the regular services provided by the smart contract.
  • Cost – The users, who spend extra to execute the accessorial functions, are compensated by the reward associated with the execution which should be higher than the cost of execution.

Drawbacks

  • Lack of guarantees – Execution cannot be guaranteed even with incentives.

Related Patterns

  • The security deposit pattern could be used to implement the incentive payment where the contract owner set aside some currency/tokens to be claimed by the party invoking the accessorial function.

Known uses

  • Regis is an in-browser tool for developers to create smart contracts representing registries on Ethereum. The functions that clean up the expired records provide incentives for users to execute them.
  • Ethereum alarm clock is a service provided by a smart contract running on Ethereum. It facilitates scheduling function calls for a specified block in the future and provides incentives for users to execute the scheduled function.