This guide covers deploying the FlowStar streaming contract to Stellar testnet or mainnet and connecting it to the frontend.
- Rust toolchain with the
wasm32v1-nonetarget:rustup target add wasm32v1-none
- stellar-cli:
cargo install stellar-cli --locked
- Node.js 18+ for the frontend
Use the provided script to generate a testnet identity and fund it via Friendbot:
./scripts/fund-testnet.sh deployerThis creates a stellar-cli identity named deployer and funds it with 10,000 XLM on testnet.
To create additional test accounts (e.g. a recipient for testing):
./scripts/fund-testnet.sh recipient-teststellar keys generate deployer --network testnet
stellar keys fund deployer --network testnet# Deploy to testnet and update .env.local automatically
./scripts/deploy.sh --update-env
# Deploy to mainnet with a specific identity
./scripts/deploy.sh --network mainnet --source prod-deployer --update-envThe script will:
- Build the contract WASM (
stellar contract build) - Deploy to the specified network
- Print the new contract ID
- Optionally write it to
.env.local
# Build
cd contracts/streaming
stellar contract build
# Deploy
cd ../..
stellar contract deploy \
--wasm contracts/target/wasm32v1-none/release/flowstar_streaming.wasm \
--source deployer \
--network testnetCopy the output contract ID for the next step.
Set the contract ID in your environment:
# .env.local
NEXT_PUBLIC_STREAM_CONTRACT_ID=<your-contract-id>Then start the app:
npm install --legacy-peer-deps
npm run devThe app automatically switches from mock mode to live contract calls when NEXT_PUBLIC_STREAM_CONTRACT_ID is set.
- Open the app at
http://localhost:3000 - Connect a Freighter wallet set to the correct network
- Create a test stream with a small amount
- Confirm both the
approveandcreate_streamtransactions succeed
You can also inspect the contract on Stellar Expert.
Which network the app talks to is controlled by NEXT_PUBLIC_STELLAR_NETWORK
(see .env.local.example). Set it to mainnet to point the app at the
Stellar Public Network; omit it (or set it to anything else) to default to
testnet. Because it's a NEXT_PUBLIC_ variable, changing it requires a
rebuild.
The per-network settings themselves live in lib/stellar.ts. For mainnet, update:
| Field | Testnet | Mainnet |
|---|---|---|
name |
testnet |
mainnet |
passphrase |
Test SDF Network ; September 2015 |
Public Global Stellar Network ; September 2015 |
rpcUrl |
https://soroban-testnet.stellar.org |
Your RPC provider URL |
horizonUrl |
https://horizon-testnet.stellar.org |
https://horizon.stellar.org |
Update KNOWN_TOKENS addresses to match the mainnet token contracts.
"stellar-cli not found" — Install with cargo install stellar-cli --locked.
"Simulation failed" — The deployer account may not have enough XLM. Fund it again with ./scripts/fund-testnet.sh deployer.
"Wallet not connected" — Make sure Freighter is installed and set to the same network as your deployment.
Contract builds but deploy fails — Ensure the wasm32v1-none Rust target is installed: rustup target add wasm32v1-none.