Skip to content

Connect SorobanService to live testnet and invoke GistRegistry contract #603

@BigBen-7

Description

@BigBen-7

Description

The current SorobanService runs in mock mode and never makes a real Stellar network call. This issue wires it up to the live Soroban testnet RPC and invokes the deployed GistRegistry contract's post_gist and get_gist methods for real.

Context

  • Contract method: post_gist(author, location_cell, content_hash) — returns gist_id (u64)
  • Contract method: get_gist(gist_id) — returns gist record
  • The mock currently returns fake tx hashes and fake gist IDs
  • Real integration requires the Stellar JS SDK (@stellar/stellar-sdk)

Requirements

  • Install @stellar/stellar-sdk if not already present
  • Replace mock logic in SorobanService with real Soroban RPC calls
  • Use SorobanRpc.Server to connect to the testnet RPC URL from env
  • Build and sign the post_gist transaction using the contract's XDR interface
  • Submit transaction and parse the returned gist_id from the result
  • Implement get_gist to fetch a gist record by ID from the contract
  • Fall back to mock mode when CONTRACT_ID_GIST_REGISTRY env var is not set (preserve dev experience)

Files to Touch

  • Backend/src/soroban/soroban.service.ts — replace mock with real SDK calls
  • Backend/src/soroban/soroban.module.ts — ensure ConfigService is injected
  • Backend/src/config/configuration.ts — confirm SOROBAN_RPC_URL and CONTRACT_ID_GIST_REGISTRY are typed
  • Backend/.env.example — add SOROBAN_RPC_URL=https://soroban-testnet.stellar.org and CONTRACT_ID_GIST_REGISTRY=

Environment Variables Required

SOROBAN_RPC_URL=https://soroban-testnet.stellar.org
CONTRACT_ID_GIST_REGISTRY=<deployed contract id>
STELLAR_NETWORK_PASSPHRASE=Test SDF Network ; September 2015

Acceptance Criteria

  • SorobanService.postGist() submits a real transaction to Soroban testnet
  • Returns a real transaction hash and on-chain gist_id
  • SorobanService.getGist() fetches a real gist record from the contract
  • App still starts and works in mock mode when CONTRACT_ID_GIST_REGISTRY is empty
  • Unit tests updated to mock the Stellar SDK

Complexity: 350 points

Metadata

Metadata

Assignees

No one assigned

    Labels

    BackendBackend issues

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions