Welcome to the Pact Protocol monorepo. This project contains the smart contracts, oracle service, and mobile application for a decentralized platform where users can create and participate in challenges with crypto-backed incentives.
This repository is organized into three main components:
pact/: The core Solana smart contract, written in Rust using the Anchor framework. This handles all on-chain logic for creating, joining, and managing pacts.pact-oracle/: A Node.js service that acts as an off-chain oracle. It is responsible for monitoring real-world data, evaluating pact conditions, and instructing the smart contract on outcomes.pactmobile-expo/: The user-facing mobile application built with React Native and Expo. It provides the interface for users to interact with the Pact Protocol.
Follow these instructions to get the entire Pact ecosystem running locally for development.
Before you begin, ensure you have the following tools installed and configured:
- Node.js (v18 or higher recommended)
- Yarn or npm
- Rust & Cargo
- Solana CLI (latest version)
- Anchor CLI (
avm install 0.29.0andavm use 0.29.0) - Expo CLI (
npm install -g expo-cli)
It is recommended to work on a dedicated feature branch. From the master branch, run:
git checkout -b your-feature-nameTo run the full stack, you will need four terminal windows.
Terminal 1: Solana Validator This terminal runs the local Solana blockchain.
solana-test-validatorTerminal 2: Smart Contract Deployment This terminal is for building and deploying the on-chain program.
- Navigate to the contract directory:
cd pact - Build the Anchor program:
anchor build
- Deploy the program to your local validator:
(Note: Ensure you are using Anchor version 0.29.0, as specified in the original setup)
anchor deploy
Terminal 3: Oracle Service This terminal runs the off-chain oracle.
- Navigate to the oracle directory:
cd pact-oracle - Install dependencies:
npm install
- Start the oracle service:
npm run start
Terminal 4: Mobile Application This terminal runs the Expo development server for the mobile app.
- Navigate to the mobile app directory:
cd pactmobile-expo - Install dependencies:
npm install
- Start the Expo development server:
npx expo start
This will open the Expo developer tools, allowing you to launch the app in an iOS Simulator, Android Emulator, or on a physical device using the Expo Go app.