Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Thank you for your interest in contributing to **Stellar Goal Vault**!

- Read the [README.md](./README.md) for project overview and architecture.
- Check the [FAQ.md](./FAQ.md) for answers to common questions.
- See the [Troubleshooting Guide](./docs/TROUBLESHOOTING.md) for solutions to common development issues.
- Browse `OPEN_SOURCE_ISSUES.md` for curated contribution ideas.

## Backend Development
Expand Down Expand Up @@ -104,6 +105,8 @@ Thank you for your interest in contributing to **Stellar Goal Vault**!

### Troubleshooting

See the [Troubleshooting Guide](./docs/TROUBLESHOOTING.md) for a comprehensive list of common issues.

#### "SQLITE_CANTOPEN" or database file not found
- Ensure the directory specified in `DB_PATH` exists
- Check file permissions on the database directory
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,10 @@ That issue is already represented in:

See the [FAQ.md](./FAQ.md) for answers to common questions about testnet funding, Freighter setup, contract deployment, database reset, pledge failures, and more.

## Troubleshooting

See the [Troubleshooting Guide](./docs/TROUBLESHOOTING.md) for solutions to common issues like SQLite permissions, Soroban CLI mismatches, and CORS errors.

## Security

Please see [SECURITY.md](./SECURITY.md) for our responsible disclosure policy, supported versions, and reporting instructions.
Expand Down
87 changes: 87 additions & 0 deletions docs/TROUBLESHOOTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Troubleshooting Guide

This guide covers common issues encountered while developing, building, or running the application.

## 1. SQLite File Permission Errors
**Symptom**: `Error: SQLITE_CANTOPEN: unable to open database file` when starting the backend.
**Cause**: The process running the backend does not have write permissions to the directory where the SQLite database file is stored or to the file itself.
**Fix**: Grant appropriate read/write permissions to the database file and its parent directory.
```bash
chmod 755 backend/data
chmod 644 backend/data/campaigns.db
```
Comment on lines +5 to +12

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Make the SQLite permission fix account for the actual backend user.

chmod 755/chmod 644 only grants write access to the owner. If the backend runs as another user, SQLite still cannot create journal or WAL files. Document the required service-user ownership or provide a safe chown/directory-creation example instead of implying these commands always resolve the error.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/TROUBLESHOOTING.md` around lines 5 - 12, Update the SQLite File
Permission Errors Fix guidance to account for the actual backend service user:
document identifying that user, ensuring the database directory exists, and
setting appropriate ownership with a safe chown example before applying
permissions. Avoid implying chmod 755/644 alone always resolves SQLite journal
or WAL write failures.


## 2. Soroban CLI Version Mismatch
**Symptom**: `error: Found argument '--network' which wasn't expected` or unexpected CLI behavior when deploying contracts.
**Cause**: You have an outdated or newer version of the Soroban CLI installed globally that is incompatible with the project's contract scripts.
**Fix**: Install the specific version of Soroban CLI required by the project using cargo.
```bash
cargo install --locked --version 20.0.0 soroban-cli
```
Comment on lines +14 to +20

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

rg -n 'soroban-cli|stellar-cli|soroban |stellar ' --glob '!node_modules/**' .

Repository: ritik4ever/stellar-goal-vault

Length of output: 3576


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== docs/TROUBLESHOOTING.md lines 1-60 =="
cat -n docs/TROUBLESHOOTING.md | sed -n '1,60p'

echo
echo "== scripts/deploy.sh CLI checks/invocations =="
cat -n scripts/deploy.sh | sed -n '30,90p'

echo
echo "== README stellar invocations =="
cat -n README.md | sed -n '60,170p'

echo
echo "== package/tooling references =="
for f in package.json Cargo.toml Cargo.lock justfile README.md; do
  [ -f "$f" ] && { echo "--- $f"; sed -n '1,140p' "$f"; }
done

Repository: ritik4ever/stellar-goal-vault

