This guide explains how to deploy all smart contracts to the Stellar Soroban testnet.
Ensure you have the following installed:
- Rust (latest stable)
- Soroban CLI
- Stellar CLI
- A funded Stellar testnet account (via Friendbot)
This repo includes a Node-based CLI that wraps the Soroban CLI and automates the dependency-ordered deployment.
From the repo root:
npm install
npm run tokenbound -- deploy --network testnet --source deployerDeployment output is written to soroban-contract/deployments/<network>.json by default.
cargo install --locked soroban-clirustup target add wasm32-unknown-unknownCreate environment variables:
export NETWORK=testnet
export SOROBAN_RPC_URL="https://soroban-testnet.stellar.org"
export ADMIN_SECRET_KEY="S..."
export ADMIN_ADDRESS="G..."Fund your account:
curl "https://friendbot.stellar.org?addr=$ADMIN_ADDRESS"From the root directory:
cargo build --target wasm32-unknown-unknown --releaseOptimise contracts:
soroban contract optimize --wasm target/wasm32-unknown-unknown/release/*.wasmDeploy contracts in the following order:
ticket_factoryevent_managertba_registry
Deploy Ticket Factory
soroban contract deploy \
--wasm <path_to_ticket_factory.wasm> \
--source $ADMIN_SECRET_KEY \
--rpc-url $SOROBAN_RPC_URLSave the returned Contract ID:
export TICKET_FACTORY_ID="C..."Deploy Event Manager
soroban contract deploy \
--wasm <path_to_event_manager.wasm> \
--source $ADMIN_SECRET_KEY \
--rpc-url $SOROBAN_RPC_URLexport EVENT_MANAGER_ID="C..."Deploy TBA Registry
soroban contract deploy \
--wasm <path_to_tba_registry.wasm> \
--source $ADMIN_SECRET_KEY \
--rpc-url $SOROBAN_RPC_URLexport TBA_REGISTRY_ID="C..."Initialize each contract with required parameters.
Example:
soroban contract invoke \
--id $TICKET_FACTORY_ID \
--source $ADMIN_SECRET_KEY \
--rpc-url $SOROBAN_RPC_URL \
-- initialize \
--admin $ADMIN_ADDRESSRepeat for other contracts using their respective parameters.
After deployment:
- Confirm contract IDs are returned
- Call a read method:
soroban contract invoke \
--id $TICKET_FACTORY_ID \
--source $ADMIN_SECRET_KEY \
--rpc-url $SOROBAN_RPC_URL \
-- some_view_function- Ensure no errors are returned
- Check events on Soroban explorer
Contract fails to deploy
- Ensure account has enough XLM
- Check RPC URL
WASM not found
- Ensure build step completed successfully
Initialization fails
- Ensure correct parameters are passed
- Check contract already initialized
CLI errors
soroban --version- Always deploy in the correct order
- Store contract IDs securely
- Never expose secret keys in code