Esport Oracle is a decentralized oracle developed by PoC Innovation that bridges Counter-Strike 2 esports data with blockchain smart contracts. It securely and verifiably transfers match results, player statistics, tournament details and other competitive data onto the blockchain, enabling new possibilities for decentralized betting and other CS2-related applications while ensuring full transparency and accessibility for all stakeholders in the esports ecosystem.
The project consists of two main components:
- EsportOracle.sol: Main oracle contract with staking mechanism and consensus system
- EsportOracleRequester.sol: Extension contract for handling match data requests
- Built with Solidity ^0.8.20 and Foundry framework
- Implements a decentralized consensus mechanism with node validation
- Features a punishment system for malicious actors
- Go application that fetches data from PandaScore API
- Automatically submits match data to the smart contract
- Runs on a configurable cron schedule (default: every 15 minutes)
- Handles data transformation from API format to contract-compatible format
- Node Registration: Data providers stake 0.001 ETH to become oracle nodes
- Data Collection: Nodes fetch CS2 match data from PandaScore API
- Consensus Mechanism: Multiple nodes submit the same data, requiring quorum (>50% + minimum 3 votes)
- Data Validation: Smart contract validates and stores match results on-chain
- Punishment System: Nodes submitting incorrect data are penalized or banned after 3 violations
- Node.js (v16+)
- Go (v1.24+)
- Foundry (for smart contract development)
- Docker & Docker Compose (for deployment)
- PandaScore API Token (Get one here)
- Clone the repository
git clone https://github.com/PoCInnovation/esport-oracle.git
cd esport-oracle
- Set up the smart contract
cd oracle
forge install
forge build
- Configure the Go application
cd ../goapp
cp .env.sample .env
Edit the .env
file with your configuration:
CHAIN_ID=1337
PRIVATE_KEY=your_private_key_without_0x
CONTRACT_ADDRESS=deployed_contract_address_without_0x
CLIENT_ETH=http://localhost:8545
PANDASCORE_API_TOKEN=your_pandascore_api_token
CRON_SCHEDULE=*/15 * * * *
- Install Go dependencies
go mod download
For a complete local deployment:
cd oracle
chmod +x deploy_oracle.sh
./deploy_oracle.sh
This will:
- Start a local Anvil blockchain node
- Deploy the EsportOracle contract
- Provide you with the contract address for configuration
cd oracle
# Start local blockchain
anvil
# Deploy contract (in another terminal)
forge create "src/esportOracle.sol:EsportOracle" \
--private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \
--rpc-url http://localhost:8545
cd goapp
go run cmd/myapp/main.go
- Stake ETH to become a node:
cast send --private-key <your_private_key> \
--value 0.001ether \
"<CONTRACT_ADDRESS>" \
"addFundToStaking()"
- Start the Go application:
go run cmd/myapp/main.go
The application will automatically:
- Fetch match data every 15 minutes (configurable)
- Submit data to the smart contract
- Handle consensus and validation
Get pending matches:
cast call "<CONTRACT_ADDRESS>" "getPendingMatches()(bytes32[])"
Get match by ID:
cast call "<CONTRACT_ADDRESS>" "getMatchById(uint256)(tuple)" <MATCH_ID>
Get listed nodes:
cast call "<CONTRACT_ADDRESS>" "getListedNodes()(address[])"
Withdraw stake:
cast send --private-key <your_private_key> \
"<CONTRACT_ADDRESS>" \
"withdrawStake()"
You can integrate the oracle data into your applications:
interface IEsportOracle {
struct Match {
uint256 _id;
Opponents[] _opponents;
Games[] _game;
Result[] _result;
uint256 _winnerId;
uint256 _beginAt;
}
function getMatchById(uint256 matchId) external view returns (Match memory);
function getPendingMatches() external view returns (bytes32[] memory);
}
cd oracle
forge test -vvv
cd goapp
go test ./...
esport-oracle/
βββ oracle/ # Smart contract components
β βββ src/
β β βββ esportOracle.sol # Main oracle contract
β β βββ esportOracleRequester.sol # Request handling extension
β βββ test/ # Foundry tests
β βββ script/ # Deployment scripts
β βββ docker-compose.yml # Local deployment
βββ goapp/ # Go data provider
β βββ cmd/myapp/ # Application entry point
β βββ internal/
β β βββ client/ # API and blockchain clients
β β βββ contract/ # Generated contract bindings
β β βββ models/ # Data models
β β βββ service/ # Business logic
β βββ .env.sample # Environment configuration template
βββ .github/ # GitHub workflows and templates
βββ README.md # This file
- Staking Mechanism: Nodes must stake ETH to participate
- Consensus System: Requires majority agreement for data validation
- Punishment System: Progressive penalties for incorrect submissions
- Node Banning: Automatic banning after 3 violations
- Owner Controls: Administrative functions for emergency situations
- Pausable Contract: Can be paused in case of emergency
The oracle currently integrates with:
- PandaScore API: For CS2 match data, statistics, and tournament information
- Match results and scores
- Team information and rosters
- Tournament brackets and schedules
- Player statistics
- Live match updates
- Staking Amount: 0.001 ETH (fixed)
- Maximum Violations: 3 violations before ban
- Punishment Amount: 0.0001 ETH per violation
- Quorum Requirement: >50% of nodes + minimum 3 votes
- Update Frequency: Configurable via
CRON_SCHEDULE
- API Rate Limiting: Handled automatically
- Error Handling: Automatic retry with exponential backoff
- Data Validation: Schema validation before submission
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
- Solidity: Follow Foundry conventions
- Go: Use
gofmt
and follow Go best practices - Commits: Use conventional commit messages
- Testing: Maintain test coverage
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- Documentation: Foundry Book
- PandaScore API: Documentation
- Support: For questions, contact our team or open an issue
You're invited to join this project! Check out the contributing guide.
If you're interested in how the project is organized at a higher level, please contact the current project manager.
Developers
[Jules Lordet] |
[Gregoire Caseaux] |
[GrΓ©gor Sternat] |
[Aaron Aniambossou] |
---|
Manager
[Lucas Leclerc] |
[Sacha Dujardin] |
---|
π Don't hesitate to follow us on our different networks, and put a star π on
PoC's
repositories
Made with β€οΈ by PoC