Solutions for Gamers
Core Apps
Offramp
In the rapidly evolving world of Web3, one of the critical challenges faced by developers is creating seamless experiences for users transitioning between cryptocurrency and fiat currency. In KGeN, we've tackled this challenge head-on by developing a comprehensive Offramp service. This service integrates with multiple external partners, including Mudrex, Razorpay, Transak and Smartpay, to provide a wide range of offramp options for users across different geographical locations.
Key features:
Multi-Partner Support
One of the standout features of our Offramp service is its ability to work with multiple partners. This is crucial for providing global coverage and ensuring the best rates for our users. The service determines the appropriate partner based on the user's location and the cryptocurrency being offramped.
Dynamic Fee Calculation
Calculating fees accurately is vital for both users and the platform. Our service implements a sophisticated fee calculation system that takes into account various factors such as gas fees, partner fees, and any applicable taxes.
Availability Checks
Before initiating an offramp transaction, the service performs thorough availability checks. These checks ensure that the requested amount is within allowed limits, the master wallet has sufficient balance, and the chosen partner can process the transaction.
Webhook Handling
To keep track of transaction statuses, our service implements webhook handlers for different partners. These handlers process incoming webhook data and update transaction statuses accordingly.
Caching and Queueing
To improve performance and handle high loads, we've implemented caching mechanisms and a job queue system using Bull. This allows us to process offramp requests efficiently and manage retries for failed transactions.
Challenges and Solutions
One of the main challenges we faced was ensuring consistency across different partners' APIs and handling their unique requirements. To address this, we implemented adapter patterns and created standardized interfaces for partner interactions.
Another significant challenge was managing the complex state of offramp transactions. We solved this by implementing a robust state machine that tracks each transaction's progress through various stages, from initiation to completion or failure. We also had realtime dashboards and alerting mechanisms to keep track of failures and do retries either in automated or manual way.
Security Considerations
Security is paramount in financial transactions. KGeN Offramp service implements several security measures:
We use HMAC for request signing to ensure the integrity of API calls.
Sensitive data is never logged or exposed in error messages.
We implement rate limiting and input validation to prevent abuse.
Send
Gamers can send their tokens to other gamers using wallet address, QR code, phone number or using contacts feature. KGeN takes care of gas management.
Swap
Gamers can swap their USDT tokens into kcash which they can use to redeem at the K-Store. KGeN takes care of gas management.
External connections
Wallet connect and Aptos connect
Gamers can connect any dapp to KGeN wallet using walletconnect. We are currently working to integrate Aptos connect into our KGeN wallet for Aptos dapps to connect to KGeN wallet.
.KGeN naming service
Every KGeN user gets a choice to choose their username which is registered in ENS for blockchain name resolution.
Ethereum Name Service (ENS) provides a decentralized way to map human-readable domain names to blockchain addresses, among other resources. Enhancing its functionality, wildcard ENS resolver offchain using CCIP (Cross-Chain Interoperability Protocol) is a method to efficiently resolve ENS names off-chain, leveraging EIP-3668 and ENSIP-10.
The steps involved are deploying the resolver contract, pointing the wild card for <*>.kgen.io to the resolver contract and deploying a backend service to return the wallet address for KGeN username.
Value Apps
Airdrop
We have developed the Airdrop module as a general purpose solution for airdropping any token to our gamers. The initial use case is for airdropping rKGeN token which is pre-TGE KGeN token.
Workflow:
KGeN determines the Airdrop eligibility based on gamer and game publisher engagement and whitelists the wallet address and token amount.
Gamers come to KGeN website and make a claim. If the address is whitelisted, the tokens will be transferred to the gamer.
Technical implementation:
Admin signature is used to check for whitelisting and user’s signature is used to prove the validity of the user.
Staking
rKGeN and KGeN token holders can stake their tokens to get additional yields when their token is lying idle. Following are functionalities that we are targeting:
Implement a reward system based on the number of tokens and duration.
The users can periodically harvest their rewards and also claim the principal and yield at the end of staking period.
Multiple stakes can be done at the same time.
Staking contract will be implemented in Aptos chain.
Users can either use KGeN wallet or Petra/Martian wallet to do the staking.
Oracle network
The Oracle Network refers to the decentralized collection of independent nodes (Oracles) that participate in the Proof of Gamer (PoG) system. Each Oracle is responsible for fetching gaming-related data, computing PoG scores, and submitting these scores to the Aptos blockchain for validation. The network operates in a secure, cryptographically verified environment where Oracles work together to achieve consensus on player performance metrics.
Additionally, each approved Oracle under the Proof of Authority (PoA) mechanism will be issued a non-fungible token (NFT) that represents their validation status. This NFT serves as proof of their approval and right to operate within the PoG system, granting them permission to perform PoG score calculations, participate in consensus, and validate transactions.
Oracle Functionality
Oracles play a pivotal role in calculating the Proof of Gamer (PoG) score by processing and aggregating player-specific data. The workflow is outlined as follows:
Data Fetching: The Docker image pulls gamer data from verified APIs and internal metrics.
PoG Computation: Using a standardized algorithm, the Oracle processes this data to compute a player’s PoG score based on factors such as gaming performance, consistency, and engagement.
Data Integrity: Before submitting results, Oracles sign the calculated PoG scores using cryptographic keys unique to each Oracle. This ensures that data integrity is maintained and any tampering is easily identifiable.
Score Submission: Oracles submit the signed PoG scores to the Aptos blockchain for validation.
Consensus Mechanism
To ensure the legitimacy of the submitted PoG scores, Oracles employ asymmetric cryptography (ECDSA or Ed25519, depending on the network implementation). This process involves:
Private Key Signing: Each PoG score is signed using the Oracle's private key.
Public Key Verification: Other Oracles, or the consensus contract, use the public key associated with the Oracle to verify the authenticity of the submission.
Aptos on-chain Consensus
The PoG network leverages the Aptos blockchain’s Byzantine Fault Tolerant (BFT) consensus mechanism to reach agreement on submitted scores:
Consensus Threshold: The smart contract deployed on Aptos will wait until at least 67% of the Oracles submit their PoG scores before reaching consensus.
Finality: Once the threshold is met, the network calculates the median or weighted average of the submitted scores to finalize the PoG scores.
Error Handling: Submissions that are deemed invalid (due to signature issues or incorrect calculations) are excluded from the consensus process, and malicious actors may face penalties such as stake slashing.
Player Tokens
Following are different NFT related functionalities that KGeN provides:
All our gamers can mint their PoG NFT when they login to the KGeN platform. The PoG NFT is a soulbound NFT(SBT) based on Aptos digital asset standard(DA). The PoG NFT tracks the user’s avatar, their pog scores and the different badges earned.
KGeN provides NFTs to gamers to celebrate different achievements that the gamer accomplishes.
KGeN wallet displays NFT for both EVM and Aptos chains in their wallet.
Utilities
Simplified payment
KGeN handles hundreds of thousands of gamer payments in a month. To make this system robust, we have built a comprehensive payment system using smart contracts where the payments can be made in a secure and scalable manner.
Transaction history
Gamers can earn in KGeN platform through various activities(K-Quest, K-Drop, Klash, Leaderboards, Referrals, Third party leaderboards etc). Gamers can earn in USDT and Kcash. Gamers can also offramp, onramp, swap, send/receive tokens. We have built an elaborate system to track all the rewards and transactions that the gamer performs in our platform and also filter by different types.
Last updated