Getting Started
Get up and running with GPMIN in minutes. Follow these steps to start building prediction markets.
Prerequisites
- Node.js 18+ and npm
- Rust and Cargo (for smart contracts)
- Solana CLI
- Anchor CLI
- PostgreSQL database
Installation
1. Clone the Repository
git clone <repository-url> cd galaxia-predictions-market-infrastructure2. Install Dependencies
npm run install:all3. Set Up Environment Variables
Create .env files in the backend directory:
DATABASE_URL=postgresql://user:password@localhost:5432/galaxia_predictions
SOLANA_RPC_URL=https://api.devnet.solana.com
PROGRAM_ID=your_program_id
JWT_SECRET=your_jwt_secret
# ... see README for full list4. Set Up Database
cd packages/backend
npm run db:generate
npm run db:migrate5. Build and Start
npm run build:all
npm run start:backend
# In another terminal:
npm run start:portalQuick Start with SDK
Create your first prediction market
import { GalaxiaPredictionsSDK, MarketType } from '@galaxia-predictions-market/sdk';
import { Connection, Keypair } from '@solana/web3.js';
// Initialize
const connection = new Connection('https://api.devnet.solana.com');
const wallet = new Wallet(keypair);
const sdk = new GalaxiaPredictionsSDK(connection, wallet);
// Create a market
const tx = await sdk.createMarket({
marketId: 'bitcoin-2024',
question: 'Will Bitcoin reach $100k by end of 2024?',
marketType: MarketType.BINARY,
outcomes: ['Yes', 'No'],
endTime: Math.floor(Date.now() / 1000) + 31536000,
oracle: new PublicKey('oracle-address'),
});
console.log('Market created:', tx);
// Trade on the market
await sdk.trade({
marketId: 'bitcoin-2024',
outcomeIndex: 0, // Bet on "Yes"
amount: 1000000 // 1 GXA worth of tokens
});