{"id":27950952,"url":"https://github.com/mollybeach/oracle-prediction-api","last_synced_at":"2026-04-20T09:03:12.880Z","repository":{"id":290800175,"uuid":"943472909","full_name":"mollybeach/oracle-prediction-api","owner":"mollybeach","description":"🏈 Oracle NFL Integration is a backend 🧠 prediction service that fetches real-time NFL data from ESPN 📡, maps team and event data to blockchain event IDs 🪄, and connects with oracles like UMA 📊 to resolve smart contract-based competitions on-chain 🔗.","archived":false,"fork":false,"pushed_at":"2025-04-30T16:20:55.000Z","size":161,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-07T03:20:22.347Z","etag":null,"topics":["api","backend","decentralized","jest","mongodb","sports-data","typescript","uma-protocol","winston","zod"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mollybeach.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-05T19:01:47.000Z","updated_at":"2025-05-14T20:10:27.000Z","dependencies_parsed_at":"2025-04-30T16:40:21.644Z","dependency_job_id":"5a346ebf-3b8a-4daf-91f0-ce2de4b23de2","html_url":"https://github.com/mollybeach/oracle-prediction-api","commit_stats":null,"previous_names":["mollybeach/oracle-prediction-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mollybeach/oracle-prediction-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mollybeach%2Foracle-prediction-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mollybeach%2Foracle-prediction-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mollybeach%2Foracle-prediction-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mollybeach%2Foracle-prediction-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mollybeach","download_url":"https://codeload.github.com/mollybeach/oracle-prediction-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mollybeach%2Foracle-prediction-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32040353,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","backend","decentralized","jest","mongodb","sports-data","typescript","uma-protocol","winston","zod"],"created_at":"2025-05-07T16:16:23.323Z","updated_at":"2026-04-20T09:03:12.862Z","avatar_url":"https://github.com/mollybeach.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Oracle Prediction API\n\n## Description\nOracle Prediction API is a backend service that fetches NFL team and match data from ESPN, maps the data to event IDs, and integrates it with a blockchain oracle for resolving smart contract-based competitions.\n\n### Features\n- Fetch real-time NFL team and event data from ESPN\n- Map team names to team IDs for contract integration\n- Store and retrieve match event IDs\n- Connect to a blockchain oracle to resolve competitions\n- Automate event resolution with smart contracts\n\n## Installation\n```sh\nnpm install\n```\n\n## Running the Project\n```sh\nnpm run dev\n```\n\n## API Endpoints\n- `GET /teams` - Fetches team mappings\n- `GET /events` - Fetches NFL event IDs\n- `POST /competition` - Creates a competition with oracle integration\n\n## Configuration\nCreate a `.env` file and add API keys and database credentials.\n\n## License\nMIT\n\n## Configuration\nCreate a `.env` file and add API keys and database credentials.\n\n\n## Fetching and Mapping Teams and Events\n\nTo fetch NFL teams and events and map their IDs, you can run the following scripts:\n\n```sh\nts-node scripts/fetchTeams.ts\nts-node scripts/fetchEvents.ts\n```\n\nThis script will retrieve the events from the ESPN API and log the mapping of event names to their corresponding IDs.\n\n## TODOs for Oracle Integration\n1. **Research UMA Protocol**:\n   - Understand how UMA (Universal Market Access) works and how it can be integrated in the application.\n   - Review UMA's documentation and examples to see how it handles oracle solutions.\n\n2. **Define Oracle Requirements**:\n   - Determine what data needs to be fetched from the oracle.\n   - Identify the specific events or conditions that will trigger oracle interactions.\n\n3. **Set Up Oracle Integration**:\n   - Decide whether the oracle integration should live in this repository or be a separate one.\n   - If separate, create a new repository for the oracle integration and set up the necessary project structure.\n\n4. **Implement Oracle Logic**:\n   - Write the logic to interact with the UMA protocol.\n   - Ensure that the application can fetch and utilize data from the oracle effectively.\n\n5. **Testing**:\n   - Create tests to ensure that the oracle integration works as expected.\n   - Test various scenarios to validate the reliability of the oracle data.\n\n ### UMA Protocol Integration Steps\n- **Asserting Data**: Implement a function to assert data to the UMA Optimistic Oracle. This will involve creating a smart contract that can submit assertions about events (e.g., \"Team A won the match\").\n  \n- **Handling Disputes**: Set up logic to handle disputes. If a dispute arises, the assertion will be sent to the DVM for resolution. Ensure that your application can respond to the outcome of these disputes.\n\n- **Economic Incentives**: Understand and implement the economic incentives for asserters and disputers. This includes bonding assertions and rewarding correct disputes.\n\n- **Testing the Integration**: Use test networks (like Görli) to test the integration of the UMA protocol. Ensure that assertions can be made, disputed, and resolved correctly.\n\n\n## Project Structure\n```\noracle-nfl-integration/\n│── src/\n│   ├── config/\n│   │   ├── env.ts                # Environment variable handling\n│   │   ├── constants.ts           # Constants like API URLs\n│   │   ├── db.ts                  # Database connection setup (PostgreSQL, MongoDB, or Redis)\n│   │   ├── oracle.ts              # Oracle smart contract interactions\n│   │   ├── network.ts             # Blockchain network config\n│   ├── services/\n│   │   ├── espnApi.ts             # Fetch ESPN team and event data\n│   │   ├── teamMapping.ts         # Process and store team -\u003e ID mappings\n│   │   ├── matchMapping.ts        # Process and store match (event) IDs\n│   │   ├── oracleHandler.ts       # Interact with Oracle to update events\n│   ├── routes/\n│   │   ├── auth.ts                # Authentication routes (if needed)\n│   │   ├── competitions.ts        # Routes for creating \u0026 managing competitions\n│   │   ├── oracle.ts              # API endpoints for fetching oracle data\n│   ├── middleware/\n│   │   ├── authMiddleware.ts      # Authentication middleware\n│   │   ├── errorHandler.ts        # Error handling middleware\n│   ├── models/\n│   │   ├── Team.ts                # Team schema/model (if using a database)\n│   │   ├── Match.ts               # Match schema/model\n│   ├── utils/\n│   │   ├── logger.ts              # Logging utility\n│   │   ├── helper.ts              # Generic helper functions\n│   ├── index.ts                   # Main entry point\n│\n│── scripts/\n│   ├── fetchTeams.ts              # One-time script to populate teams\n│   ├── fetchEvents.ts             # One-time script to populate match events\n│\n│── tests/\n│   ├── espnApi.test.ts            # Test ESPN API interactions\n│   ├── oracle.test.ts             # Test Oracle integration\n│\n│── .env                           # Environment variables\n│── .gitignore                     # Ignore sensitive files\n│── package.json                    # Dependencies and scripts\n│── README.md                      # Documentation\n│── tsconfig.json                   # TypeScript configuration\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmollybeach%2Foracle-prediction-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmollybeach%2Foracle-prediction-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmollybeach%2Foracle-prediction-api/lists"}