Length of output: 17565


🌐 Web query:

Stellar CLI soroban-cli 20.0.0 install cargo install --locked version 20.0.0 soroban-cli command name

💡 Result:

To install the CLI tool for Stellar and Soroban development, the current standard command is cargo install --locked stellar-cli [1][2][3]. The crate formerly known as soroban-cli has been renamed to stellar-cli [1][3]. While you may see references to installing soroban-cli in older documentation or specific legacy versions (such as v20.x), the official and current package name used for installation is stellar-cli [1][4][3]. Regarding your specific query: 1. Command Name: Once installed, the command used to interact with the tool is stellar [5][6]. Older versions of the tool were sometimes referred to or invoked as soroban, but modern versions use the stellar command [1][5][6]. 2. Installation for version 20.0.0: If you specifically require version 20.0.0 for legacy compatibility, you would typically use cargo install --locked stellar-cli --version 20.0.0. However, it is strongly recommended to use the latest version available on crates.io to ensure compatibility with current network protocols [4]. In summary, use stellar-cli as the package name for cargo install and stellar as the command line interface [2][3][6].

Citations:


🌐 Web query:

Stellar CLI 27.0 stellar network add global option network passphrase

💡 Result:

In the Stellar CLI, --network-passphrase is a standard option used to specify the network passphrase required for signing transactions [1][2][3]. It is categorized as an RPC-related option that is available for many commands that interact with the network [3]. Key details regarding this option include: Precedence and Behavior: 1. Named Network Priority: When you use the --network flag, the Stellar CLI resolves the network configuration from your on-disk settings [1][4]. Recent updates have established that a named network takes precedence over any --network-passphrase or --rpc-url provided via flags or environment variables [4]. 2. Overrides: If you do not use a named network, you can manually provide the --network-passphrase. For specific diagnostic commands, such as stellar network root-account, the --network-passphrase flag can be used to override other configured settings to derive root account keys [5]. 3. Configuration: While you can provide the passphrase as a flag, the recommended practice for general use is to configure named networks using the stellar network add command, which stores the network passphrase and RPC URL associated with an alias [3]. Usage: To use the option, append it to your command: stellar --network-passphrase "YOUR_PASSPHRASE" Note: Ensure you are using the correct passphrase for the intended network (e.g., the public network or a test network), as using an incorrect one will cause transaction authentication errors [6]. If you have a named network configured, you generally do not need to manually enter the passphrase [7][3].

Citations:


Align the Soroban/stellar CLI instructions.

