TTTTT eeeee aaaaa ccccc h h L i n n k k
T e a a c h h L nn n k k
T eeee aaaaa c hhhhh L i n n n kkk
T e a a c h h L i n nn k k
T eeeee a a ccccc h h LLLLL i n n k k
TeachLink is a Soroban smart contract that powers tokenized learning rewards on the Stellar network. This repository contains the Rust smart contract and developer tooling for building, testing, and deploying the contract to Stellar testnet or mainnet.
- Overview
- Interactive Documentation
- Onboarding
- Architecture
- Development Workflow
- Contribution Guidelines
- Troubleshooting
- License
TeachLink enables tokenized learning rewards, proof-of-participation, and educator incentives. The contract is written in Rust for Soroban, Stellar's smart contract platform.
Explore the TeachLink contract interactively with live code execution, API exploration, and guided tutorials. The interactive documentation provides an engaging way to understand the contract's architecture and implementation.
To run the interactive docs:
cd docs/interactive
cargo runThen open http://localhost:3000 in your browser.
The onboarding flow is designed to take you from clone to first deployment with minimal guesswork.
git clone https://github.com/rinafcode/teachLink_contract.git
cd teachLink_contractRun the setup script to validate required dependencies and create a local .env file if needed:
./scripts/setup-env.shWhat it checks:
rustc,cargo, andrustupwasm32-unknown-unknowntargetstellarorsorobanCLI- local
.envbootstrap from.env.example
Update .env with your deployment settings:
STELLAR_NETWORK=testnet
STELLAR_HORIZON_URL=https://horizon-testnet.stellar.org
STELLAR_SOROBAN_RPC_URL=https://soroban-testnet.stellar.org
DEPLOYER_SECRET_KEY=SXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXIf you do not have a key, generate one with the Stellar CLI:
stellar keys generate --global teachlink-deployercargo build --release --target wasm32-unknown-unknown -p teachlink-contract
cargo testThe tutorial script walks you through building, funding, and deploying to testnet:
./scripts/first-deploy.shCommon options:
./scripts/first-deploy.sh --network testnet --identity teachlink-deployer
./scripts/first-deploy.sh --skip-build
./scripts/first-deploy.sh --dry-runUse the network-aware deployment script with managed config files:
./scripts/deploy.sh --network testnet
./scripts/deploy.sh --network mainnet
./scripts/deploy.sh --network localConvenience wrappers:
./scripts/deploy-testnet.sh
./scripts/deploy-mainnet.sh
./scripts/deploy-local.shConfiguration files live under config/networks/ and can be customized per environment:
config/networks/testnet.env
config/networks/mainnet.env
config/networks/local.envClient Apps
|
v
Indexer / API Layer (optional)
|
v
Soroban Smart Contract (Rust)
|
v
Stellar Network
Key project paths:
contracts/teachlink: Soroban smart contract sourcescripts/: onboarding and deployment script
Build the WASM:
cargo build --release --target wasm32-unknown-unknown -p teachlink-contractRun unit tests:
cargo testLint and format:
cargo fmt
cargo clippy --all-targets --all-featuresWe welcome contributions that improve contract quality, developer experience, and documentation.
- Fork the repo and create a feature branch.
- Make focused changes with tests.
- Run the full test and lint suite.
- Open a PR with a clear summary and testing notes.
When adding contract entrypoints, include unit tests in the same module or under #[cfg(test)]:
#[contractimpl]
impl TeachLinkContract {
#[must_use]
pub fn hello(_env: Env, to: Symbol) -> Symbol {
to
}
}
#[test]
fn hello_returns_input() {
let env = Env::default();
let input = Symbol::new(&env, "teachlink");
let out = TeachLinkContract::hello(env.clone(), input);
assert_eq!(out, Symbol::new(&env, "teachlink"));
}- All new contract logic must include unit tests.
cargo testmust pass.cargo fmtandcargo clippy --all-targets --all-featuresmust pass with no new warnings.
Use ./scripts/setup-env.sh as your first diagnostic. It prints missing dependencies and how to fix them.
Common issues:
Missing command: stellar or soroban- Install the CLI:
cargo install --locked stellar-cli --features opt
- Install the CLI:
Rust target not installed: wasm32-unknown-unknown- Run:
rustup target add wasm32-unknown-unknown
- Run:
WASM not foundduring deployment- Rebuild:
cargo build --release --target wasm32-unknown-unknown -p teachlink-contract - Verify the path:
target/wasm32-unknown-unknown/release/teachlink_contract.wasm
- Rebuild:
DEPLOYER_SECRET_KEYis empty- Generate a key:
stellar keys generate --global teachlink-deployer - Update
.envwith the secret key
- Generate a key:
Account not fundedortransaction failedon testnet- Re-run the tutorial without
--skip-fund - Or fund manually:
https://friendbot.stellar.org?addr=<PUBLIC_KEY>
- Re-run the tutorial without
curl not foundwhile funding- Install curl or fund the account manually using the friendbot URL
This project is licensed under the MIT License. See LICENSE for details.