Skip to content

[Soroban] Deploy Registry and SpendingPolicy contracts to Stellar Testnet #3

Description

@IyanuOluwaJesuloba

Title: [Soroban] Deploy Registry and SpendingPolicy contracts to Stellar Testnet

Summary

Both Soroban contracts (registry.rs and policy.rs) have been written but have never been deployed to Stellar Testnet. The contract IDs in the SDK are currently placeholder strings. This issue covers building the WASM binaries, deploying both contracts to testnet, and updating the SDK with the real contract IDs.

Current State

In sdk/src/stellar.ts lines 28–35, the testnet contract IDs are placeholders:

ts

const CONTRACT_IDS: Record<Network, { registry: string; policy: string }> = {
  testnet: {
    registry: 'CDNIWZNIUOQ7V6RKIFRWXCNQ7C5SQPQLF5B6WHMQF4DXNPVWXRMWVQ', // placeholder
    policy:   'CDRPZX4UL2WMULWXD7DPHSIFYPVZKCHJWZGP2BPEDPUAJFV5PMXNGGQ', // placeholder
  },
  ...
}

These need to be replaced with real deployed contract addresses.

Prerequisites

Before starting, install these tools:

bash

# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Add WASM target
rustup target add wasm32-unknown-unknown

# Install Stellar CLI
cargo install --locked stellar-cli

# Verify
stellar --version

Step-by-Step Deployment Guide

Step 1 — Build the WASM binaries

bash

cd contracts
cargo build --target wasm32-unknown-unknown --release

This produces:

target/wasm32-unknown-unknown/release/stellarmind_contracts.wasm

Step 2 — Generate a testnet deployer keypair

bash

stellar keys generate --global stellarmind-deployer --network testnet
stellar keys address stellarmind-deployer
# Copy the address shown

Step 3 — Fund the deployer account via Friendbot

https://friendbot.stellar.org?addr=YOUR_DEPLOYER_ADDRESS
Verify it worked:

bash

stellar account info --account stellarmind-deployer --network testnet

Step 4 — Deploy the Registry contract

bash

stellar contract deploy \
  --wasm target/wasm32-unknown-unknown/release/stellarmind_contracts.wasm \
  --source stellarmind-deployer \
  --network testnet

Copy the contract ID that is printed (starts with C...). This is your Registry contract ID.

Step 5 — Deploy the Policy contract The same WASM contains both contracts. Deploy a second instance:

bash

stellar contract deploy \
  --wasm target/wasm32-unknown-unknown/release/stellarmind_contracts.wasm \
  --source stellarmind-deployer \
  --network testnet

Copy this second contract ID. This is your Policy contract ID.

Step 6 — Update the SDK

Open sdk/src/stellar.ts and replace the placeholder testnet contract IDs:

ts

testnet: {
  registry: 'YOUR_REAL_REGISTRY_CONTRACT_ID',
  policy:   'YOUR_REAL_POLICY_CONTRACT_ID',
},

Step 7 — Verify the deployment

Test that the deployed contract is reachable:

bash

stellar contract invoke \
  --id YOUR_REGISTRY_CONTRACT_ID \
  --source stellarmind-deployer \
  --network testnet \
  -- agent_count
# Should return: 0

Acceptance Criteria

Both contracts successfully deployed to Stellar Testnet

sdk/src/stellar.ts updated with real contract IDs (not placeholders)

stellar contract invoke ... agent_count returns 0 (not an error)

stellar contract invoke ... policy_count returns 0 (not an error)

Deployment transaction hashes documented in a comment in sdk/src/stellar.ts

A docs/DEPLOYMENT.md file created with:

  • The deployer public key (not private key)

  • Both contract IDs

  • Deployment transaction hashes

  • Date of deployment

  • Steps to re-deploy if needed

Important

Never commit your private key. Only commit the public deployer address and contract IDs

If deployment fails with "insufficient funds", re-run the Friendbot step

Testnet resets occasionally — if the contract stops responding, re-deploy and update the IDs again

Estimated Effort

Small (1–3 hours)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions