Troubleshooting Guide

Common issues and solutions for Prophyt protocol.

Smart Contract Issues

Transaction Fails with "Market Not Found"

Problem: Attempting to interact with a market that doesn't exist.

Solution:

  • Verify the market ID is correct
  • Check that the market was created successfully
  • Ensure you're using the correct package ID
TYPESCRIPT
// Verify market exists const market = await getMarketDetails(marketId); if (!market.data) { throw new Error('Market not found'); }

Transaction Fails with "Market Ended"

Problem: Trying to place a bet on a market that has already ended.

Solution:

  • Check market end time before placing bets
  • Verify current time is before market end time
TYPESCRIPT
const market = await getMarketDetails(marketId); const endTime = new Date(market.data.endDate).getTime(); if (Date.now() >= endTime) { throw new Error('Market has already ended'); }

Transaction Fails with "Insufficient Balance"

Problem: Not enough SUI tokens for the transaction.

Solution:

  • Check wallet balance
  • Ensure sufficient gas for transaction
  • Account for transaction fees
TYPESCRIPT
const balance = await client.getBalance({ owner: signer.getAddress(), }); if (balance.totalBalance < amount + gasBudget) { throw new Error('Insufficient balance'); }

Signature Verification Fails

Problem: Nautilus signature verification fails on-chain.

Solution:

  • Verify serialization format matches contract exactly
  • Check signature and public key are correct
  • Ensure resolution timestamp is not too old (max 1 hour)
  • Verify enclave is registered on-chain

Indexer Issues

Events Not Processing

Problem: Indexer is not processing blockchain events.

Diagnosis:

BASH
# Check indexer logs tail -f indexer.log # Check database cursor state psql $DATABASE_URL -c "SELECT * FROM \"Cursor\";"

Solutions:

  1. Invalid Cursor: Reset cursor if transaction not found

    BASH
    # The indexer should auto-reset, but you can manually reset: psql $DATABASE_URL -c "DELETE FROM \"Cursor\" WHERE id = 'event_type';"
  2. Network Connection: Verify Sui network connection

    BASH
    # Test connection curl https://fullnode.mainnet.sui.io:443
  3. Package ID Mismatch: Verify correct package ID in config

    BASH
    # Check config echo $PROPHYT_PACKAGE_ID

API Not Responding

Problem: REST API endpoints not responding.

Diagnosis:

BASH
# Check if server is running curl http://localhost:8000/ # Check server logs tail -f server.log

Solutions:

  1. Port Already in Use: Change port or kill existing process

    BASH
    # Find process using port 8000 lsof -i :8000 # Kill process or change PORT in .env
  2. Database Connection: Verify database is accessible

    BASH
    psql $DATABASE_URL -c "SELECT 1;"
  3. Missing Environment Variables: Check all required vars are set

    BASH
    # Verify env vars env | grep -E "DATABASE_URL|NETWORK|PROPHYT_PACKAGE_ID"

Database Connection Errors

Problem: Cannot connect to PostgreSQL database.

Solutions:

  1. Check Database Status

    BASH
    # Using Docker Compose docker-compose ps # Check database logs docker-compose logs db
  2. Verify Connection String

    BASH
    # Test connection psql $DATABASE_URL -c "SELECT version();"
  3. Check Network Access

    • Ensure database is accessible from indexer
    • Check firewall rules
    • Verify credentials

Image Generation Fails

Problem: NFT image generation fails.

Solutions:

  1. Canvas Dependencies: Ensure canvas is installed

    BASH
    # Install canvas dependencies # On Ubuntu/Debian: sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
  2. Font Files: Verify font files exist

    BASH
    ls -la indexer/fonts/
  3. Walrus Upload: Check Walrus configuration

    BASH
    # Test Walrus CLI walrus --version # Or verify HTTP API curl $WALRUS_PUBLISHER_URL/health

Nautilus Server Issues

Server Not Responding

Problem: Nautilus server health check fails.

Diagnosis:

BASH
# Check server health curl http://localhost:8080/health # Check server logs tail -f nautilus-server.log

Solutions:

  1. Port Conflict: Change port or kill existing process
  2. Database Connection: Verify database connection
  3. Missing Keys: Check if signing keys are initialized

Resolution Request Fails

Problem: Market resolution request fails.

Solutions:

  1. Market Not Ended: Verify market end time

    TYPESCRIPT
    const endTime = new Date(market.endDate).getTime(); if (Date.now() < endTime) { throw new Error('Market has not ended yet'); }
  2. External API Failure: Check data source URL

    BASH
    # Test external API curl $DATA_SOURCE_URL
  3. Signature Generation: Check enclave keys

    BASH
    # Verify keys in database psql $DATABASE_URL -c "SELECT * FROM nautilus_keys;"

Signature Verification Fails

Problem: On-chain signature verification fails.

Solutions:

  1. Serialization Mismatch: Ensure serialization matches contract
  2. Timestamp Too Old: Verify resolution timestamp is recent
  3. Enclave Not Registered: Register enclave on-chain
  4. Public Key Mismatch: Verify public key matches registered enclave

Frontend Issues

Wallet Connection Fails

Problem: Cannot connect Sui wallet.

Solutions:

  1. Wallet Extension: Ensure wallet extension is installed
  2. Network Mismatch: Verify wallet is on correct network
  3. Permissions: Check wallet permissions

API Calls Fail

Problem: Frontend cannot reach indexer API.

Solutions:

  1. CORS Issues: Verify CORS is enabled on indexer

    TYPESCRIPT
    // In server.ts app.use(cors());
  2. API URL: Check API URL is correct

    TYPESCRIPT
    const API_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000';
  3. Network Access: Verify network connectivity

Transaction Stuck

Problem: Transaction submitted but not confirmed.

Solutions:

  1. Check Transaction Status

    TYPESCRIPT
    const tx = await client.getTransactionBlock({ digest: transactionDigest, options: { showEffects: true }, });
  2. Retry Transaction: If failed, retry with higher gas

  3. Network Congestion: Wait for network to process

Performance Issues

Slow Event Processing

Problem: Indexer is slow to process events.

Solutions:

  1. Increase Polling Interval: Adjust in config

    TYPESCRIPT
    POLLING_INTERVAL_MS: 1000 // Increase if needed
  2. Database Optimization: Add indexes

    SQL
    CREATE INDEX idx_market_status ON "Market"(status); CREATE INDEX idx_bet_user ON "Bet"("userId");
  3. Connection Pooling: Optimize database connections

High API Latency

Problem: API responses are slow.

Solutions:

  1. Database Queries: Optimize slow queries
  2. Caching: Implement caching for frequently accessed data
  3. Load Balancing: Use multiple API instances

Common Error Messages

"Market Not Found"

  • Verify market ID is correct
  • Check market exists in database
  • Ensure package ID matches

"Market Already Resolved"

  • Market can only be resolved once
  • Check market resolution status

"Bet Already Claimed"

  • Each bet can only be claimed once
  • Verify bet claim status

"Insufficient Balance"

  • Check wallet balance
  • Account for transaction fees
  • Verify gas budget

"Invalid Signature"

  • Verify Nautilus signature format
  • Check serialization matches contract
  • Ensure timestamp is recent

Getting Help

If you're still experiencing issues:

  1. Check Logs: Review all component logs
  2. Verify Configuration: Ensure all env vars are correct
  3. Test Components: Test each component independently
  4. Community Support:

Debug Mode

Enable debug logging:

BASH
# Indexer DEBUG=true pnpm dev # Nautilus RUST_LOG=debug cargo run

Health Checks

Regular health check script:

BASH
#!/bin/bash # health-check.sh echo "Checking Indexer..." curl -f http://localhost:8000/ || echo "Indexer DOWN" echo "Checking Nautilus..." curl -f http://localhost:8080/health || echo "Nautilus DOWN" echo "Checking Database..." psql $DATABASE_URL -c "SELECT 1;" || echo "Database DOWN"
Previous
Nautilus Guide