Skip to content

Commit

Permalink
sigmausd rework
Browse files Browse the repository at this point in the history
  • Loading branch information
glasgowm148 committed Sep 1, 2024
1 parent aa0b7d1 commit 964985c
Show file tree
Hide file tree
Showing 7 changed files with 357 additions and 124 deletions.
59 changes: 58 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Welcome to ErgoDocs!
# Welcome to Ergo

::cards::

Expand Down Expand Up @@ -43,3 +43,60 @@
]

::/cards::



Dive into the world of Ergo, a cutting-edge platform at the forefront of decentralized finance and smart contracts. This guide is structured to help you swiftly navigate to the sections most relevant to your interests—whether you’re mining, investing, developing, or exploring the basics of cryptocurrencies.

## Why Choose Ergo?

[**Discover Ergo’s Vision**](why.md)

Ergo merges privacy, decentralization, and security into a robust platform, empowering users with tools that ensure economic freedom without relying on intermediaries.

## Navigating Ergo: Tailored Paths

### For Miners

Mining on Ergo not only supports the network but also offers potential earnings. Learn about:

- **[Setting Up Mining Operations](autolykos.md)**: Start mining ERG to contribute to network security and earn mining rewards.

### For Traders

Maximize your financial engagement with in-depth information on:

- **[Decentralized Trading](dex.md)**: Trade any of Ergo's [native tokens](https://cruxfinance.io/tokens)
- **[Yield Farming & Staking](yield.md)**: Earn passive income through staking and liquidity pools.
- **[Arbitrage Opportunities](arb.md)**: Leverage price differentials across platforms.
- **[Using Financial Instruments](sigmausd.md)**: Stabilize your investments with instruments like SigmaUSD.
- **[Options Trading](options.md)**: Dive deep into options trading on Ergo.
- **[High-Risk Rewards](degfi.md)**: Navigate the rewards and risks with DegFi on Ergo.

### For Developers

Developers can explore robust tools and resources to build on Ergo’s flexible architecture:

- **[Developer Introduction](get-started.md)**: Start your development journey with this comprehensive guide.
- **[Smart Contract Development](ergoscript.md)**: Dive into developing secure and efficient smart contracts.

### For Enthusiasts

- **[Running a Node](install.md)**: Enhance your contributions by operating your own Ergo node.
- **[Using Off-Chain Bots](off-chain.md)**: Become a Rosen Watcher, run grid bots, oracles and more.
- **[Join the Sigmanauts](sigmanauts.md)**: Become a part of the Sigmanauts community and actively contribute to the development and expansion of the Ergo ecosystem.

### For Everyone

If you're new to cryptocurrencies or looking to understand Ergo’s basics:

- **[Securing Your Investments](https://ergonaut.space/en/Guides/yield/getting-started)**: Learn how to purchase and securely store ERG.
- **[Exploring the Ecosystem](uses/index.md)**: Discover how you can engage with various activities like NFTs, gaming, and charitable contributions.
- **[Airdrops, Token Sales, and IDOs](airdrops.md)**: Capitalize on airdrops, token sales, and initial DEX offerings.
- **[Gaming on Ergo](gaming.md)**: Master gaming within the Ergo ecosystem.
- **[Peer to Peer Trading](p2p-trading.md)**: Engage in direct trading activities with other users on the Ergo platform without the need for intermediaries, providing a decentralized and secure way to exchange assets.
- **[Get Involved in Community Marketing](marketing.md)**: Participate in spreading the word about Ergo and engage with the community to promote the platform.

## Engage with the Ergo Community

Ergo’s community is vibrant and continuously evolving. Keep updated with the latest developments, participate in community discussions, and find support through forums and social platforms.
38 changes: 26 additions & 12 deletions docs/uses/lets.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,40 @@
# Local Exchange Trading Systems
# Local Exchange Trading Systems (LETS)

A local exchange trading system **(LETS)** is a local mutual credit association in which members are allowed to create common credit money individually, written into a common ledger. LETS can be thought of as a mechanism to facilitate the velocity of trade, goods, and services out-with the existing monetary system, allowing us to create **sustainable local economies**.
Local Exchange Trading Systems (**LETS**) are innovative mutual credit associations that empower communities to create their own local currencies, fostering sustainable economies independent of traditional monetary systems. In a LETS, members can generate common credit money individually, which is then recorded in a shared ledger. This system enhances the velocity of trade, goods, and services within a community, providing a robust mechanism for economic resilience.

> As an example, assume that Alice, with zero balance, is willing to buy a litre of raw milk from Bob.
## How LETS Works

> First, they agree on a price; for example, assume that the price is about 2 Euro (as Alice and Bob are living in Ireland). After the deal is written into a ledger, Alice's balance becomes -2 (minus two) Euro, and Bob's balance becomes 2 Euro. Then Bob may spend his 2 Euro, for example, on homemade beer from Charlie. Such systems often impose limits on negative balances, and sometimes even on positive ones, to promote exchange in the community.
LETS can be visualized as a decentralized financial network where participants exchange goods and services using locally-created credit. Here's a simple example to illustrate:

Bob can spend his balance with other participants of the LETS, and the creation of credit allows for economic activity and velocity of money even where people have, temporarily, no cash. Of course, borrowing limits can be imposed, even on positive ones, to prevent hoarding within the LETS.
> Imagine Alice, with a zero balance, wants to buy a litre of raw milk from Bob.
> They agree on a price, say 2 Euros, as both are residing in Ireland. Once the transaction is recorded in the LETS ledger, Alice’s balance becomes -2 Euros, and Bob’s balance becomes +2 Euros.
> Bob can now spend his 2 Euros on homemade beer from Charlie, who is also part of the LETS.
## Crisis measures
This system enables economic activity even when participants have no cash, allowing for continuous trade and services within the community. Borrowing limits can be set to prevent negative or excessive positive balances, ensuring active participation and discouraging hoarding.

Systems like this have historically become popular during times of crisis. Michael Linton established the first system of this kind in a Canadian town stuck in depression back in 1981, and LETS were also popular during the 1998-2002 Argentine Great Depression.
## LETS in Times of Crisis

Most LETS groups consist of 50 to 250 members, with paper-based credit notes and ledgers maintained by a committee. However, it is unsurprising that paper-based LETS have suffered from problems such as counterfeit notes, fraudulent activity by administrators, and so on (much like centralized crypto exchanges). A blockchain-based LETS could be vastly superior to any previous system.
LETS have historically emerged as a solution during economic crises. The first LETS was established by Michael Linton in 1981 in a Canadian town grappling with depression. Similarly, during the Argentine Great Depression (1998-2002), LETS provided a lifeline for communities facing severe economic hardship.

Moreover, building lots of small credit systems on the same blockchain enables interoperability and novel financial products designed to strengthen the system. Hundreds of different LETS could exist, for individuals and small businesses, with different participation criteria, credit limits, collateralization requirements and other parameters. And yet, they could still be connected by gateways allowing liquidity to move between different LETS if required – while avoiding exposure to toxic debt.
Most traditional LETS groups consist of 50 to 250 members, with transactions recorded manually in paper-based ledgers maintained by a committee. However, such systems have often been vulnerable to issues like counterfeit notes and administrative fraud.

## More information
### Why Blockchain-Based LETS?

There are draft contracts for [basic implmentation](basic-imp.md), and thanks to [Sigma Protocols](crypto.md) we can create a [Trustless LETS](trustless-lets.md) on Ergo with no membership record; therefore, no management committee is needed for enrolment, allowing it to operate with full autonomy.
A blockchain-based LETS could revolutionize this concept by offering a more secure, transparent, and scalable solution. By utilizing blockchain technology, multiple small credit systems can operate on the same ledger, enabling:

See this [blog post](https://ergoplatform.org/en/blog/2021-07-01-lets-start-the-discussion/) for a longer introduction, or head over to the [LETS Discussion Summary on ergoforum](https://www.ergoforum.org/t/lets-discussion-summary/3492) to see the latest developments.
- **Interoperability**: Different LETS can interact seamlessly, allowing liquidity to flow between them as needed.
- **Resilience**: Blockchain ensures that transactions are immutable, secure, and transparent, reducing the risks associated with traditional paper-based systems.
- **Innovation**: The ability to design new financial products that strengthen the system, such as dynamic credit limits and automated collateralization requirements.

Hundreds of LETS could coexist on the same blockchain, each with its unique participation criteria, credit limits, and other parameters, yet remain connected through gateways that manage liquidity and exposure to toxic debt.

## Implementing LETS on Ergo

Ergo's blockchain offers unique capabilities to implement a LETS system without the need for centralized control. Thanks to [Sigma Protocols](crypto.md), we can create a **Trustless LETS** on Ergo with no need for a membership record or management committee, allowing the system to operate with complete autonomy.

### Explore Further

- **Draft Contracts**: For a basic implementation of LETS, check out our [basic implementation guide](basic-imp.md).
- **Trustless LETS**: Learn more about creating a fully autonomous LETS system with [Trustless LETS](trustless-lets.md).
- **Community Insights**: Read our [blog post](https://ergoplatform.org/en/blog/2021-07-01-lets-start-the-discussion/) for a deeper introduction to LETS.
- **Latest Developments**: Join the ongoing discussion in the [LETS Discussion Summary on ErgoForum](https://www.ergoforum.org/t/lets-discussion-summary/3492) to stay updated on the latest developments.
14 changes: 12 additions & 2 deletions docs/uses/lets/basic-imp.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
# Fundamental Implementation
# Basic Implementation of a Local Exchange Trading System (LETS)

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 [this ICO article](https://github.com/ergoplatform/ergo/wiki/An-ICO-Example-On-Top-Of-Ergo) as well as ErgoScript tutorials ([basic](https://ergoplatform.org/docs/ErgoScript.pdf) and [advanced](https://ergoplatform.org/docs/sigmastate_protocols.pdf)).
## 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 [this ICO article](ico.md) as well as [ErgoScript](ergoscript.md) 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

- The administrative contract oversees a singleton box that encompasses the members of the LETS system.
- This contract facilitates the addition of new members, at a rate of one member per transaction.
- Instead of storing members, the box merely holds a succinct digest of an authenticated data structure based on the members' directory.
Expand All @@ -15,6 +23,8 @@ In Ergo, when a token is minted with a value of one, it is termed a **singleton
- Moreover, the freshly generated member's box records the initial balance in the R4 register, which in this case is zero.
- The transaction that adds a new member is obligated to validate the correctness of the directory transformation.

### Committee Management

A committee generally manages the administrative contract box, and the composition of this committee may change over time. To accommodate this, we allow the committee's logic to reside in the R5 register. For instance, if a new member is added to both the committee and the LETS system, the incoming administrative contract box would require signatures from two out of three members, while the outgoing box would require three out of four signatures. Consequently, the data within the R5 register of the input and output boxes would vary.

Below, we provide the administrative contract's code written in ErgoScript, complete with comments. Note that `userContractHash` corresponds to the hash of the trade contract.
Expand Down
23 changes: 15 additions & 8 deletions docs/uses/lets/trustless-lets.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
# Trustless LETS
# Trustless Local Exchange Trading Systems (LETS)

A [Local Exchange Trading System](lets.md) (also known as *LETS*) involves several participants who agree to use a form of "local currency," typically pegged to the national currency at a 1:1 ratio. Let's consider an example of a LETS located in a European country, where the currency is Euros. The exchange is conducted in "local Euros," which are deemed equivalent to national Euros.
## Introduction

A [Local Exchange Trading System](lets.md) (LETS) involves several participants who agree to use a form of "local currency," typically pegged to the national currency at a 1:1 ratio. Let's consider an example of a LETS located in a European country, where the currency is Euros. The exchange is conducted in "local Euros," which are deemed equivalent to national Euros.

In LETS, each participant has an account holding their LETS balance (in Local Euros). New members start with a balance of zero, recorded in a ledger that could be decentralized. One distinctive aspect of LETS is that a member with a zero balance can "withdraw" money, but solely for payments to another LETS member. Consequently, the sum of all users' LETS balances is always zero at any given moment.

For instance, Alice, a LETS member with a zero balance, decides to buy one liter of milk from Bob, also a LETS member with a zero balance. Alice transfers 2 Euros from her account to Bob's, resulting in her balance becoming -2 and Bob's +2. Bob can then transfer some or all of his balance to another LETS member in return for goods or services.

### Implementation

As we aim to establish a decentralized LETS, we cannot rely on any trusted group to authenticate users. However, we will maintain a committee responsible for tasks like defining LETS parameters (local currency, the maximum number of members, etc.) and processing any joining fees.

## Trusted Pricing Oracle

We'll rely on a trusted _pricing oracle_ that provides the current conversion rate of euros to ergs, identified by a global id (`rateTokenID`). The oracle operates through a _singleton box_ that contains precisely one token with this id. A singleton box, which carries a _singleton token_ (a token with only one unit in existence), also holds the rate of ergs to euros for any given period. The rate gets updated by spending this box and creating another singleton box with the new rate.

## Token Box and Membership Tokens

Our LETS at any given moment is distinctly defined by a global _token box_ that houses some _membership tokens_ with id `letsTokenID`. This box outlines the LETS parameters such as location, currency unit, `rateTokenID`, and so on. Initially, the token box is started with a specified number, say 10,000 membership tokens. Users can spend this box and create their individual _LETS boxes_ as transaction outputs, where each output contains exactly one membership token. The remaining membership tokens are stored in a newly generated token box.

## LETS Box and Transactions

A LETS box symbolizes a LETS member and must be used in every transaction. For simplicity, this document restricts all LETS transactions to involve only two members - one sender and one receiver. In such transactions, the sender transfers a positive amount of the LETS currency (local euros) to the receiver, consuming the members' boxes and recreating them as outputs with updated balances.

### Variations
## Variations

The following table provides a brief overview of the LETS variants:

Expand Down Expand Up @@ -123,7 +130,7 @@ Compared to the managed LETS, the above system has the following differences:
* **No membership record**: Unlike the managed LETS, We don't store any membership information here.
* **Multiple-boxes**: A person can create multiple membership boxes, which is permitted. We only require that any negative balance be backed by the corresponding number of ergs locked.

##### LETS-1: Zero Sum, Collateral
### LETS-1: Zero Sum, Collateral

The above is the basic variant, which we call **LETS-1**. It has the following features:

Expand All @@ -133,14 +140,14 @@ The above is the basic variant, which we call **LETS-1**. It has the following f

The following are some variations of LETS-1.

##### LETS-2: Zero Sum, No collateral
### LETS-2: Zero Sum, No collateral

(A slight variation of LETS-1)

* **Non-refundable joining fee**: Like LETS-1, a joining fee is needed to prevent spam attacks. However, unlike LETS-1, this fee is non-refundable and must be sent to some predefined management committee.
* **Zero-Sum**: As in LETS-1.

##### LETS-3: Positive-Sum, Collateral
### LETS-3: Positive-Sum, Collateral


The above two variants require the total LETS balance to be always zero. Here we consider a positive value for this sum. In particular, this variant has the following properties:
Expand All @@ -151,7 +158,7 @@ The above two variants require the total LETS balance to be always zero. Here we

We can also allow topping up the LETS balance during a transaction by adding the equivalent amount of ergs.

##### LETS-4: Positive-Sum, No collateral
### LETS-4: Positive-Sum, No collateral

This is similar to LETS-3 but with some small variations:

Expand Down
Loading

0 comments on commit 964985c

Please sign in to comment.