# DRM Mina - Unity games

**URL:** <https://forums.minaprotocol.com/t/drm-mina-unity-games/6381>\
**Category:** Mina Navigator Proposals\
**Created:** [July 31, 2024, 1:29pm UTC](https://forums.minaprotocol.com/t/drm-mina-unity-games/6381 "2024-07-31T13:29:41Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![hgedia](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.minaprotocol.com/hgedia/32/1734_2.png) [@hgedia](https://forums.minaprotocol.com/u/hgedia)\
**Post date:** [July 31, 2024, 1:29pm UTC](https://forums.minaprotocol.com/t/drm-mina-unity-games/6381/1 "2024-07-31T13:29:41Z")

</div>

This topic is to discuss the proposal submitted by @kadirchan  
Please see below for the details of the proposal and discussion.

**27th August, 2024**  
The start date is updated to 1st September after discussing with proposer.

**13th August, 2024**  
_Current status: Funded_  
_Funding Note: DRM is a great space to explore the application of zero-knowledge proofs and we look forward to the progress and support for this on mina. DRM mina has successfully delivered their project in cohort 3 of zkIgnite. The risk of funding this project is low. The budget is in line with the work proposed. Being one of the early applications of DRM in the space, we are assessing the impact to be medium-low in the short term. The project will help uncover design patterns and unique ways to approach this space._

**31st July, 2024**  
_Current status: Under Consideration._  
_Opened for community discussion on : 31st July._

---

<div class="post-metadata">

**Author:** ![kadirchan](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.minaprotocol.com/kadirchan/32/2008_2.png) [@kadirchan](https://forums.minaprotocol.com/u/kadirchan)\
**Post date:** [July 31, 2024, 1:58pm UTC](https://forums.minaprotocol.com/t/drm-mina-unity-games/6381/2 "2024-07-31T13:58:37Z")

</div>

# Navigators Season 2: DRM Mina Growth Grants Proposal

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/minaprotocol/original/2X/d/d23e14664920b29691125d9b9a6d2de8780bc075.jpeg)

## Project Background

DRM Mina is a game marketplace that connects game creators and players on Mina. It uses Mina’s zk-proofs as an alternative to today’s anti-piracy systems, preventing authorized or unauthorized use of 3rd party applications and users’ data, as well as removing the dependency of game ownership on game markets, preventing monopolies and high deductions from game developers.

- **Problems We Are Trying To Solve :**
  1. Current game marketplace providers and third party companies collect user data with or without consent and use it for their own benefit, such as marketing.
  2. Marketplaces making cuts between 30% - 12% from each game sales. As these cuts are charged to the game producers, they find the solution in raising the price of the game. Rising game prices are also making it harder for gamers to access games and leading some gamers to pirate games.
  3. Game producers who want to provide piracy protection from a third party face high licensing fees, which are also reflected in the price of the game.
  4. When a game is purchased from one game provider, the licenses cannot be transferred to other game providers, forcing the player to use the same provider to play the purchased game. Each of these game providers also allows game files to be obtained only from their own servers, making them a monopoly in their own right.

- **Our Solutions:**
  1. Thanks to Mina and its zk-proofs, users can prove whether or not they own the game without leaving their device. Only the unique hash of this information generated by the zk program is kept outside the device at on-chain.
  2. The system does not require high cost to maintain so the amount charged to the game producers and users will be much lower than competitors. Cheaper games are more accessible for more gamers.
  3. There is no monopoly here as players don’t have to use the platform to use the verification system.
  4. Once players have purchased the game and registered their device, they can download and play the game directly and do not need to use a separate client or app to do so. It doesn’t matter from which source they obtain the game files, this provides relief on storage and distribution fees and therefore on game prices.

DRM Mina started development in zkignite 3 and [here](https://drm-mina-marketplace.vercel.app) is the version running on the Protokit appchain.

[Github Repository](https://github.com/DRM-Mina)

## Proposal Overview

This project, which was planned and started within the scope of Zkignite, has turned out to have wider scope than expected as we realize its potential more and more every day. However, more time and resources are needed for the improvements and new features.

- **Problems:**
  1. The current version works with Protokit, but due to the fact that the expected updates to Protokit are still not ready, the current version does not have L1 settlement and data storage. In addition, in order to be able to launch mainnet with Protokit, the framework must be completely finished and the necessary audits must be done. This is the biggest blocker of not being able to launch to mainnet.
  2. Since the current version is completely dependent on the Protokit appchain to work, the appchain needs to be stopped and restarted in case of errors on the appchain side (js heap full, wrong tx arriving, etc.). While this is a big problem for liveness, it also causes the information loss because the data is not stored permanently in current version.
  3. The inability to launch mainnet means that game developers are unable to sell their games for a real monetary value, which makes the games market less attractive, so currently there are only a few games that we have made with our own resources.
  4. Our modules and utilities are wirtten with o1js 0.13, so we cannot benefit from new upgrades and improvements in o1js.

- **Solution:**
  1. In the current design, all operations are planned to be done with the Protokit and central sequencer, which send transactions to Mina L1. Instead, in the scope of this project, the main parts such as buying games, registering devices, etc. will work directly with L1 contracts using the new and updated OffchainState and Action & Reducer APIs.
  2. We plan to provide the state that will be changed with the deviceSession information generated during the game with a customized sequencer made for this purpose. This sequence will roll-up the proofs for the state change from the players and send them into the contract, so that the players are not asked to make a transaction for each game session.
  3. We will use this backend for data storage and data availability. Also we can add decentralized data availability and storage protocols to support these solutions in the future.
  4. After writing the contracts and utilities with the latest o1js with the planned additions and performing the necessary tests, the product will be firstly released to the testnet and then to the mainnet.
  5. Once the market is ready for shopping and attractive to users, we will negotiate with game producers and, if agreed, add their games to the market.

- **Impact:**  
DRM Mina allows game developers to sell and authenticate games created using the Unity Game Engine (currently, we only support Unity) on the Mina Protocol. After registering their games to the system, game developers can import the DRM Mina Unity package into their existing games and use the system in their games as they wish. In this way, it will contribute to the growth of the game ecosystem within Mina by bringing the real power and application areas of zkproofs and Mina to the outside world.
- **Audience:**  
DRM Mina targets the gamers and the game developers all around the world.

## Architecture & Design

- **Detailed Design/Architecture:**  
The DRM Mina architecture allows users to purchase their games and verify their purchases afterwards.

- **Current Architecture:**  
Our current version working with Protokit consists of 3 main modules:  
`Balances`: control user balance (in Mina) to buy games.  
`GameToken`: allow creators to publish their games, customize them and controls the sales of games.  
`DRM`: keeps device information hash of users that have bought game, and their device’s last session informations.  

- **New Architecture:**  
With the new architecture, we plan to move game purchases, session creation and other contract interactions directly to L1 through OffchainState. In addition, we want to handle the process of sending the session proof that users need to generate to play their games to the network through a separate sequencer so that they do not sign and send tx on every game session.  
In addition to this, with the device data collected from volunteers so far, we will check the validity of the identifier information in the contract and in the game in general terms.

- **Vision:**  
Our vision is to bring game developers and gamers together in a more fair gaming marketplace running on Mina. We want indie game developers can deliver their games securely to gamers without being crushed by massive cuts, and gamers can be confident that their data is safe while they enjoy the games they buy.

- **Existing Work :** [Github Repository](https://github.com/DRM-Mina)

- **Production Timeline :**  
The prototype of the product is ready, but the infrastructure needs to be overhauled and tested. It would also be good to extend the Unity package and improve its UX. For this reason, the product is planned to launch Mainnet in October or November.

## Budget & milestones

- **Deliverables** :
  - o1js Contracts
    - GameMarket and DRM contracts in pure o1js
    - OffchainState mechanisims
    - At least 90% test coverage

  - Customized Sequencer and Improved Backend
    - Proof aggregation and settlement
    - Merkle tree storage and its CRUD operations

  - Improved Unity Package
    - Code refactoring and optimizations based on improved contracts
    - Improving the developer experience

  - Improvements on website
    - Increasing user interactions such as comments and reviews

  - Improved and Renewed Game Addition Portal
  - DRM Mina Documentation
  - (Optional) New Games on Marketplace

- **Mid-Point milestones:**
  - Partially completed and tested o1js smart contracts
  - Sequencer and proof aggregation prototype
  - Refactored DRM Mina Unity Package
  - Website improvements and additional user interactions, comments and ratings

- **Project Timeline :** 3M
- **Budget Requested :** 30,000 MINA
- **Budget Breakdown:**
  - New sequencer and backend implementations (13500 Mina)
  - Smart contract implementation & integrations (6500 Mina)
  - Frontend improvements & implementations (5000 Mina)
  - Unity package and integration costs (3000 Mina)
  - Budget of oursourcing for designs, incentives and server costs (2000 Mina)

- **Wallet Address:**  
B62qonjCTTzww6w7Msquv5sH5Ti5A2XNPfzjBPzN6zFHkX8LyzKuS4C

## Team Info

- **Proposer Github** : [@kadirchan](https://github.com/kadirchan)
- **Proposer Experience** :  
BSc in Computer Engineering  
Fulstack Web3 developer  
Built DRM Mina Game Marketplace
- **Team Members** :
  - [@kadirchan](https://github.com/kadirchan)
  - [@enesezgin32](https://github.com/enesezgin32)  
BSc in Computer Engineering  
Game Developer, experienced in Unity Game Engine

- **Achievements** :  
DRM Mina Game Marketplace  
[Project Website](https://drm-mina-marketplace.vercel.app)  
[Project Github Repository](https://github.com/DRM-Mina)

## Risks & Mitigations

- What risks or dependencies do you foresee with building this project ?
  - Since a lot of the execution and proof generation will be on the user’s computer, it may be slow for some.
  - It may be difficult for a while to get small-medium game studios to integrate their games and add them to the market, so in the early stages there may be small scale games in the market.
  - Since it will take advantage of experimental o1js features, unexpected bugs may be encountered, but this will be fixed with future updates.
  - The use of a central server as a data layer and users sending some proofs with a sequencer can prevent the system from being full live.

- What are your mitigations if any?
  - We will migrate the whole system from Protokit app-chain to o1js L1 and customized sequencer.

---

<div class="post-metadata">

**Author:** ![0x471](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.minaprotocol.com/0x471/32/2097_2.png) [@0x471](https://forums.minaprotocol.com/u/0x471)\
**Post date:** [August 13, 2024, 8:19am UTC](https://forums.minaprotocol.com/t/drm-mina-unity-games/6381/3 "2024-08-13T08:19:49Z")

</div>

Thank you for the proposal! I noticed that you mentioned liveness as one of the problems that you are trying to solve. However, your implementation of a sequencer might also face similar challenges, such as a single point of failure and censorship. Could you please elaborate on your plans to mitigate these risks?

---

<div class="post-metadata">

**Author:** ![kadirchan](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.minaprotocol.com/kadirchan/32/2008_2.png) [@kadirchan](https://forums.minaprotocol.com/u/kadirchan)\
**Post date:** [August 13, 2024, 12:23pm UTC](https://forums.minaprotocol.com/t/drm-mina-unity-games/6381/4 "2024-08-13T12:23:32Z")

</div>

Hi 🙂 , thanks for the feedback. In this architecture sequencer will work as a transaction aggregaotr to prevent users from paying transaction fees for each game session, because they need to proof they can change corresponding state to auth. Of course, if the sequencer gets congested or crashes, they can send the transaction directly from their computer if they wish but this time they need an Mina account on their local prover. Actually, the problem we will face is similar to the one we would have if we were using the protokit appchain in its current form, which can also crash and stop. Since Sequencer will only be used as a transaction aggregator, it cannot be said that the system stops completely if it crashes. However, since we are using a centralized system as a data availability layer for now, temporary blockages may occur in some cases. We will try to solve these as well.

---

<div class="post-metadata">

**Author:** ![hgedia](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.minaprotocol.com/hgedia/32/1734_2.png) [@hgedia](https://forums.minaprotocol.com/u/hgedia)\
**Post date:** [August 14, 2024, 8:31am UTC](https://forums.minaprotocol.com/t/drm-mina-unity-games/6381/5 "2024-08-14T08:31:07Z")

</div>

This application is approved for Funding.

DRM is a great space to explore the application of zero-knowledge proofs and we look forward to the progress and support for this on mina. DRM mina has successfully delivered their project in cohort 3 of zkIgnite. The risk of funding this project is low. The budget is in line with the work proposed. Being one of the early applications of DRM in the space, we are assessing the impact to be medium-low in the short term. The project will help uncover design patterns and unique ways to approach this space.

---

<div class="post-metadata">

**Author:** ![hgedia](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.minaprotocol.com/hgedia/32/1734_2.png) [@hgedia](https://forums.minaprotocol.com/u/hgedia)\
**Post date:** [August 27, 2024, 2:56pm UTC](https://forums.minaprotocol.com/t/drm-mina-unity-games/6381/6 "2024-08-27T14:56:40Z")

</div>

We have updated the start date to 1st September after discussing with proposer.

---

<div class="post-metadata">

**Author:** ![kadirchan](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.minaprotocol.com/kadirchan/32/2008_2.png) [@kadirchan](https://forums.minaprotocol.com/u/kadirchan)\
**Post date:** [September 10, 2024, 11:42am UTC](https://forums.minaprotocol.com/t/drm-mina-unity-games/6381/7 "2024-09-10T11:42:21Z")

</div>

Greetings from DRM Mina updates:

- The skeleton of the website has been rebuilt, places that may be incompatible with the new version have been changed/removed.
- Backend was renewed and incompatible parts were replaced.
- Contract helper structs and functions written.
- We are currently working on a customized token contract, we are trying to write the token contract in accordance with the new standard as much as possible.
- New games will start to be onboarded once the contract and the overall system is complete.

---

<div class="post-metadata">

**Author:** ![kadirchan](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.minaprotocol.com/kadirchan/32/2008_2.png) [@kadirchan](https://forums.minaprotocol.com/u/kadirchan)\
**Post date:** [September 24, 2024, 12:53pm UTC](https://forums.minaprotocol.com/t/drm-mina-unity-games/6381/8 "2024-09-24T12:53:27Z")

</div>

DRM Mina second update:

- Contracts and tests almost finished, also deployed to devnet and make onchain tests.
- Web worker and their contract interactions partially completed. I’m trying to run offChainState program in web workers but currently it seems inefficient.
- Improvements on server.

---

<div class="post-metadata">

**Author:** ![kadirchan](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.minaprotocol.com/kadirchan/32/2008_2.png) [@kadirchan](https://forums.minaprotocol.com/u/kadirchan)\
**Post date:** [October 7, 2024, 5:32pm UTC](https://forums.minaprotocol.com/t/drm-mina-unity-games/6381/9 "2024-10-07T17:32:05Z")

</div>

Third Update:

- Waiting offchainstate refactor pr for finalize contracts.
- Implemented event listening on unity game.  
Unfortunately blocked by current offchainState API but refactor pr going to release soon.

---

<div class="post-metadata">

**Author:** ![ied](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.minaprotocol.com/ied/32/2172_2.png) [@ied](https://forums.minaprotocol.com/u/ied)\
**Post date:** [October 7, 2024, 9:35pm UTC](https://forums.minaprotocol.com/t/drm-mina-unity-games/6381/10 "2024-10-07T21:35:34Z")

</div>

It will be an interesting project, and I’m eagerly looking forward to the developments

---

<div class="post-metadata">

**Author:** ![kadirchan](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.minaprotocol.com/kadirchan/32/2008_2.png) [@kadirchan](https://forums.minaprotocol.com/u/kadirchan)\
**Post date:** [October 26, 2024, 11:33am UTC](https://forums.minaprotocol.com/t/drm-mina-unity-games/6381/11 "2024-10-26T11:33:45Z")

</div>

Current status of DRM Mina:

- New o1js version for offchainState api released on oct 15, upgraded contracts to new version and deployed to devnet.
- Re-organized backend as 3 main container:

1. **API Server** for off-chain components.
2. **Sequencer** for bundling and creating session txs for gamers.
3. **Settlement** for listening and creating settlement proofs regularly for offchainState Actions.

- Created bundled session proofs to reduce sequencer maintenance costs.
- Implemented action & event listener for Unity Package.
- Integrated buy game & register device to front-end and other on-chain listeners to provide real time data on UI.
- Comment Section added in game pages, every user can create comment and rate games!

---

<div class="post-metadata">

**Author:** ![kadirchan](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.minaprotocol.com/kadirchan/32/2008_2.png) [@kadirchan](https://forums.minaprotocol.com/u/kadirchan)\
**Post date:** [November 8, 2024, 1:26pm UTC](https://forums.minaprotocol.com/t/drm-mina-unity-games/6381/12 "2024-11-08T13:26:34Z")

</div>

## Updating current status of DRM Mina:

- New version of website is [live](https://drmmina.com)! ( Downloadable contents are not updated yet make sure you cloned apps from [DRM-Mina](https://github.com/DRM-Mina) github )
- Sequencer and Settlement services are finally running on Devnet. Players can submit their sessions without giving tx fee through Sequencer and Settlement service makes sure all valid actions are reduced and everything is up to date 🤩.
- DRM Unity package is updated (not released yet). Now it sends proofs to sequencer with using local nodejs prover and directly listens emitted events through Mina Archive nodes.
- Many not directly mentioned infra and uptime improvements in backend services.
- More improvements on website responsiveness and speed.

#### Known Issues

- OffchainState API seems to fragile and gives error when right after reducing actions, and sometime docker instance need to restarted.

---

<div class="post-metadata">

**Author:** ![kadirchan](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.minaprotocol.com/kadirchan/32/2008_2.png) [@kadirchan](https://forums.minaprotocol.com/u/kadirchan)\
**Post date:** [November 21, 2024, 11:34pm UTC](https://forums.minaprotocol.com/t/drm-mina-unity-games/6381/13 "2024-11-21T23:34:19Z")

</div>

## Last update before delivery of DRM Mina

- More UI/UX improvements in website, downloadables are now available for MacOS (Windows and Linux coming by the end of this week)
- Added DRM Mina fee to (currently 5% from each sale) GameToken Contract, and some improvements on contracts.
- Sequencer and Settlement services tested on Devnet. They are available for 3 games of DRM Mina.
- DRM Mina Unity package [released](https://www.drmmina.com/downloads) also waiting to be added to the Unity Asset Store.
- Integrated DRM package into 3 games (It was easier than I thought) there have also been improvements for game time and gameplay to the games.
- Added game deployment and publisher dashboard to the [website](https://www.drmmina.com/register).
- Updated desktop client and released.
- More improvements in [Docs](https://docs.drmmina.com) and more in the way.

Release soon!

---

<div class="post-metadata">

**Author:** ![ied](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.minaprotocol.com/ied/32/2172_2.png) [@ied](https://forums.minaprotocol.com/u/ied)\
**Post date:** [November 23, 2024, 8:53am UTC](https://forums.minaprotocol.com/t/drm-mina-unity-games/6381/14 "2024-11-23T08:53:57Z")

</div>

The website looks nice. Apart from the games, do you plan on selling in-game items, boosts, etc.? These can be purchased as NFT.

---

<div class="post-metadata">

**Author:** ![kadirchan](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.minaprotocol.com/kadirchan/32/2008_2.png) [@kadirchan](https://forums.minaprotocol.com/u/kadirchan)\
**Post date:** [November 24, 2024, 11:44am UTC](https://forums.minaprotocol.com/t/drm-mina-unity-games/6381/15 "2024-11-24T11:44:21Z")

</div>

Thanks İzzet, I’m so glad you like that. Yes, it is possible to integrate these ways of monetization in the future, we can add DLCs to the list. But we need to consider if this approach would cause discomfort to the players. Because main goal of this project is provide a comfortable environment that game developers and gamers especially in indie games where they can feel this marketplace belong to them

---

<div class="post-metadata">

**Author:** ![kadirchan](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.minaprotocol.com/kadirchan/32/2008_2.png) [@kadirchan](https://forums.minaprotocol.com/u/kadirchan)\
**Post date:** [December 2, 2024, 8:29pm UTC](https://forums.minaprotocol.com/t/drm-mina-unity-games/6381/16 "2024-12-02T20:29:15Z")

</div>

## DRM Mina Successfully Delivered

After 3 months of hard work, I am happy to announce that [DRM Mina](https://www.drmmina.com) is now available for Devnet. Here’s what we have delivered:

### GameToken and DRM Smart Contracts & Tests

The contracts and zkPrograms to be used were implemented, necessary unit and e2e tests were performed.

- [GameToken Contract](https://github.com/DRM-Mina/drm-mina-web-client/blob/caf655320d9cad08da34f0a9212bb1077a8a1324/contracts/src/GameToken.ts)
- [DRM Contract](https://github.com/DRM-Mina/drm-mina-web-client/blob/caf655320d9cad08da34f0a9212bb1077a8a1324/contracts/src/DRM.ts)
- [Tests](https://github.com/DRM-Mina/drm-mina-web-client/tree/main/contracts/src/test)

### Sequencer & Settlement Services

DRM Mina uses the offchainState API for registered device and session data, and the verification system is based on users updating the required state on the offchain state with the proofs they generate on their devices. However, in this case, a transaction must be sent before each game. For this reason DRM Mina provides sequencer services to prevent users from paying tx fees for each game session. A separate sequencer for each game is necessary to minimize delays. These sequencers collect Session Proofs from the players and send them in bundles to Mina L1.

The Settlement service regularly monitors new blocks, generates Settlement Proofs for unsettled offchainState actions and sends them to Mina.

[Docs for Sequencer & Settlement](https://docs.drmmina.com/sequencer-and-settlement)

### DRM Mina Unity Package

The DRM Mina Unity Package allows game developers to integrate Mina-based DRM protection into their Unity games. The package provides device identification scripts, local prover communication, and Mina blockchain communication scripts out of the box.

[Download Package](https://www.drmmina.com/downloads)  
[How to use it](https://docs.drmmina.com/unityPackage)

### DRM Mina Website

[drmmina.com](http://drmmina.com) is now fully functional and live. Through this website users can purchase games, register their devices (desktop client required), download the necessary applications, including game files. There is also a dashboard for game developers to deploy and update their own contracts.

### Docs

Reading documentation is often unpopular (video explanations will hopefully be coming soon) but it is still one of the best ways to learn the system. [DRM Mina Documentation](https://docs.drmmina.com) is available to users and will continue to improve.

### Unity Games for 3 Platform

DRM Mina has 3 games for early adopters to try out the system and provide feedback. For now, users can play these games on 3 main platforms (Windows, MacOS and Linux). In order to play the games, the device must be registered and the local prover must be running on the device before the game is launched.

As we are in the early testing phase, your device may not yet be supported by the DRM Mina Authentication and we welcome your feedback so that we can fix this as soon as possible.

If you are a game developer and would like to publish your game on DRM Mina, please contact us, we would be happy to welcome new game developers.

### Future Plans

DRM Mina currently uses the offchainState API, which is still an experimental feature and is not recommended for release to the Mainnet until a stable release is available. We are communicating with o1Labs about the issues we are facing during the development phase and are waiting for the offchainState API to be ready for the Mainnet so that we can release DRM Mina to the Mainnet.

Also changes to the architecture or operation may be made based on feedback from users.

#### Known Issues

As described in [offChain State does not update internal state · Issue #1935 · o1-labs/o1js · GitHub](https://github.com/o1-labs/o1js/issues/1935) our sequencers stuck after sending bundled proofs and needs to restarted but o1Labs team will solve this soon.
