Welcome to the Playmind Ecosystem, a decentralized platform built on Ethereum that enables game publishers, players, and agents to interact securely and transparently. This README provides an in-depth overview of the ecosystem's components, their interactions, and how various functionalities are implemented.
The Playmind Ecosystem is designed to provide a secure and verifiable environment for gameplay sessions. It leverages Non-Fungible Tokens (NFTs) to represent player identities (PlayerNFT), gameplay sessions (SessionNFT), and games (GameNFT). The ecosystem also includes mechanisms for session purchase, reward distribution, and cryptographic verification.
The PlayerNFT contract manages player identities within the Playmind ecosystem. Each player can own only one PlayerNFT, which serves as their unique identity.
-
Key Features:
- One-to-one mapping between players and NFTs.
- Immutable player-NFT association.
- Metadata storage for player profiles.
- Integration with
SessionNFTfor gameplay verification.
-
Functions:
safeMint(address to, string memory uri): Mints a newPlayerNFTto the specified address.hasPlayerNFT(address player): Checks if an address owns aPlayerNFT.getPlayerTokenId(address player): Retrieves the token ID of a player's NFT.
The SessionNFT contract manages and verifies gameplay sessions through NFTs and cryptographic proofs.
-
Key Features:
- Session NFTs tied to
PlayerNFTs. - Minimum session duration enforcement.
- IPFS-based gameplay data storage.
- Cryptographic verification using ECDSA.
- Session state tracking.
- Session NFTs tied to
-
Functions:
startSession(...): Starts a new gameplay session.endSession(string calldata ipfsCID, bytes32 dataHash): Ends a gameplay session to await upload data to IPFS.verifySession(uint256 tokenId, bytes memory signature): Verifies a session with proof of play.purchaseSession(uint256 tokenId): Allows users to purchase access to a session's data.
The GameNFT contract manages game registrations and gameplay sessions in the Playmind ecosystem.
-
Key Features:
- Only verified publishers can register games.
- Each game is represented as a unique NFT.
- Games can be activated/deactivated by their publishers.
- Integrated with
SessionNFTfor gameplay session management.
-
Functions:
registerGame(...): Registers a new game in the ecosystem.startSession(uint256 gameId): Starts a new gameplay session for a specific game.setGameActive(uint256 gameId, bool active): Updates the active status of a game.setEncryptionProtocol(uint256 gameId, string memory protocol): Updates the encryption protocol for a game.
The Agent contract manages batch session purchases and distributes rewards to session owners.
-
Key Features:
- Purchase individual or batch sessions.
- Track purchased sessions.
- Distribute rewards to session owners.
- Handle token approvals and transfers.
-
Functions:
purchaseSession(uint256 sessionId): Purchases a single session.batchPurchase(uint256[] calldata sessionIds): Purchases multiple sessions in a batch.distribute(uint256 amount): Distributes rewards to the contract for session owners to claim.claimRewards(uint256 sessionId): Allows session owners to claim rewards.
The PlaiToken contract is an ERC20 token used for payments and rewards within the ecosystem.
- Key Features:
- Mintable by the owner.
- Used for session purchases and reward distributions.
The PublisherRegistry contract manages the verification and status of game publishers in the Playmind ecosystem.
-
Key Features:
- Publisher verification by platform owner.
- Active/inactive status management.
- Immutable publisher metadata.
-
Functions:
verifyPublisher(...): Verifies a new publisher in the ecosystem.deactivatePublisher(address publisherAddress): Temporarily deactivates a verified publisher.reactivatePublisher(address publisherAddress): Reactivates a previously deactivated publisher.isVerifiedPublisher(address publisherAddress): Checks if an address is a verified and active publisher.
- Verification: Publishers must first be verified in the
PublisherRegistryby the platform owner. - Registration: Verified publishers can register new games using the
GameNFT.registerGame(...)function. Each game is minted as a unique NFT. - Activation: Publishers can activate or deactivate their games using
GameNFT.setGameActive(...).
- PlayerNFT Requirement: Players must own a
PlayerNFTto participate in gameplay sessions. - Session Creation: Players start sessions by calling
GameNFT.startSession(...). This creates a newSessionNFTtied to the player and the game. - Session Completion: Players end sessions by calling
SessionNFT.endSession(...), uploading gameplay data to IPFS.
- Price Configuration: Publishers can set purchase prices for their games during registration (
GameNFT.registerGame(...)). It can be zero, as there are as well strategies to monetize on usage (agents distributing rewards). - Payment Handling: When players start sessions, they pay the configured price using the specified ERC20 token.
- Encryption Protocol: Publishers can configure encryption protocols for their games using
GameNFT.setEncryptionProtocol(...). - Lit Protocol Integration: When using the Lit Protocol, access conditions ensure that only users who have purchased the session can access encrypted content.
const litAccessConditions = [{
contractAddress: sessionNFT.address,
chain: "ethereum",
standardContractType: "custom",
method: "sessionPurchases",
parameters: [":tokenId", ":userAddress"],
returnValueTest: {
comparator: "=",
value: "true"
}
}];- Batch Purchases: Agents can purchase multiple sessions in bulk using
Agent.batchPurchase(...). - Reward Distribution: Agents distribute rewards to session owners by calling
Agent.distribute(...). - Reward Claiming: Session owners can claim their rewards using
Agent.claimRewards(...).
- Access Control: Only verified publishers can register games. Only game publishers can verify sessions.
- Immutable Associations: Player-NFT associations are immutable, ensuring secure identity management.
- Cryptographic Verification: Sessions are verified using ECDSA signatures, ensuring data integrity.
- Minimum Session Duration: Enforces a minimum session duration to prevent abuse.
The Playmind Ecosystem provides a robust framework for managing game publishers, players, and gameplay sessions in a decentralized manner. By leveraging NFTs, cryptographic proofs, and smart contracts, it ensures secure, verifiable, and tamper-proof interactions within the ecosystem.
For more information, please refer to the individual contract documentation or contact the development team.