Skip to content

HasToBeJames/stellovault

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

75 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

StelloVault

A secure trade finance dApp built on Stellar & Soroban
Tokenizing collateral (invoices, commodities, etc.) to unlock instant liquidity for exporters and importers, bridging the massive trade finance gap.

Stellar Soroban Next.js TypeScript CI


πŸš€ Overview

StelloVault is a trade finance dApp that enables SMEs to tokenize real-world assets (invoices, commodities) as Stellar assets with embedded metadata, use them as collateral in multi-signature escrows managed by Soroban smart contracts, and unlock instant cross-border liquidity.

Key innovations:

  • Collateral Tokenization β€” Real assets become fractional, traceable Stellar tokens.
  • Automated Escrows β€” Multi-sig + conditional release triggered by shipment verification oracles.
  • Dynamic Financing β€” Algorithmic loans based on on-chain history and utilization.
  • Risk Scoring β€” On-chain creditworthiness scoring using transaction history.
  • Governance β€” Quadratic voting for protocol parameters and accepted collateral types.

Trade finance gap: $100–120B+ annually (Afreximbank, African Development Bank), disproportionately affecting SMEs under the AfCFTA. StelloVault targets reducing intermediary costs by up to 50%.


✨ Key Features

Feature Description
Collateral Tokenization Mint Stellar assets from invoices/goods with provenance metadata
Multi-Sig Escrows Soroban enforces release on oracle confirmation
Oracle Integration Real-time data feeds for shipment & quality verification
Risk Scoring Engine On-chain history β†’ dynamic loan terms
Frontend Dashboard Next.js UI for deal origination, escrow monitoring, repayments
Governance Module On-chain quadratic voting for protocol parameters
Flash Settlements Instant cross-border payments via Stellar DEX/path payments
Real-time Updates WebSocket push for escrow/loan state changes

πŸ“‚ Repository Structure

stellovault/
β”œβ”€β”€ contracts/          # Soroban Smart Contracts (Rust)
β”œβ”€β”€ frontend/           # Next.js Frontend Application
β”œβ”€β”€ server/             # TypeScript/Express Backend API  ← active
β”œβ”€β”€ backend/            # Rust/Axum Backend  (archived β€” superseded by /server)
└── .github/
    └── workflows/
        └── ci.yml      # CI: server (TS) + contracts (Rust)

contracts/ β€” Soroban Smart Contracts (Rust)

  • Tech: Rust Β· Soroban SDK
  • Purpose: On-chain escrow, collateral tokenization, governance, fee management
  • Build: cargo build --release --target wasm32-unknown-unknown

frontend/ β€” User Interface

  • Tech: Next.js 14+, TypeScript, Tailwind CSS
  • Features: Dashboard, escrow management, collateral upload, governance voting
  • Dev: npm run dev

server/ β€” TypeScript Backend API (active backend)

  • Tech: Express.js Β· TypeScript Β· Prisma Β· PostgreSQL Β· @stellar/stellar-sdk
  • Pattern: Non-custodial Β· Account Abstraction (Fee Payer) Β· Event-driven
  • Dev: npm run dev
server/
β”œβ”€β”€ prisma/
β”‚   └── schema.prisma               # DB models (User, Loan, Escrow, Collateral …)
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app.ts                      # Express app entry point
β”‚   β”œβ”€β”€ config/
β”‚   β”‚   β”œβ”€β”€ env.ts                  # Typed environment variables
β”‚   β”‚   β”œβ”€β”€ contracts.ts            # Soroban contract IDs
β”‚   β”‚   └── errors.ts               # Custom error classes
β”‚   β”œβ”€β”€ controllers/                # HTTP request handlers (thin orchestration layer)
β”‚   β”‚   β”œβ”€β”€ auth.controller.ts
β”‚   β”‚   β”œβ”€β”€ wallet.controller.ts
β”‚   β”‚   β”œβ”€β”€ user.controller.ts
β”‚   β”‚   β”œβ”€β”€ escrow.controller.ts
β”‚   β”‚   β”œβ”€β”€ collateral.controller.ts
β”‚   β”‚   β”œβ”€β”€ loan.controller.ts
β”‚   β”‚   β”œβ”€β”€ oracle.controller.ts
β”‚   β”‚   β”œβ”€β”€ governance.controller.ts
β”‚   β”‚   β”œβ”€β”€ risk.controller.ts
β”‚   β”‚   └── user.controller.ts      # also handles /analytics
β”‚   β”œβ”€β”€ routes/                     # Express routers mounted under /api/v1
β”‚   β”œβ”€β”€ services/                   # Core business & blockchain logic
β”‚   β”‚   β”œβ”€β”€ blockchain.service.ts   # Horizon / native Stellar ops
β”‚   β”‚   β”œβ”€β”€ contract.service.ts     # Soroban XDR builder (Account Abstraction)
β”‚   β”‚   β”œβ”€β”€ database.service.ts     # Prisma ORM wrappers
β”‚   β”‚   └── event-monitoring.service.ts  # On-chain event poller
β”‚   └── middleware/
β”‚       β”œβ”€β”€ auth.middleware.ts      # JWT Bearer verification
β”‚       β”œβ”€β”€ error.middleware.ts     # Central error β†’ HTTP status mapping
β”‚       └── rate-limit.middleware.ts
β”œβ”€β”€ package.json
β”œβ”€β”€ tsconfig.json
β”œβ”€β”€ .env.example
└── migration_issues.md             # GitHub issues for full feature implementation

