Skip to content
kishore-dubeyPublic

About

Blockchain solution for SPV token system

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Stakes Core

Stakes is an early-stage, local development prototype for a permissioned real-estate tokenization platform. It is not production-ready and does not constitute a regulated product, custody service, or legal/compliance advice.

What we are building

One SPV (a legal vehicle for a property) can issue a permissioned ERC-3643-style token. An investor must first pass KYC and be registered in the on-chain identity registry. The platform then records the AED subscription in its off-chain ledger and mints tokens using an approved on-chain action.

The local environment contains:

Component Purpose Local port
NestJS API Business logic and HTTP endpoints 3000
PostgreSQL Off-chain users, SPVs, and AED ledger 5432
Anvil Local Ethereum-compatible blockchain 8545
Redis Future cache and order-book support 6379

Concepts to learn first

  • Wallet address: The public address that receives tokens. It is safe to share, unlike a private key.
  • Smart contract: Program deployed to the blockchain. It has persistent state and transaction rules.
  • Identity registry: Contract mapping a wallet to a verified identity record. The token checks it before minting or transferring.
  • Relayer: A backend service that submits an approved transaction. It must not be treated as a universal admin key.
  • Off-chain ledger: The database accounting record for AED and legal entitlements. Token balances and cash balances are different quantities; linked business flows are reconciled instead.

First local run

Prerequisites: Node.js 20+, Docker Desktop, and Docker Compose.

Copy-Item .env.example .env
npm run prisma:generate
docker compose up -d
npm run db:migrate
npm run contracts:build
npm run contracts:deploy:local
npm run start:dev

Run the commands in separate terminals after the initial setup. The deployment step creates .env with the locally deployed contract addresses. The displayed private key is Anvil's public development-only key; never use it with real funds or outside a local environment.

Run npm run prisma:generate whenever prisma/schema.prisma changes; it creates the TypeScript database client used by the API.

The /dev-tools/* endpoints exist only when NODE_ENV is not production; they are intentionally excluded in a production process.

Documentation

First contract lesson: separated authority

The prototype token separates five responsibilities:

  • Governance admin: assigns and revokes operational roles; it cannot mint merely because it is governance.
  • Issuance agent: mints verified-investor tokens and burns tokens for an approved redemption.
  • Compliance agent: freezes or unfreezes a wallet, preventing ordinary transfers.
  • Settlement agent: transfers tokens for an approved matched trade.
  • Recovery agent: can carry out a forced transfer only from a frozen wallet to a verified, unfrozen replacement wallet.

This is a local learning model, not a final governance design. Production roles should be backed by distinct organizational approvals and KMS/HSM signing policies rather than single wallet addresses.

About

Blockchain solution for SPV token system

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages