This guide explains how to spin up a local mock Stellar network using the Stellar Quickstart Docker container, configure your local development tools, fund local test accounts, and deploy the RemitMortgage contracts offline.
Before starting, make sure you have the following installed:
- Docker and Docker Compose
- Stellar CLI (v20+ recommended) or Soroban CLI
- Rust toolchain (with target
wasm32-unknown-unknown) curl(for interacting with local APIs)
We run the official stellar/quickstart image in standalone (local) sandbox mode. This spins up Stellar Core, Horizon, a Soroban RPC server, and an instance of Friendbot locally.
Start the sandbox using Docker Compose from the root directory:
docker compose up -dVerify that the container is running and healthy:
docker compose psAll services are multiplexed and exposed through port 8000:
| Service | Protocol / URL | Description |
|---|---|---|
| Horizon API | http://localhost:8000/ |
Queries ledgers, transactions, and account details |
| Soroban RPC | http://localhost:8000/soroban/rpc |
Standard JSON-RPC endpoint for contract interactions |
| Friendbot API | http://localhost:8000/friendbot |
Faucet service to fund local accounts |
To deploy and invoke contracts locally, you need to register the local network in your Stellar CLI configuration and generate a deployer identity.
Add the local network parameters to your CLI config:
stellar network add \
--rpc-url "http://localhost:8000/soroban/rpc" \
--network-passphrase "Standalone Network ; Introduction to Horizon" \
local(If you are using the older soroban CLI, replace stellar with soroban in all commands)
Generate a local keypair named alice to deploy the contracts:
stellar keys generate --network local aliceTo view the public key of the generated identity:
stellar keys address aliceFund your newly created local identity using the local Friendbot endpoint:
curl "http://localhost:8000/friendbot?addr=$(stellar keys address alice)"Confirm that the account is active and has a balance of 10,000 native test tokens (XLM):
stellar keys balance alice --network localFrom the repository root, compile all smart contracts to WebAssembly:
cd contracts
cargo build --target wasm32-unknown-unknown --releaseThis compiles your contracts and stores the .wasm files under:
contracts/target/wasm32-unknown-unknown/release/
Use your funded local identity to deploy the escrow and lending pool contracts to the local sandbox:
# Deploy Escrow Contract
stellar contract deploy \
--wasm target/wasm32-unknown-unknown/release/escrow.wasm \
--source alice \
--network local
# Deploy Lending Pool Contract
stellar contract deploy \
--wasm target/wasm32-unknown-unknown/release/lending_pool.wasm \
--source alice \
--network localNote
Save the contract IDs (e.g. C...) returned by these commands. You will need to input them in your frontend and backend configuration.
Invoke the initialize function on the deployed contracts. For example, to initialize the escrow contract:
stellar contract invoke \
--id <DEPLOYED_ESCROW_CONTRACT_ID> \
--source alice \
--network local \
--fn initialize \
-- \
--admin $(stellar keys address alice) \
--token <USDC_TOKEN_CONTRACT_ID> \
--target_amount 10000000000 \
--max_duration_ledgers 518400 \
--tier1_penalty 500 \
--tier2_penalty 300 \
--tier3_penalty 150 \
--tier4_penalty 50To connect the frontend application and backend orchestration services to the local sandbox, update the environment files:
STELLAR_RPC_URL=http://localhost:8000/soroban/rpc
STELLAR_HORIZON_URL=http://localhost:8000
STELLAR_NETWORK_PASSPHRASE="Standalone Network ; Introduction to Horizon"
ESCROW_CONTRACT_ID="<DEPLOYED_ESCROW_CONTRACT_ID>"
USDC_TOKEN_ID="<DEPLOYED_USDC_TOKEN_ID>"NEXT_PUBLIC_HORIZON_URL=http://localhost:8000
NEXT_PUBLIC_NETWORK_PASSPHRASE="Standalone Network ; Introduction to Horizon"
NEXT_PUBLIC_ESCROW_CONTRACT_ID="<DEPLOYED_ESCROW_CONTRACT_ID>"
NEXT_PUBLIC_USDC_TOKEN_ID="<DEPLOYED_USDC_TOKEN_ID>"When you are done testing offline, you can stop the sandbox and remove the associated container data volumes:
docker compose down -v