docs/TROUBLESHOOTING.md installs the legacy soroban-cli 20.x package but then shows stellar network add; the crate is installed as stellar-cli and stellar invocations expect named-network setup before --network. Update this section to install stellar-cli 20.0.0 and document the stellar network setup that matches the deployment/invocation commands in scripts/deploy.sh and README.md, or align the repo to use one CLI interface consistently.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/TROUBLESHOOTING.md` around lines 14 - 20, Update the “Soroban CLI
Version Mismatch” section in TROUBLESHOOTING.md to install stellar-cli version
20.0.0 instead of the legacy soroban-cli package, and document the required
named-network setup before using --network. Keep the instructions consistent
with the stellar commands used by scripts/deploy.sh and README.md.


## 3. Freighter Connection Issues
**Symptom**: "Freighter is not installed" or "Connection rejected" in the web application.
**Cause**: The Freighter browser extension is not installed, the user denied the connection request, or the extension is locked.
**Fix**: Reset the local network configuration via CLI to ensure proper testnet connections if local accounts are used.
```bash
stellar network add --global testnet --rpc-url https://soroban-testnet.stellar.org:443
```
Comment on lines +22 to +28

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== docs/TROUBLESHOOTING.md lines =="
if [ -f docs/TROUBLESHOOTING.md ]; then
  nl -ba docs/TROUBLESHOOTING.md | sed -n '1,80p'
else
  echo "docs/TROUBLESHOOTING.md not found"
fi

echo
echo "== Find Freighter/network troubleshooting references =="
rg -n -i "Freighter|Connection rejected|not installed|connection request|locked|stellar network add|soroban-testnet.stellar.org|testnet" -S . --glob '!node_modules/**' --glob '!target/**' --glob '!dist/**' | head -200

Repository: ritik4ever/stellar-goal-vault

Length of output: 243


🏁 Script executed:

#!/bin/sh
set -euo pipefail

echo "== docs/TROUBLESHOOTING.md lines =="
if [ -f docs/TROUBLESHOOTING.md ]; then
  cat -n docs/TROUBLESHOOTING.md | sed -n '1,80p'
else
  echo "docs/TROUBLESHOOTING.md not found"
fi

echo
echo "== Find Freighter/network troubleshooting references =="
grep -RIn -E "Freighter|Connection rejected|not installed|connection request|locked|stellar network add|soroban-testnet.stellar.org|testnet" . --exclude-dir=node_modules --exclude-dir=target --exclude-dir=dist | head -200 || true

Repository: ritik4ever/stellar-goal-vault

Length of output: 50386


🏁 Script executed:

#!/bin/sh
set -euo pipefail

echo "== docs/TROUBLESHOOTING.md lines 1-80 =="
awk '1==NR && NR<=80' docs/TROUBLESHOOTING.md | cat -n

echo
echo "== Target references in tracked/source files only =="
git ls-files | grep -E '(^docs/TROUBLESHOOTING\.md$|^docs/|^\.github/|src/|package.json|README\.md)' | while read -r f; do
  grep -RInEi "Freighter|connection rejected|not installed|connection request|locked|stellar network add|soroban-testnet.stellar.org|testnet" "$f" 2>/dev/null || true
done | head -200

Repository: ritik4ever/stellar-goal-vault

Length of output: 12199


Make the Freighter troubleshooting steps match the listed causes.

The listed causes include Freighter not being installed, connection requests being denied, or the extension being locked, but the fix only changes CLI network configuration. Reorder to cover browser-extension setup first (or add extension troubleshooting), and keep the stellar network add command only for actual local network/config mismatches.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/TROUBLESHOOTING.md` around lines 22 - 28, Update the “Freighter
Connection Issues” troubleshooting section so its fix steps address the listed
browser-extension causes first: installation, connection approval, and unlocking
Freighter. Keep the existing stellar network add command only as a separate step
for local network or configuration mismatches.


## 4. CORS Errors
**Symptom**: `Access to fetch at 'http://localhost:8000/api/...' from origin 'http://localhost:3000' has been blocked by CORS policy.`
**Cause**: The backend server is not configured to allow cross-origin requests from the frontend development server.
**Fix**: Update your backend environment variables to allow the frontend origin, or restart the backend with CORS enabled.
```bash
export CORS_ALLOWED_ORIGINS="http://localhost:3000"
npm run dev --prefix backend
```
Comment on lines +30 to +37

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Use the project’s actual frontend and backend ports in the CORS example.

