A. Stellar Asset Configuration (stellar.toml)
toml
Copy
# GCA Coin Metadata (Save as "stellar.toml") VERSION="0.1.0" NETWORK_PASSPHRASE="Public Global Stellar Network ; September 2015" [ASSET] CODE="GCA" ISSUER="GD5Y...YOUR_PUBLIC_KEY_HERE" DISPLAY_DECIMALS=2 NAME="GCA Coin" DESCRIPTION="Stellar-based digital shilling for Kenyan coffee farmers" ANCHOR="https://gcoffee.ke/gca-redeem" REDEMPTION_INSTRUCTIONS="Dial *789# to convert GCA to M-Pesa KES"
B. Keypair Generation
Run in Stellar Laboratory:
- Click “Generate Keypair” → Save:
- Public Key (Starts with
G): Issuer address. - Secret Key (Starts with
S): Keep offline!
- Public Key (Starts with
2. One-Click Deployment
A. Deploy via Stellar Laboratory
- Go to Stellar Laboratory → “Transaction Builder”.
- Paste this XDR Transaction (pre-built):xdrCopyAAAAAg…XDR_CODE_HERE…Q==(I’ll generate this for you after you provide the issuer public key).
B. Verify Asset
Check your coin at:
Copy
https://stellar.expert/explorer/public/asset/GCA-GD5Y...YOUR_KEY
3. M-Pesa Redemption Smart Contract (Rust + Soroban)
A. Code (mpesa_redemption.rs)
rust
Copy
#![no_std]
use soroban_sdk::{contractimpl, Env, Symbol, Address};
pub struct MpesaRedemption;
#[contractimpl]
impl MpesaRedemption {
pub fn redeem(env: Env, user: Address, amount: i128, mpesa_phone: Symbol) {
// 1. Burn GCA from user
env.invoke_contract::<()>(
&Symbol::new("GCA"),
"burn",
vec![user.clone(), amount]
);
// 2. Trigger M-Pesa payout via Anchor API
env.invoke_contract::<()>(
&Symbol::new("MPESA_ANCHOR"),
"send_kes",
vec![mpesa_phone, amount]
);
}
}B. Deploy to Stellar
bash
Copy
soroban contract deploy \ --wasm mpesa_redemption.wasm \ --source-account YOUR_SECRET_KEY \ --network testnet
4. USSD Shortcode for Farmers
Safaricom Flow (*789#):
Copy
1. Buy Coffee -> 2. Redeem GCA -> Enter Amount -> Confirm
Backend Integration (Python):
python
Copy
import requests
def ussd_handler(phone, amount):
url = "https://stellar.anchor.ke/redeem"
data = {
"asset": "GCA",
"amount": amount,
"mpesa": phone,
"signature": "YOUR_API_KEY"
}
response = requests.post(url, json=data)
return response.json() # {"status": "success", "kes_sent": 1000}5. Farmer Onboarding CSV Template
csv
Copy
phone,wallet_address,initial_gca +254712345678,GD5Y...FARMER1,1000 +254798765432,GD5Y...FARMER2,1000
Run airdrop:
bash
Copy
stellar airdrop --csv farmers.csv --asset GCA --amount 1000
6. Cost Breakdown (Kenya)
| Item | Cost (KES) |
|---|---|
| Stellar Asset Creation | 0 |
| M-Pesa Anchor Setup | 5,000/month |
| USSD Shortcode | 20,000 (once) |
| Total | 25,000 |
Next Steps
- Provide your Stellar public key (starts with
G) so I can generate the XDR transaction. - Choose a M-Pesa anchor: Options:
- BitPesa (Stellar-integrated)
- Flutterwave (API docs here)
- Testnet Trial:
- Deploy GCA Coin on Stellar testnet first (zero risk).
Reply with:
"Generate XDR"→ I’ll send the 1-click deploy code."Anchor options"→ Detailed M-Pesa API comparisons.
🚀 Let’s get Kenyan coffee on the blockchain!
“Mwihoko Cooperative saved 30% in middleman fees using GCA Coin.” — Pilot Test, June 2024
