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
TYPESCRIPTconst 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
TYPESCRIPTconst 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:
-
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';" -
Network Connection: Verify Sui network connection
BASH# Test connection curl https://fullnode.mainnet.sui.io:443 -
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:
-
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 -
Database Connection: Verify database is accessible
BASHpsql $DATABASE_URL -c "SELECT 1;" -
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:
-
Check Database Status
BASH# Using Docker Compose docker-compose ps # Check database logs docker-compose logs db -
Verify Connection String
BASH# Test connection psql $DATABASE_URL -c "SELECT version();" -
Check Network Access
- Ensure database is accessible from indexer
- Check firewall rules
- Verify credentials
Image Generation Fails
Problem: NFT image generation fails.
Solutions:
-
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 -
Font Files: Verify font files exist
BASHls -la indexer/fonts/ -
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:
- Port Conflict: Change port or kill existing process
- Database Connection: Verify database connection
- Missing Keys: Check if signing keys are initialized
Resolution Request Fails
Problem: Market resolution request fails.
Solutions:
-
Market Not Ended: Verify market end time
TYPESCRIPTconst endTime = new Date(market.endDate).getTime(); if (Date.now() < endTime) { throw new Error('Market has not ended yet'); } -
External API Failure: Check data source URL
BASH# Test external API curl $DATA_SOURCE_URL -
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:
- Serialization Mismatch: Ensure serialization matches contract
- Timestamp Too Old: Verify resolution timestamp is recent
- Enclave Not Registered: Register enclave on-chain
- Public Key Mismatch: Verify public key matches registered enclave
Frontend Issues
Wallet Connection Fails
Problem: Cannot connect Sui wallet.
Solutions:
- Wallet Extension: Ensure wallet extension is installed
- Network Mismatch: Verify wallet is on correct network
- Permissions: Check wallet permissions
API Calls Fail
Problem: Frontend cannot reach indexer API.
Solutions:
-
CORS Issues: Verify CORS is enabled on indexer
TYPESCRIPT// In server.ts app.use(cors()); -
API URL: Check API URL is correct
TYPESCRIPTconst API_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000'; -
Network Access: Verify network connectivity
Transaction Stuck
Problem: Transaction submitted but not confirmed.
Solutions:
-
Check Transaction Status
TYPESCRIPTconst tx = await client.getTransactionBlock({ digest: transactionDigest, options: { showEffects: true }, }); -
Retry Transaction: If failed, retry with higher gas
-
Network Congestion: Wait for network to process
Performance Issues
Slow Event Processing
Problem: Indexer is slow to process events.
Solutions:
-
Increase Polling Interval: Adjust in config
TYPESCRIPTPOLLING_INTERVAL_MS: 1000 // Increase if needed -
Database Optimization: Add indexes
SQLCREATE INDEX idx_market_status ON "Market"(status); CREATE INDEX idx_bet_user ON "Bet"("userId"); -
Connection Pooling: Optimize database connections
High API Latency
Problem: API responses are slow.
Solutions:
- Database Queries: Optimize slow queries
- Caching: Implement caching for frequently accessed data
- 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:
- Check Logs: Review all component logs
- Verify Configuration: Ensure all env vars are correct
- Test Components: Test each component independently
- Community Support:
- GitHub Issues
- X - Latest updates
- Documentation
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"
