This guide explains how to set up a local end-to-end testing environment for Sorokeep. You will run a local Stellar network, deploy a test contract, and monitor it with Sorokeep — all without touching public testnet or mainnet.
- Node.js 22+
- Docker (for running a local Stellar network)
The Stellar Quickstart Docker image provides a full Soroban-enabled test network in a single container.
docker run --rm -it \
-p 8000:8000 \
--name soroban-local \
stellar/quickstart:soroban-dev@sha256:9f5c75ce2e920a9b9a6e7e8d0b3a2c8f6e9b7c5d4a3b2c1d0e9f8a7b6c5d4e3f \
--local \
--enable-soroban-rpcThe Soroban RPC will be available at http://localhost:8000/soroban/rpc.
Install the Stellar CLI:
# Install the Stellar CLI
cargo install --locked stellar-cli
# Or use the Docker image
alias stellar="docker run --rm -it --network host stellar/stellar-cli"Create a keypair:
stellar keys generate sorokeep-test --fundThis generates a keypair and funds it from the local network's friendbot.
# Build the hello-world example contract
git clone https://github.com/stellar/soroban-examples.git
cd soroban-examples/hello_world
stellar contract build
# Deploy to the local network
WASM_FILE="target/wasm32-unknown-unknown/release/soroban_hello_world_contract.wasm"
stellar contract deploy \
--wasm $WASM_FILE \
--source sorokeep-test \
--network localSave the deployed contract ID — you'll use it with Sorokeep.
# Point Sorokeep at your local network
npx tsx src/index.ts watch <CONTRACT_ID> \
--rpc-url http://localhost:8000/soroban/rpc \
--name "Hello World (Local)"npx tsx src/index.ts daemon \
--rpc-url http://localhost:8000/soroban/rpc \
--interval 10000The daemon polls every 10 seconds and reports TTL health for your local contract.
To simulate TTL changes, you can advance the local network ledger:
stellar lab close-ledgerThis closes the current ledger and advances to the next one, decrementing TTLs. Run it several times to watch the monitoring pick up the changes.
If Docker is not available, you can use Stellar's public testnet.
Use the Stellar Laboratory Friendbot or the Stellar CLI:
stellar keys generate sorokeep-test --fund --network testnetSorokeep can monitor any contract already deployed on testnet. Use a known contract:
# XLM Native Token on testnet
npx tsx src/index.ts watch CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC \
--network testnet \
--name "XLM Native Token (Testnet)"Or deploy your own:
# Deploy from soroban-examples
stellar contract deploy \
--wasm target/wasm32-unknown-unknown/release/soroban_hello_world_contract.wasm \
--source sorokeep-test \
--network testnetnpx tsx src/index.ts daemon --network testnetFor CI or repeatable testing, use the following script:
#!/usr/bin/env bash
# scripts/e2e-local.sh
set -euo pipefail
echo "=== Starting local Stellar network ==="
docker run --rm -d \
-p 8000:8000 \
--name soroban-local \
stellar/quickstart:soroban-dev@sha256:9f5c75ce2e920a9b9a6e9b7c5d4a3b2c1d0e9f8a7b6c5d4e3f \
--local \
--enable-soroban-rpc
# Wait for the RPC to be ready
echo "=== Waiting for RPC... ==="
for i in $(seq 1 30); do
if curl -s http://localhost:8000/soroban/rpc -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1,"method":"getHealth"}' > /dev/null 2>&1; then
echo "RPC ready"
break
fi
sleep 1
done
echo "=== Creating test account ==="
stellar keys generate e2e-test --fund --network local
echo "=== Deploying test contract ==="
# (clone and build soroban-examples if not present)
CONTRACT_ID=$(stellar contract deploy \
--wasm /path/to/hello_world.wasm \
--source e2e-test \
--network local)
echo "Contract ID: $CONTRACT_ID"
echo "=== Running Sorokeep watch ==="
npx tsx src/index.ts watch "$CONTRACT_ID" \
--rpc-url http://localhost:8000/soroban/rpc \
--name "E2E Test Contract"
echo "=== Running Sorokeep status ==="
npx tsx src/index.ts status "$CONTRACT_ID"
echo "=== Running daemon (3 cycles) ==="
timeout 35 npx tsx src/index.ts daemon \
--rpc-url http://localhost:8000/soroban/rpc \
--interval 10000 || true
echo "=== Cleaning up ==="
docker stop soroban-local
echo "=== E2E test complete ==="| Problem | Solution |
|---|---|
| Docker container exits immediately | Ensure you're using the soroban-dev tag and have enabled --enable-soroban-rpc |
| RPC connection refused | The container takes 5-10 seconds to start. Wait and retry. |
stellar keys generate --fund fails on local |
The local friendbot runs on port 8000. Ensure the container is healthy. |
| Contract deploy fails | Build the WASM file first with stellar contract build |
| Sorokeep timeout | Increase --interval (e.g. 300000 for 5 minutes) or check RPC URL |
| Duplicate contract ID | Each deploy generates a unique contract ID. Save the output from stellar contract deploy. |
After completing the sandbox setup, verify the following:
-
sorokeep status <contract-id>shows entries with TTL values -
sorokeep guard <contract-id> --dry-runestimates fee without submitting -
sorokeep alerts add --type webhook ...creates an alert config - Running
sorokeep daemonfor several cycles does not crash - After advancing the ledger,
statusreflects updated TTLs