This hard-codes localhost:3000, while README.md documents a backend default of 3001 and CONTRIBUTING.md documents 3000. The example may therefore allow the backend’s own origin instead of the frontend origin. Use the configured frontend origin and explicitly distinguish it from the backend port.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/TROUBLESHOOTING.md` around lines 30 - 37, Update the CORS example in the
“CORS Errors” section to use the project’s configured frontend origin and
explicitly distinguish it from the backend’s documented port, rather than
hard-coding localhost:3000 as the allowed origin. Keep the backend startup
command aligned with the documented backend configuration.


## 5. Contract ID Not Set
**Symptom**: `Error: Contract ID not configured` when attempting to invoke a contract function from the frontend.
**Cause**: The compiled contract ID is missing from the environment configuration files.
**Fix**: Rebuild the contracts and copy the generated contract ID into your backend `.env` file.
```bash
soroban contract deploy --wasm target/wasm32-unknown-unknown/release/contract.wasm --source account > backend/.env.contract
```
Comment on lines +39 to +45

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== docs/TROUBLESHOOTING.md excerpt =="
if [ -f docs/TROUBLESHOOTING.md ]; then
  cat -n docs/TROBLESHOOTING.md | sed -n '1,90p' || true
  echo
  cat -n docs/TROUBLESHOOTING.md | sed -n '1,90p' || true
fi

echo
echo "== README.md deployment/env references =="
if [ -f README.md ]; then
  rg -n -i "CONTRACT_ID|contract deploy|soroban contract deploy|\\.env|backend/.env|environment" README.md -C 3 || true
fi

echo
echo "== backend env files =="
fd -a '^(\.env|.*\.env.*)$' backend . 2>/dev/null | sed 's#^\./##' | head -100
for f in $(fd '^(\.env|.*\.env.*)$' backend . 2>/dev/null | head -20); do
  echo "--- $f"
  sed -n '1,200p' "$f" | head -80 || true
done

echo
echo "== occurrences of generated contract file and CONTRACT_ID =="
rg -n "backend/\.env\.contract|#.*CONTRACT_ID|CONTRACT_ID=|contract deploy|contract-id|contract ID" -S . || true

Repository: ritik4ever/stellar-goal-vault

Length of output: 12170


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== scripts/deploy.sh relevant deployment flow =="
cat -n scripts/deploy.sh | sed -n '1,130p'

echo
echo "== DEPLOYMENT.md contract deployment section =="
cat -n DEPLOYMENT.md | sed -n '40,70p'

echo
echo "== local deploy output format evidence from scripts =="
python3 - <<'PY'
from pathlib import Path
scripts = [Path("scripts/deploy.sh"), Path("scripts/benchmark.sh")]
for p in scripts:
    if p.exists():
        text = p.read_text()
        if "DEPLOY_OUTPUT=$(soroban contract deploy" in text or "export CONTRACT_ID=$(cat contracts/contract_id.txt)" in text:
            print(f"\n-- {p} --")
            for i,line in enumerate(text.splitlines(), 1):
                if "contract deploy" in line or "DEPLOY_OUTPUT" in line or "grep -oE" in line or "CONTRACT_ID=$" in line or "CONTRACT_ID=" in line:
                    print(f"{i}: {line}")
PY

Repository: ritik4ever/stellar-goal-vault

Length of output: 5998


Document the actual deployment step.

The project’s deployment script saves the contract ID to contracts/contract_id.txt and tells users to set CONTRACT_ID in backend/.env; redirecting soroban contract deploy --source account to backend/.env.contract does not match that flow or populate the backend environment variable.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/TROUBLESHOOTING.md` around lines 39 - 45, Update the “Contract ID Not
Set” Fix section to document the project’s actual deployment flow: use the
deployment script that writes the generated contract ID to
contracts/contract_id.txt, then instruct users to set that value as CONTRACT_ID
in backend/.env. Remove the direct soroban contract deploy redirection to
backend/.env.contract.


## 6. Node Version Mismatch
**Symptom**: `SyntaxError: Unexpected token '?'` or package installation failures during `npm install`.
**Cause**: You are using an unsupported version of Node.js.
**Fix**: Switch to the recommended Node.js version (e.g., v18 or v20) using nvm.
```bash
nvm install 18
nvm use 18
```

## 7. Docker Daemon Not Running
**Symptom**: `Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?`
**Cause**: The Docker background service is not running on your host machine.
**Fix**: Start the Docker service systemd.
```bash
sudo systemctl start docker
sudo systemctl enable docker
```
Comment on lines +56 to +63

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Fix the Docker remediation wording.

