Welcome to the Global Truth Protocol (GTP) - a planetary-scale probabilistic truth infrastructure.
- Node.js >= 18.0.0
- Python >= 3.10
- Git
- MetaMask (or Web3 wallet)
- Docker (optional, for local blockchain)
git clone https://github.com/burnzy/global-truth-protocol
cd GlobalTruthProtocolCreate a .env file in the root directory:
# Blockchain
ETHEREUM_RPC_URL=https://eth-sepolia.g.alchemy.com/v2/YOUR_KEY
DEPLOYER_PRIVATE_KEY=your_private_key_here
ETHERSCAN_API_KEY=your_etherscan_key
# AI Core
FRED_API_KEY=your_fred_api_key
NEWS_API_KEY=your_news_api_key
SPORTS_API_KEY=your_sports_api_key
# Database
DB_HOST=localhost
DB_PORT=5432
DB_NAME=gtp_predictions
DB_USER=postgres
DB_PASSWORD=your_password
REDIS_HOST=localhost
REDIS_PORT=6379
# API
API_SECRET_KEY=your_secret_key_here
# Monitoring
SLACK_WEBHOOK_URL=your_slack_webhook
ALERT_EMAIL=alerts@yourcompany.comcd ai-core
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txtcd ../smart-contracts
npm installcd ../frontend
npm installcd ../backend
npm installcd smart-contracts
# Start local Hardhat node
npx hardhat node
# In another terminal, deploy contracts
npx hardhat run scripts/deploy.js --network localhostCopy the deployed contract addresses to your .env file.
cd ai-core
python main.pyThe AI prediction engine will start listening for events.
cd backend
npm run devAPI will be available at http://localhost:8000
cd frontend
npm run devOpen http://localhost:3000 in your browser.
# Install PostgreSQL
brew install postgresql # macOS
sudo apt install postgresql # Ubuntu
# Create database
createdb gtp_predictions
# Run migrations
psql gtp_predictions < database/schema.sql# Install Redis
brew install redis # macOS
sudo apt install redis # Ubuntu
# Start Redis server
redis-serverThe AI models need historical data to train on:
cd ai-core
# Download training data
python scripts/download_data.py
# Train models
python scripts/train_models.py
# This will create trained model checkpoints in models/checkpoints/Training takes approximately 2-4 hours on a GPU.
After deploying to testnet/mainnet, verify contracts:
cd smart-contracts
npx hardhat verify --network sepolia DEPLOYED_ADDRESS "CONSTRUCTOR_ARGS"// Using ethers.js
const eventId = ethers.utils.id("2026_US_ELECTION");
const description = "2026 US Midterm Elections - Democratic Control";
const category = 1; // Politics
const lockDate = Math.floor(Date.now() / 1000) + 30 * 24 * 60 * 60; // 30 days
const resolutionDate = lockDate + 7 * 24 * 60 * 60; // 7 days after
const criteriaHash = ethers.utils.keccak256(ethers.utils.toUtf8Bytes("Democratic majority in House"));
const tx = await eventRegistry.createEvent(
eventId,
description,
category,
lockDate,
resolutionDate,
criteriaHash,
{ value: ethers.utils.parseEther("0.01") }
);
await tx.wait();
console.log("Event created:", eventId);# Using Python AI Core
from main import PredictiveCore
import asyncio
async def predict():
config = load_config('config.yaml')
core = PredictiveCore(config)
prediction = await core.predict_event('EVT_2026_US_ELECTION')
print(f"Truth Score: {prediction['truthScore']:.3f}")
print(f"Volatility: {prediction['volatilityIndex']:.3f}")
print(f"Hash: {prediction['predictionHash']}")
asyncio.run(predict())// Stake TRUTH tokens on outcome
const eventId = ethers.utils.id("2026_US_ELECTION");
const amount = ethers.utils.parseEther("100"); // 100 TRUTH
const outcome = true; // Predicting TRUE
// Approve TRUTH tokens
await truthToken.approve(stakingPool.address, amount);
// Stake
const tx = await stakingPool.stakeOnEvent(eventId, amount, outcome);
await tx.wait();
console.log("Staked successfully!");// After event resolution
const eventId = ethers.utils.id("2026_US_ELECTION");
const tx = await stakingPool.claimRewards(eventId);
const receipt = await tx.wait();
console.log("Rewards claimed!");cd smart-contracts
npx hardhat test
# With gas reporting
REPORT_GAS=true npx hardhat test
# Coverage
npx hardhat coveragecd ai-core
pytest tests/ -v
# With coverage
pytest tests/ --cov=. --cov-report=htmlcd backend
npm test
# E2E tests
npm run test:e2ecd smart-contracts
# Deploy
npx hardhat run scripts/deploy.js --network sepolia
# Verify
npx hardhat verify --network sepolia DEPLOYED_ADDRESScd ai-core
# Build Docker image
docker build -t gtp-ai-core .
# Run container
docker run -d \
--name gtp-ai-core \
-p 8000:8000 \
--env-file .env \
gtp-ai-corecd frontend
# Install Vercel CLI
npm i -g vercel
# Deploy
vercel --prodEdit ai-core/config.yaml:
monte_carlo:
num_simulations: 100000 # Increase for more accuracy
reinforcement_learning:
learning_rate: 0.001 # Adjust based on performanceEdit deployment script or use governance:
// Adjust platform fee
await stakingPool.setPlatformFee(200); // 2%
// Adjust stake limits
await stakingPool.setStakeLimits(
ethers.utils.parseEther("1"),
ethers.utils.parseEther("1000000")
);Solution:
- Reduce
num_simulationsin config - Use GPU acceleration
- Enable caching in Redis
Solution:
- Check you have enough ETH for gas
- Verify RPC URL is correct
- Increase gas limit in hardhat.config.js
Solution:
- Ensure MetaMask is installed
- Check network is correct (Sepolia testnet)
- Clear browser cache
Solution:
- Verify PostgreSQL is running:
pg_isready - Check credentials in .env
- Ensure database exists:
psql -l
- Whitepaper - Full technical specification
- Tokenomics - Token economics
- API Documentation - Backend API reference
- Smart Contract Docs - Contract interfaces
We welcome contributions! Please see CONTRIBUTING.md
- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open Pull Request
- Python: Follow PEP 8, use Black formatter
- JavaScript: Follow Airbnb style guide, use Prettier
- Solidity: Follow Solidity style guide
- Discord: discord.gg/gtp
- Twitter: @GlobalTruthGTP
- Email: support@globaltruthprotocol.xyz
- Docs: docs.globaltruthprotocol.xyz
MIT License - See LICENSE for details
"Truth is not binary. It's a probability distribution backed by economic consequence."