Basic Implementation of a Local Exchange Trading System (LETS)
A minimal, extensible blueprint for building a LETS on Ergo using administrative and trade contracts, singleton tokens, and authenticated data structures.
Overview
The basic blueprint of our system encompasses two contracts: an administrative contract and a trade contract. Before delving into the details, we recommend acquainting yourself with the foundational aspects of Ergo by reviewing the ICO article as well as ErgoScript tutorials. Despite the aforementioned recommendations, we will elucidate a few novel terms in the upcoming sections.
Singleton Tokens and Boxes
In Ergo, when a token is minted with a value of one, it is termed a singleton token. Similarly, a box containing a singleton token is known as a singleton box.
Administrative Contract
Purpose
- Oversees a singleton box that encompasses the members of the LETS system.
- Facilitates the addition of new members (one per transaction).
- Stores only a succinct digest of an authenticated data structure based on the members' directory.
- Each member is linked with a singleton token minted during their addition.
- Records the initial balance in the R4 register (zero).
- Validates the correctness of the directory transformation on member addition.
Committee Management
A committee generally manages the administrative contract box, and the composition of this committee may change over time. The committee's logic resides in the R5 register, allowing for flexible signature requirements as the committee evolves.