Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions docs/class-1-stablecoin-issuance-walkthrough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Class 1 — Stablecoin Issuance Walkthrough

## Purpose

Class 1 demonstrates the minimum lifecycle of a Stellar classic asset used as a fictional stablecoin.

It shows how an issuer creates an asset, how a holder consents to receive it through a trustline, and how payments fail when that consent does not exist.

## Actors

- `issuer`: the account that defines and issues the asset.
- `distributor`: the operational account that receives the initial supply.
- `holder`: the user account that must explicitly trust the asset before receiving it.

## Asset Identity

A Stellar classic asset is identified by both its code and its issuer:

```text
CODE:ISSUER
```

For example:

```text
cBRL:G...
```

This means that `cBRL` alone is not enough to identify the asset. The issuer public key is part of the asset identity.

## Class 1 Flow

1. Create and fund fresh testnet accounts.
2. Define the fictional `cBRL` asset.
3. The distributor creates a trustline to `cBRL`.
4. The issuer sends the initial supply to the distributor.
5. The distributor attempts to pay a holder with no trustline.
6. The payment fails with `op_no_trust`.
7. The holder creates a trustline.
8. The distributor pays the holder successfully.

## What This Demonstrates

Class 1 demonstrates three core Stellar asset concepts:

- Asset issuance is performed by the issuer account.
- A receiver must explicitly consent to hold a non-native asset through a trustline.
- Without a trustline, a payment fails with `op_no_trust`.

## What This Does Not Cover

This is an educational testnet simulation. It does not cover the full requirements of a production-grade stablecoin, such as:

- reserve management;
- redemption;
- compliance and KYC;
- custody;
- audits;
- governance of issuer keys;
- legal enforceability of the peg.

## Why This Matters

For regulated or semi-regulated assets, such as stablecoins, tokenized collateral, or energy settlement instruments, the key question is not only:

```text
What is the token?
```

The stronger question is:

```text
Who controls the asset, and where is that authority encoded?
```

Class 1 answers the first part of that question by showing issuer identity and holder consent.

## Related Files

- `scripts/reproduce/class-1.ts`
- `src/operations/trustline.ts`
- `src/operations/issue.ts`
- `src/lib/tx.ts`
- `docs/control-spectrum.md`
- `docs/architecture.md`