# Grain Ledger

**URL:** <https://discourse.sourcecred.io/t/grain-ledger/657>\
**Category:** Initiatives\
**Tags:** 🏗️in-progress\
**Created:** [March 5, 2020, 10:31pm UTC](https://discourse.sourcecred.io/t/grain-ledger/657 "2020-03-05T22:31:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![decentralion](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sourcecred.io/decentralion/32/7_2.png) [@decentralion](https://discourse.sourcecred.io/u/decentralion)\
**Post date:** [March 5, 2020, 10:31pm UTC](https://discourse.sourcecred.io/t/grain-ledger/657/1 "2020-03-05T22:31:43Z")

</div>

# Description

* * *

Grain (a project-specific token tied to cred) is a vital part of the SourceCred system. However, right now we don’t have any code-reviewed infrastructure for distributing, tracking, or displaying grain balances. Instead, grain is distributed based on non-code-reviewed Observable notebooks (see [payouts](https://discourse.sourcecred.io/t/sourcecred-contributor-payouts/298)), recorded in undocumented file formats via a manual process, and then displayed through notebooks.

This system is highly manual, non-robust, and not a good fit for other projects which are adopting SourceCred. We need to build proper infrastructure for distributing, tracking, and displaying Grain.

The scope of this initiative is:

- Create a “Ledger” module which records the history of grain distributions and transfers
- Create a “Distribution” module which, given current cred scores, can compute new grain distributions for contributors
- Build legacy handlers to ingest our existing grain distributions into the new system
- Create a “Display” module in the frontend which shows the grain balances
- Incorporate this new system into the new CLIs and automation that @beanow and @anon60584824 are working on

# Status

* * *

Championed

# Champion

* * *

@decentralion

# Benefits

* * *

- We will automate grain distribution, rather than doing it by hand
- We’ll have a dedicated UI for checking grain balances, rather than random notebooks
- Pre-requisite to formally enabling [Grain distributions will switch to opt-in](https://discourse.sourcecred.io/t/grain-distributions-will-switch-to-opt-in/621)
- Pre-requisite to [Grain Vesting](https://discourse.sourcecred.io/t/grain-vesting/636)
- Pre-requisite for [An ERC20 to track Grain](https://discourse.sourcecred.io/t/an-erc20-to-track-grain/386)
- Will make it far easier for consumers to issue toikens based on Cred (e.g. MetaGame, Maker)

# Implementation Plan

* * *

- Write the ledger module
- Write the distribution module
- Write the legacy import module
- Write the display module
- Code review, testing
- Integrate with SourceCred CLI and automation

  

# Deliverables

* * *

- We deprecate the Observable notebooks
- @decentralion no longer does manual distributions
- Users can check grain balances in teh UI
- MetaGame can track seeds using this system

  

# Dependencies

* * *
  

# References

* * *

Discussed during [Team Meeting Notes (3/5/2020)](https://discourse.sourcecred.io/t/team-meeting-notes-3-5-2020/656/2)

  

# Contributions

* * *

- [https://github.com/sourcecred/sourcecred/pull/1696](https://github.com/sourcecred/sourcecred/pull/1696)

---

<div class="post-metadata">

**Author:** ![burrrata](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sourcecred.io/burrrata/32/135_2.png) [@burrrata](https://discourse.sourcecred.io/u/burrrata)\
**Post date:** [March 7, 2020, 3:30am UTC](https://discourse.sourcecred.io/t/grain-ledger/657/2 "2020-03-07T03:30:16Z")

</div>

This is awesome! How can people contribute to this Initiative if they feel so inspired?

---

<div class="post-metadata">

**Author:** ![decentralion](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sourcecred.io/decentralion/32/7_2.png) [@decentralion](https://discourse.sourcecred.io/u/decentralion)\
**Post date:** [March 7, 2020, 11:23pm UTC](https://discourse.sourcecred.io/t/grain-ledger/657/3 "2020-03-07T23:23:17Z")

</div>

Right now @ianjdarrow is working on UI mockups for the frontend, and I’m working on the backend. If a developer wants to get involved they can ping me in the #implementation channel on Discord. Folks are also welcome to offer code reviews; mention if you want to be pinged when new pulls go out for review.
