The Chainlink Hackathon kicks off April 21st! Register today to compete for $350K+ in prizes.

Mode Task

Accepts multiple numerical inputs and returns the mode (most common) of them. If more than one value occur the maximum number of times, it returns all of them.


  • values: an array of values from which to select a mode.
  • allowedFaults (optional): the maximum number of input tasks that can error without the Mode task erroring. If not specified, this value defaults to N - 1, where N is the number of inputs.


A map containing two keys:

    "results": [ ... ], // An array containing all of the values that occurred the maximum number of times
    "occurrences": ..., // The number of times those values occurred


my_mode_task [type="mode"
                values=<[ $(fetch1), $(fetch2), $(fetch3), $(fetch4), $(fetch5), $(fetch6), $(fetch7), $(fetch8) ]>

Given a values array containing [ 2, 5, 2, "foo", "foo" "bar", "foo", 2 ], the task will return:

  "results": [2, "foo"],
  "occurrences": 3

Stay updated on the latest Chainlink news