StellarMinds-SmartContracts is the dedicated repository for all Stellar smart contracts powering StarkMinds—a pioneering blockchain education platform built on Stellar. Developed using Soroban, these smart contracts handle on-chain interactions such as course credentialing, token management, and secure data validation.
- Smart contract development using Soroban on Stellar
- Secure, efficient on-chain logic for education and credentialing
- Comprehensive testing suite for contract functionality
- Modular and scalable design for future enhancements
- Rust (latest stable version)
- Stellar CLI & Soroban CLI
- Docker (optional, for running a local Stellar testnet)
- Required environment variable:
STELLAR_SECRET_KEY(your Stellar secret key for deployment)
- Clone the Repository:
git clone https://github.com/your-username/starkminds-smartcontracts.git
- Navigate to the Repository:
cd starkminds-smartcontracts - Build the Smart Contracts:
cargo build --release
Run tests to ensure everything is functioning as expected:
cargo testTo maintain code quality and consistency, run the following commands locally before committing:
-
Format code:
cargo fmt
-
Check for linting issues:
cargo clippy
These checks are also enforced in CI and will fail the build if there are formatting issues or warnings.
The repository now includes a hardened deployment script for Soroban smart contracts:
scripts/deploy.sh(supports local, testnet, and mainnet)
Run the script from the project root:
./scripts/deploy.sh --network <local|testnet|mainnet> --contract <name> --wasm <path> [--dry-run]| Flag | Description |
|---|---|
--network <network> |
Specify which network to deploy to (local, testnet, or mainnet). |
--contract <name> |
Name of the contract to deploy. |
--wasm <path> |
Path to the WASM file to deploy. |
--dry-run |
Simulate the deployment steps without executing them. |
Network-specific settings (URLs, keys, etc.) are managed via environment files named .env.<network>. The script will automatically load the correct file based on the --network flag.
When --dry-run is specified, the script prints the deployment steps but does not execute them.
./scripts/deploy.sh --network testnet --contract certificate --wasm contracts/certificate/target/wasm32-unknown-unknown/release/certificate.optimized.wasm --dry-runThe scripts are linted and compatible with macOS and Linux.
- Ensure contracts are built and optimized:
cargo build --release --target wasm32-unknown-unknown
- Set
STELLAR_SECRET_KEYin your environment:export STELLAR_SECRET_KEY='your_secret_key_here'
- Optionally set
SOROBAN_RPC_URLfor a custom RPC endpoint.
The scripts automatically validate:
- Installed tools:
soroban,stellar,jq - Environment variables:
STELLAR_SECRET_KEY - Presence of optimized WASM files in:
target/wasm32-unknown-unknown/release/*.optimized.wasm
Run the scripts from the project root:
-
Testnet Deployment
./scripts/deploy_testnet.sh [OPTIONS]
-
Mainnet Deployment
./scripts/deploy_mainnet.sh [OPTIONS]
| Flag | Description | Required | Default |
|---|---|---|---|
--contract <name> |
Deploy a specific contract (e.g., certificate). If omitted, deploys all contracts. | No | All contracts |
--dry-run |
Preview the deployment steps without executing any soroban commands. Useful for verification. | No | Disabled |
--profile <name> |
Specify a Soroban profile (e.g., for AWS or custom config). | No | None |
--verbose |
Enable detailed output, including file paths and network details. | No | Disabled |
--help |
Display usage information and exit. | No | N/A |
- Mainnet deployment requires explicit confirmation by typing YES (in all caps).
- In
--dry-runmode, commands are echoed but not executed, and simulated contract IDs are generated. - Contract names must match the basename of your
.optimized.wasmfiles (e.g.,certificate.optimized.wasm).
-
Dry-run all contracts to testnet (preview only):
./scripts/deploy_testnet.sh --dry-run
-
Deploy a specific contract to testnet:
./scripts/deploy_testnet.sh --contract certificate
-
Verbose dry-run for a specific contract to mainnet:
./scripts/deploy_mainnet.sh --contract certificate --dry-run --verbose
-
Deploy all contracts to mainnet with a custom profile:
./scripts/deploy_mainnet.sh --profile myprofile
After successful deployment, contract IDs are saved to:
target/<contract_name>.<network>.id
For advanced configurations or troubleshooting, refer to the Soroban documentation.
We welcome contributions to improve our smart contracts!
- Fork the repository.
- Create a new branch:
git checkout -b feature/your-feature-name
- Make your changes with clear, descriptive commit messages.
- Push your branch and open a pull request with a detailed description of your changes.
Ensure that your contributions adhere to our coding standards and include appropriate tests.
This repository contains several smart contracts that power the StarkMinds educational platform:
- Analytics Contract - Comprehensive learning analytics and progress tracking
- Certificate Contract - Educational credential management with expiry and multi-signature support
- Mint Batch Certificates Contract - Efficient batch certificate issuance
- Mobile Optimizer Contract - Mobile optimization with offline capabilities and gas optimization
- Progress Contract - Simple course progress tracking with validation
- Proxy Contract - Upgradeable contract implementation with rollback support
- Search Contract - Advanced search system with saved searches and analytics
- Shared Contract - Common utilities including RBAC and reentrancy protection
- Student Progress Tracker Contract - Granular module-level progress tracking
- Token Contract - Token management with incentive system and staking
Each contract includes comprehensive documentation covering:
- Overview: Purpose and main functionality
- Interface: Public functions and parameters
- Events: Emitted events and their schemas
- Configuration: Settings and environment variables