Audience: developers setting up a local development environment and operators deploying to Stellar testnet or mainnet.
Related reading:
- Production Deployment Guide — production deployment procedures
- Configuration Reference — environment variables for Stellar configuration
- Smart Contract Guide — Soroban contract development
- Overview
- Stellar Networks
- Local Sandbox Setup
- Testnet Setup
- Mainnet Setup
- Contract Deployment
- Wallet and Key Management
- Troubleshooting
- Cross-References
Trustchain Escrow runs on the Stellar network using Soroban smart contracts. The platform supports three network environments:
| Environment | Use Case | RPC Endpoint | Horizon |
|---|---|---|---|
| Local | Development and testing | http://localhost:8001 |
http://localhost:8000 |
| Testnet | Pre-production testing | https://soroban-testnet.stellar.org |
https://horizon-testnet.stellar.org |
| Mainnet | Production | https://soroban-rpc.mainnet.stellar.org |
https://horizon.stellar.org |
Soroban RPC is the primary interface for interacting with Soroban smart contracts on Stellar. It provides:
- Contract invocation (read and write)
- Transaction submission
- Event subscription
- Ledger data access
Horizon is the Stellar network's REST API. It provides:
- Account and transaction history
- Fee statistics
- Network health checks
- Friendbot (testnet only) for funding test accounts
Each Stellar network has a unique passphrase that signs transactions:
| Network | Passphrase |
|---|---|
| Local | Standalone Network ; February 2017 |
| Testnet | Test SDF Network ; September 2015 |
| Mainnet | Public Global Stellar Network ; September 2015 |
The fastest way to get a local Stellar environment running is the Stellar Quickstart sandbox with Soroban support.
- Docker and Docker Compose
- Node.js 20+
- Rust toolchain with
wasm32-unknown-unknowntarget - Stellar CLI (optional, for contract deployment)
Run the provided sandbox script:
bash scripts/start-sandbox.shThis script:
- Starts the Stellar Quickstart container with Soroban RPC enabled
- Waits for Horizon to become healthy
- Configures the
soroban-clinetwork profile namedlocal - Provisions pre-funded test wallets (client, freelancer, arbiter)
- Builds and deploys the escrow contract to the local network
- Patches
frontend/.env.localwith the local network settings
If you prefer to set up the sandbox manually:
# 1. Start the Stellar Quickstart container
docker compose up -d stellar
# 2. Wait for Horizon to be ready
curl -sf http://localhost:8000/health
# 3. Configure soroban-cli
soroban network add \
--rpc-url http://localhost:8001 \
--network-passphrase "Standalone Network ; February 2017" \
local
# 4. Fund a test account
curl -sf "http://localhost:8000/friendbot?addr=<ACCOUNT_ADDRESS>"
# 5. Deploy the contract
soroban contract deploy \
--wasm target/wasm32-unknown-unknown/release/escrow_contract.wasm \
--source <source-keypair> \
--network localNEXT_PUBLIC_STELLAR_NETWORK=local
NEXT_PUBLIC_HORIZON_URL=http://localhost:8000
NEXT_PUBLIC_SOROBAN_RPC_URL=http://localhost:8001
NEXT_PUBLIC_NETWORK_PASSPHRASE="Standalone Network ; February 2017"
NEXT_PUBLIC_API_URL=http://localhost:4000
NEXT_PUBLIC_CONTRACT_ID=<deployed-contract-id>- Stellar CLI installed (
cargo install soroban-cli) - A funded testnet account (use Friendbot)
# Generate a keypair
soroban keys generate testnet-wallet --network testnet
# Fund via Friendbot
curl -sf "https://friendbot.stellar.org/?addr=$(soroban keys address testnet-wallet --network testnet)"# Set the network environment variable
export STELLAR_NETWORK=testnet
export STELLAR_KEY=testnet-wallet
# Run the deployment script
bash scripts/deploy.shOr deploy manually:
soroban contract deploy \
--wasm target/wasm32-unknown-unknown/release/escrow_contract.wasm \
--source testnet-wallet \
--network testnetNEXT_PUBLIC_STELLAR_NETWORK=testnet
NEXT_PUBLIC_HORIZON_URL=https://horizon-testnet.stellar.org
NEXT_PUBLIC_SOROBAN_RPC_URL=https://soroban-testnet.stellar.org
NEXT_PUBLIC_NETWORK_PASSPHRASE="Test SDF Network ; September 2015"
NEXT_PUBLIC_CONTRACT_ID=<testnet-contract-id>- Stellar CLI installed
- A funded mainnet account with sufficient XLM for transaction fees
- A completed security audit of the smart contract
- Mainnet contract address recorded in
backend/.envandfrontend/.env.production
export STELLAR_NETWORK=mainnet
export STELLAR_KEY=<mainnet-keypair>
bash scripts/deploy.shNEXT_PUBLIC_STELLAR_NETWORK=mainnet
NEXT_PUBLIC_HORIZON_URL=https://horizon.stellar.org
NEXT_PUBLIC_SOROBAN_RPC_URL=https://soroban-rpc.mainnet.stellar.org
NEXT_PUBLIC_NETWORK_PASSPHRASE="Public Global Stellar Network ; September 2015"
NEXT_PUBLIC_CONTRACT_ID=<mainnet-contract-id>- Smart contract audit completed
- Admin keys stored in a secure vault (not in
.envfiles) - Contract verified on StellarExpert or similar explorer
- Testnet deployment tested end-to-end
- Backup and recovery procedures documented
- Monitoring and alerting configured for mainnet
cd contracts/escrow_contract
cargo build --release --target wasm32-unknown-unknown
cd -The scripts/deploy.sh script handles building and deploying to the configured network:
# Deploy to testnet (default)
bash scripts/deploy.sh
# Deploy to mainnet
STELLAR_NETWORK=mainnet bash scripts/deploy.shAfter deployment, initialize the contract with the admin address:
soroban contract invoke \
--id <contract-id> \
--source <admin-keypair> \
--network <network> \
-- initialize \
--admin "$(soroban keys address <admin-keypair>)"soroban contract call \
--id <contract-id> \
--source <admin-keypair> \
--network <network> \
-- get_admin# Local network
soroban keys generate local-admin --network local
# Testnet
soroban keys generate testnet-admin --network testnet
# Mainnet
soroban keys generate mainnet-admin --network mainnet# Friendbot for testnet
curl -sf "https://friendbot.stellar.org/?addr=<ACCOUNT_ADDRESS>"
# Friendbot for local sandbox
curl -sf "http://localhost:8000/friendbot?addr=<ACCOUNT_ADDRESS>"soroban keys address <keypair-name> --network <network># Check if the container is running
docker ps | grep stellar
# Check container logs
docker compose logs stellar
# Reset and restart
bash scripts/start-sandbox.sh --reset
bash scripts/start-sandbox.sh- Ensure the account has sufficient XLM for the transaction fee (minimum 1 XLM on testnet)
- Verify the network passphrase matches the target network
- Check that the WASM file was built for the correct target (
wasm32-unknown-unknown)
# Check Horizon health
curl http://localhost:8000/health
# Check container status
docker compose ps stellar
# Restart the Stellar container
docker compose restart stellar# Install soroban-cli
cargo install soroban-cli
# Verify installation
soroban --version- Check the Stellar network status at stellar.expert
- Verify the account sequence number is correct
- Ensure the network passphrase matches the target network
- Production Deployment Guide — production deployment procedures
- Configuration Reference — environment variables for Stellar configuration
- Smart Contract Guide — Soroban contract development
- Docker Compose Configuration — local infrastructure setup