Job Modules

What is a CoopHive Module?

A CoopHive module is a git repository structured using predefined templates and inputs to run computational jobs on the network.

How Are Modules Structured?

  1. Create a git repository for your CoopHive module. The module's versions will be identified using their git tags.

  2. In the module's repository, create a file named module.coophive. This file will serve as a JSON template with Go text/template style sections, like {{.Message}}, which will be replaced by CoopHive with JSON-encoded inputs.

  3. Alternatively, use Go templates to set defaults and perform other template-related operations. Some examples can be found here.

Handling Inputs

Inputs are passed to your CoopHive module as a key/value pairs. For example:

hive run github.com/username/repo:tag -i Message=moo

Tips for Deterministic Outputs

Try to follow the following recommendations to increase the chances that your CoopHive module will be deterministic:

  • Make the output of your module reproducible

  • Strip timestamps and time measurements from the output, including to stdout and stderr

  • Avoid reading from sources of entropy, such as /dev/random

  • When referencing Docker images, specify their sha256 hashes

Last updated