Made using a template for running SourceCred instances, this repo has a GitHub action configured that will automatically run the SourceCred algorithm every 6 hours, as well as any time you change the configuration.
SourceCred is organized around "instances". Every instance must have a
sourcecred.json
file at root, which specifies which plugins are active in the instance. Config and permanent data (e.g. the Ledger) are stored in the master branch. All output or site data gets stored in the gh-pages
branch by the Github Action.
Configuration files:
config/secret.json
specifies how much of a secretToken to distribute every week. ThemaxSimultaneousDistributions
parameter determines how many weeks of "back-distributions" to generate if the command hasn't been run in a while (or ever).config/currencyDetails.json
We're using "Secret" as the name for the currency it distributes to participants. If you would like to change it to something custom for your community, you can do so by editing this file.config/plugins/$PLUGIN_OWNER/$PLUGIN_NAME
stores plugin-specific data. Each plugin has its own directory. See the plugin section below to learn how to configure them.
Permanent Data:
data/ledger.json
keeps a history of all secret distributions and transfers as well as identities added / merged.
Generated Data:
cache/
stores intermediate produced by the plugins. This directory should not be checked into Git at all.output/
stores output data generated by SourceCred, including the Cred Graph and Cred Scores. This directory should be checked into Git; when needed, it may be removed and re-generated by SourceCred.site/
which stores the compiled SourceCred frontend, which can display data stored in the instance.
We updated the config to include only the GitHub and Discourse plugins (for now). Our primary goals are to incentivize contributions by developers and grow the Secret Network Dev Committee.
Get [Yarn] and then run yarn
to install SourceCred and its dependencies. Update the configuration files according to the plugin guides below. Then, run the following commands to update the instance:
yarn load [...plugins]
loads the cache. By default, it loads all plugins, or it can load only specific plugins if requested.yarn graph
regenerates plugin graphs from the cache; these graphs get saved inoutput/
.yarn score
computes Cred scores, combining data from all the chosen pluginsyarn grain
distributes DevToken according to the current Cred scores, and the config inconfig/grain.json
Generate the frontend:
yarn site
Run the frontend:
yarn serve
Deploy the frontend:
yarn run deploy
If you want to clear the cached data, you can do so via:
yarn clean
Running yarn clean
is a good idea if any plugins fail to load.
If you want to restart from a clean slate and remove all the generated graphs, you can do so via:
yarn clean-all
Run yarn clean-all
if the yarn graph
command fails due to a change in the config or breaking changes in a new version of SourceCred.
Warning: If you don't have credentials for every plugin, you might not be able to regenerate parts of the graph.
Once you've got the instance configured to your satisfaction (see instructions on plugins below), commit and push your changes to master (or make a pull request). The Github Action will then generate the frontend and deploy it to GitHub Pages. To enable GitHub Pages for your instance, check out this guide.
Make sure you select gh-pages
as the branch to publish from.
The GitHub plugin loads GitHub repositories.
You can specify the repositories to load in
config/plugins/sourcecred/github/config.json
.
The Github Action automatically has its own GITHUB_TOKEN, but if you need to load data from the GitHub plugin locally, you must have a GitHub API key in your environment as $SOURCECRED_GITHUB_TOKEN
. The key should be read-only without any special permissions (unless you are loading a private GitHub repository, in which case the key needs access to your private repositories).
You can generate a GitHub API key here.
The Discourse plugin loads Discourse forums; currently, only one forum can be loaded in any single instance. This does not require any special API keys or permissions. You just need to set the server url in config/plugins/sourcecred/discourse/config.json
.
To deactivate a plugin, just remove it from the bundledPlugins
array in the sourcecred.json
file. You can also remove its config/plugins/OWNER/NAME
directory for good measure.
This repo contains a GitHub action for distributing DevToken. It will run every Sunday and create a Pull Request with the ledger updated with the new DevToken balances based on the users cred scores. The amount of DevToken to get distributed every week can be defined in the config/grain.json
file. There are two different policies that can be used to control how the DevToken gets distributed:
immediatePerWeek
splits the DevToken evenly based on everyone's Cred in the last week only.balancedPerWeek
distributes the DevToken consistently based on total lifetime cred scores. i.e. it balances the distribution of DevToken with the distribution of total historical cred.
The balanced policy enables redistribution of rewards. e.g. if someone has been historically "overpaid" with DevToken relative to their cred scores, that people will receive less DevToken in the balanced distribution while people who have been "underpaid" relative to their cred will receive more DevToken.