Change “Start the Docker service systemd” to “Start the Docker service with systemd.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/TROUBLESHOOTING.md` around lines 56 - 63, Update the Fix wording in the
“Docker Daemon Not Running” section to say “Start the Docker service with
systemd.”


## 8. Environment Variables Not Loaded
**Symptom**: Application starts but immediately crashes with missing configuration errors.
**Cause**: The `.env` file is missing or not being properly sourced in the backend directory.
**Fix**: Copy the example environment file and populate it.
```bash
cp backend/.env.example backend/.env
```

## 9. Network Timeout on Testnet
**Symptom**: `Timeout waiting for transaction confirmation` when interacting with the Stellar Testnet.
**Cause**: Network congestion or the RPC node is temporarily unreachable.
**Fix**: Ping the RPC endpoint to check availability.
```bash
curl -X POST "https://soroban-testnet.stellar.org:443" -d '{"jsonrpc":"2.0","id":1,"method":"getNetwork"}'
```
Comment on lines +73 to +79

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf 'Locate troubleshooting file and reference documentation snippets:\n'
git ls-files | grep -E '(^|/)TROUBLESHOOTING\.md$|README|CONTRIBUTING' || true
if [ -f docs/TROUBLESHOOTING.md ]; then
  sed -n '60,90p' docs/TROUBLESHOOTING.md | cat -n
fi

printf '\nSearch for getNetwork examples and curl diagnostics in repo:\n'
rg -n 'getNetwork|soroban-testnet|Timeout waiting for transaction|rpc|jsonrpc' docs README.md . 2>/dev/null | head -n 80 || true

Repository: ritik4ever/stellar-goal-vault

Length of output: 50388


🌐 Web query:

Stellar Soroban RPC getNetwork example curl Content-Type application/json

💡 Result:

To query the Stellar RPC (formerly Soroban-RPC) for network information using the getNetwork method, use an HTTP POST request with a Content-Type of application/json [1][2][3]. The method does not require any parameters [1][4]. Below is an example curl command. Replace <RPC_URL> with the endpoint of the Stellar RPC node you are accessing (e.g., a public provider or your own instance): curl --request POST \ --url <RPC_URL> \ --header 'Content-Type: application/json' \ --data '{ "jsonrpc": "2.0", "id": 1, "method": "getNetwork", "params": [] }' The Stellar RPC follows the JSON-RPC 2.0 specification [5][6]. The getNetwork method returns general information about the network, including the passphrase, the current protocol version, and an optional friendbot URL [1][2][4]. Top Results: [7][1][2][3][4]

Citations:


🌐 Web query:

developers.stellar.org getNetwork curl example Content-Type application/json Soroban RPC

💡 Result:

To query the getNetwork method on a Stellar RPC server, you must send a POST request with a Content-Type of application/json [1][2]. The request body must be a JSON-RPC 2.0 object specifying the method as getNetwork [1][2]. Below is a standard curl example for the getNetwork method: curl -X POST \ -H 'Content-Type: application/json' \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "getNetwork" }' \ https://soroban-testnet.stellar.org Note that Stellar RPC was formerly known as Soroban-RPC [3]. When using this command, replace the URL (https://soroban-testnet.stellar.org) with the appropriate RPC endpoint you are targeting [3][1]. The getNetwork method does not require any additional parameters [1].

Citations:


Use the documented getNetwork curl request.

The example should include Content-Type: application/json; add that header, and consider using a concise diagnostic curl variant instead of relying solely on this text.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/TROUBLESHOOTING.md` around lines 73 - 79, Update the documented curl
request in the “Network Timeout on Testnet” section to include the Content-Type:
application/json header while preserving the getNetwork request and endpoint;
use a concise diagnostic curl form if appropriate.


## 10. Insufficient Funds in Testnet Account
**Symptom**: `op_underfunded` or `tx_insufficient_balance` when submitting a transaction.
**Cause**: The account signing the transaction does not have enough XLM to cover the network fees and minimum balance requirements.
**Fix**: Fund your account using the Stellar Friendbot.
```bash
curl "https://friendbot.stellar.org/?addr=YOUR_PUBLIC_KEY"
```