API Routes (all under /api/v1):

Prefix Domain
/auth Wallet challenge/sign/verify, JWT rotation
/wallets Link, unlink, set-primary wallet
/users User profiles
/escrows Escrow lifecycle + webhook
/collateral Collateral records
/loans Loan issuance + repayments
/oracles Oracle node registry + confirmations
/confirmations Oracle event confirmations
/governance Proposals, votes, audit log
/risk Risk scoring + historical + simulation
/analytics Platform-wide aggregated stats

backend/ β€” Rust/Axum Backend (archived)

The original Rust backend is preserved here for reference. It has been superseded by the TypeScript server above. See backend/README.md for details.


πŸ›  Getting Started

Prerequisites

Tool Version
Node.js 20+
npm 9+
PostgreSQL 14+
Rust stable
Soroban CLI latest

TypeScript Server

cd server
cp .env.example .env   # fill in DATABASE_URL, FEE_PAYER_SECRET, contract IDs
npm install
npx prisma migrate dev
npm run dev            # starts on http://localhost:3001

Soroban Contracts

cd contracts
cargo build --release --target wasm32-unknown-unknown
cargo test

Frontend

cd frontend
npm install
npm run dev            # starts on http://localhost:3000

πŸ”„ Transaction Flow (Non-Custodial / Account Abstraction)

User                    Server                    Stellar/Soroban
 β”‚                         β”‚                            β”‚
 β”‚  POST /api/v1/escrows   β”‚                            β”‚
 │────────────────────────▢│                            β”‚
 β”‚                         β”‚  Build XDR (Fee Payer src) β”‚
 β”‚                         │───────────────────────────▢│
 β”‚  { escrowId, xdr }      β”‚                            β”‚
 │◀────────────────────────│                            β”‚
 β”‚                         β”‚                            β”‚
 β”‚  Sign auth entries      β”‚                            β”‚
 β”‚  (client-side only)     β”‚                            β”‚
 │────────────────────────▢│                            β”‚
 β”‚                         β”‚  Sign as Fee Payer         β”‚
 β”‚                         β”‚  Submit signed XDR         β”‚
 β”‚                         │───────────────────────────▢│
 β”‚                         β”‚         { txHash }         β”‚
 β”‚  { success, txHash }    β”‚                            β”‚
 │◀────────────────────────│                            β”‚

The backend never holds user private keys. It only acts as Fee Payer for sponsoring gas costs.


βš™οΈ CI

Two parallel jobs run on every push/PR to main or contract:

Job Directory Checks
server ./server npm ci β†’ prisma generate β†’ tsc --noEmit β†’ npm test
contracts ./contracts cargo fmt β†’ cargo clippy β†’ cargo build β†’ cargo test

🀝 Contributing

  1. Fork β†’ clone β†’ git remote add upstream https://github.com/anonfedora/stellovault.git
  2. git checkout -b feature/my-feature
  3. Implement + test
  4. git push origin feature/my-feature β†’ open a PR against main

Guidelines:

  • TypeScript: follow prettier formatting (server/)
  • Rust: cargo fmt + cargo clippy must pass (contracts/)
  • All new endpoints need controller + route + service
  • Use the issue tracker β€” see server/migration_issues.md for the full feature backlog

πŸ“„ License

MIT Β© StelloVault Contributors

About

A secure trade finance decentralized application (dApp) built on Stellar & Soroban Tokenizing collateral (invoices, commodities, etc.) to unlock instant liquidity for African exporters and importers, bridging the massive trade finance gap.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 73.9%
  • Rust 24.6%
  • Other 1.5%