{"id":30881196,"url":"https://github.com/ehsan6sha/mainnet-claim-web","last_synced_at":"2026-05-26T05:03:50.149Z","repository":{"id":312966161,"uuid":"1049481662","full_name":"ehsan6sha/mainnet-claim-web","owner":"ehsan6sha","description":"web based claim portal for mainnet rewards","archived":false,"fork":false,"pushed_at":"2025-09-03T03:56:37.000Z","size":46,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-03T05:29:35.845Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/ehsan6sha.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-03T03:40:36.000Z","updated_at":"2025-09-03T03:56:40.000Z","dependencies_parsed_at":"2025-09-03T05:29:37.601Z","dependency_job_id":"6b194282-4ec8-4b80-919a-8a4b04eeb145","html_url":"https://github.com/ehsan6sha/mainnet-claim-web","commit_stats":null,"previous_names":["functionland/mainnet-claim-web"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ehsan6sha/mainnet-claim-web","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehsan6sha%2Fmainnet-claim-web","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehsan6sha%2Fmainnet-claim-web/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehsan6sha%2Fmainnet-claim-web/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehsan6sha%2Fmainnet-claim-web/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ehsan6sha","download_url":"https://codeload.github.com/ehsan6sha/mainnet-claim-web/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehsan6sha%2Fmainnet-claim-web/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274152752,"owners_count":25231293,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"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":[],"created_at":"2025-09-08T07:45:27.210Z","updated_at":"2026-05-26T05:03:50.126Z","avatar_url":"https://github.com/ehsan6sha.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Reward Engine Portal\n\nA production-ready web application for claiming mining and network rewards from the RewardEngine smart contract deployed on Base and SKALE networks.\n\n## Features\n\n- 🌐 **Multi-Network Support**: Works with both Base and SKALE mainnet\n- 👛 **Wallet Integration**: Seamless MetaMask connection with automatic network switching\n- 🔄 **PeerID Conversion**: Automatic conversion from PeerID to bytes32 format for contract calls\n- 💰 **Reward Checking**: View available mining and network rewards before claiming\n- 🛡️ **Production Security**: Comprehensive error handling and input validation\n- 📱 **Mobile Responsive**: Works on both desktop and mobile devices\n- ⚡ **Real-time Updates**: Live transaction status and confirmation tracking\n\n## Quick Start\n\n### Prerequisites\n\n- MetaMask browser extension installed\n- Access to Base or SKALE mainnet\n- A valid PeerID for reward checking\n\n### Deployment to GitHub Pages\n\n1. **Fork or clone this repository**\n2. **Update contract addresses** in `app.js`:\n   ```javascript\n   const NETWORKS = {\n       skale: {\n           rewardEngineAddress: \"YOUR_SKALE_CONTRACT_ADDRESS\",\n           // ... other config\n       },\n       base: {\n           rewardEngineAddress: \"YOUR_BASE_CONTRACT_ADDRESS\", \n           // ... other config\n       }\n   };\n   ```\n3. **Enable GitHub Pages** in repository settings\n4. **Select source**: Deploy from main branch\n5. **Access your portal**: `https://functionland.github.io/mainnet-claim-web`\n\n### Local Development\n\n1. **Clone the repository**:\n   ```bash\n   git clone \u003crepository-url\u003e\n   cd mainnet-claim\n   ```\n\n2. **Serve locally** (Python example):\n   ```bash\n   python -m http.server 8000\n   ```\n\n3. **Open browser**: Navigate to `http://localhost:8000`\n\n## Usage\n\n### Connecting Your Wallet\n\n1. Click \"Connect Wallet\" button\n2. Approve MetaMask connection request\n3. The app will automatically switch to the selected network\n4. Your wallet address will be displayed once connected\n\n### Checking Rewards\n\n1. Select your preferred network (SKALE recommended)\n2. Enter your PeerID in the input field\n3. Optionally adjust the Pool ID (default: 1)\n4. Click \"Check Rewards\" to view available tokens\n\n### Claiming Rewards\n\n1. After checking rewards, click \"Claim Rewards\" if tokens are available\n2. Confirm the transaction in MetaMask\n3. Wait for transaction confirmation\n4. Your rewards will be transferred to your connected wallet\n\n## Network Configuration\n\n### SKALE Mainnet\n- **Chain ID**: 2046399126\n- **RPC URL**: https://mainnet.skalenodes.com/v1/elated-tan-skat\n- **Explorer**: https://elated-tan-skat.explorer.mainnet.skalenodes.com\n\n### Base Mainnet  \n- **Chain ID**: 8453\n- **RPC URL**: https://\n- **Explorer**: https://basescan.org\n\n## PeerID Format\n\nThe application supports both PeerID formats:\n- **CIDv1 format**: Starts with 'z' (e.g., `z12D3KooW...`)\n- **Legacy multihash**: Base58 encoded (e.g., `12D3KooW...`)\n\nPeerIDs are automatically converted to bytes32 format for smart contract interaction.\n\n## Smart Contract Integration\n\nThe portal interacts with the RewardEngine contract using these functions:\n\n- `getUnclaimedRewards(address, bytes32, uint32)`: Returns `(unclaimedMining, unclaimedStorage, totalUnclaimed)` in a single call. Storage (a.k.a. Network) rewards are an accumulated balance credited by the pool operator via `submitStorageRewardsBatch` on the upgraded RewardEngine.\n- `getClaimStatusV2(address, bytes32, uint32)`: Period status for mining (total unclaimed periods, per-claim cap, estimated claims needed).\n- `claimRewardsWithLimitV2(bytes32, uint32, uint256)`: Claims up to N mining periods plus the full accumulated storage balance in one transaction.\n\n## Error Handling\n\nThe application includes comprehensive error handling for:\n\n- **Wallet Connection**: MetaMask not installed, account locked, etc.\n- **Network Issues**: Wrong network, RPC failures, connection timeouts\n- **Transaction Errors**: Insufficient gas, rejected transactions, contract reverts\n- **Input Validation**: Invalid PeerID format, missing required fields\n- **Contract Errors**: No rewards available, circuit breaker active, etc.\n\n## Security Features\n\n- ✅ Input validation and sanitization\n- ✅ Network verification before transactions\n- ✅ Gas limit protection\n- ✅ Transaction timeout handling\n- ✅ Error message sanitization\n- ✅ No private key handling (MetaMask only)\n\n## Browser Compatibility\n\n- Chrome/Chromium (recommended)\n- Firefox\n- Safari (with MetaMask extension)\n- Edge\n- Mobile browsers with MetaMask mobile app\n\n## Troubleshooting\n\n### Common Issues\n\n**\"MetaMask not detected\"**\n- Install MetaMask browser extension\n- Refresh the page after installation\n\n**\"Wrong network\"** \n- The app will automatically prompt to switch networks\n- Manually switch to Base or SKALE in MetaMask if needed\n\n**\"Transaction failed\"**\n- Check you have sufficient ETH for gas fees\n- Verify the contract isn't paused (circuit breaker)\n- Ensure you have rewards available to claim\n\n**\"Invalid PeerID\"**\n- Verify PeerID format (should be 44+ characters)\n- Include 'z' prefix for CIDv1 format if needed\n- Check for typos in the PeerID\n\n### Getting Help\n\n1. Check browser console for detailed error logs\n2. Verify contract addresses are correctly configured\n3. Test with a small amount first\n4. Ensure MetaMask is unlocked and connected\n\n## Development\n\n### File Structure\n```\n├── index.html          # Main HTML structure\n├── app.js             # Application logic and Web3 integration  \n├── styles.css         # Responsive CSS styling\n├── contracts/         # Contract ABI files\n│   └── RewardEngine.json\n└── README.md          # This file\n```\n\n### Key Dependencies\n- **Ethers.js v6**: Web3 library for blockchain interaction\n- **MetaMask**: Browser wallet for transaction signing\n- **Base58**: PeerID encoding/decoding utilities\n\n### Configuration\n\nUpdate contract addresses in `app.js`:\n```javascript\n// Replace with actual deployed contract addresses\nrewardEngineAddress: \"0x...\" // Your contract address here\n```\n\n## License\n\nThis project is open source and available under the MIT License.\n\n## Support\n\nFor technical support or questions about the RewardEngine contract, please refer to the official documentation or contact the development team.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fehsan6sha%2Fmainnet-claim-web","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fehsan6sha%2Fmainnet-claim-web","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fehsan6sha%2Fmainnet-claim-web/lists"}