# Decentralized Operations

## Overview

Decentralization is one of the most important security features of MemeDice. By transferring game ownership to **the burn address (`0x0000...0000`)**, the game will become a **fully autonomous smart contract**with no one able to perform administrative actions.

> ⚠️ **This is an irreversible operation!** Once decentralized, administrative privileges can never be restored.

***

## Why decentralize?

### Benefits for players

| Benefits                   | Description                                                        |
| -------------------------- | ------------------------------------------------------------------ |
| **Fund security**          | No one can withdraw tokens from the pool                           |
| **Rules remain unchanged** | Parameters such as rates and betting limits will never be modified |
| **Fairness guaranteed**    | No one can shut down betting or deposits to manipulate the game    |
| **Complete trust**         | The game is fully controlled by smart contract code                |

### Benefits for shareholders

| Benefits                   | Description                                               |
| -------------------------- | --------------------------------------------------------- |
| **Share security**         | No one can remove shareholders or withdraw the pool       |
| **Rate locked**            | The owner fee rate will never be increased                |
| **Free to enter and exit** | Deposit and withdrawal functions will always be available |

### Benefits for game creators

| Benefits               | Description                                                    |
| ---------------------- | -------------------------------------------------------------- |
| **Trust building**     | Decentralization is the strongest signal of trust              |
| **Attract investment** | Shareholders are more willing to invest in decentralized games |
| **Attract players**    | Players trust decentralized games more                         |
| **Security badge**     | The game will receive a 🏛️ decentralized badge                |

***

## State after decentralization

After decentralization, the following administrative functions will be **permanently disabled**:

| Function           | Status                 |
| ------------------ | ---------------------- |
| Pool withdrawal    | ❌ Permanently disabled |
| Remove shareholder | ❌ Permanently disabled |
| Adjust fee rate    | ❌ Permanently disabled |
| Toggle betting     | ❌ Permanently disabled |
| Toggle deposits    | ❌ Permanently disabled |
| Transfer ownership | ❌ Permanently disabled |
| management panel   | ❌ No longer displayed  |

After decentralization, the following functions **continue to work normally**:

| Function               | Status   |
| ---------------------- | -------- |
| Player betting         | ✅ Normal |
| Shareholder deposit    | ✅ Normal |
| Shareholder withdrawal | ✅ Normal |
| Leaderboard            | ✅ Normal |
| on-chain logs          | ✅ Normal |
| Fairness Verification  | ✅ Normal |

***

## How to decentralize

### Prerequisites

* You must be the current owner of the game
* Wallet connected and correct network

### Steps

```mermaid
graph TD
    A[Enter management panel] --> B[Scroll to bottom]
    B --> C[Find the "Decentralization" section]
    C --> D[Click the "Decentralize" button]
    D --> E[Read the warning message]
    E --> F{Confirm action?}
    F -->|Enter CONFIRM| G[Sign transaction]
    F -->|Cancel| H[Back]
    G --> I[Wait for on-chain confirmation]
    I --> J[✅ Game decentralized]
    J --> K[Management panel disappears]
    
    style D fill:#DC2626,color:#fff
    style J fill:#059669,color:#fff
```

1. **Enter management panel**: Click the "⚙️ Management" tab in the navigation bar
2. **Find the decentralization section**: Scroll to the bottom of the management panel
3. **Click the decentralize button**: This is a red dangerous action button
4. **Read the warning**: The popup will display detailed warning information
5. **Enter CONFIRM**: Enter `CONFIRM`(uppercase) in the confirmation box
6. **Sign transaction**: Confirm the transaction in your wallet
7. **Wait for confirmation**: Wait for the on-chain transaction to be confirmed
8. **Done**: The game has been decentralized, and the management panel will no longer be shown

<figure><img src="/files/c2b7ff6213af57a6486aef6d953397e9e37884c0" alt=""><figcaption></figcaption></figure>

***

## Directly decentralize upon deployment

When deploying the game, you can also check **"Decentralized mode"**&#x69;n the advanced configuration, so the game will be decentralized immediately after deployment.

**Use cases**:

* You do not need any administrative privileges
* You want to build maximum trust from the start
* You want to create a fully autonomous game

<figure><img src="/files/4ea8e0e84959f78a356aa6324499864b2dbd81ca" alt=""><figcaption></figcaption></figure>

***

## Decentralization badge

Decentralized games will receive a special badge on the [dapp.meme](https://dapp.meme/) home page:

* 🏛️ **Decentralization** Badge: indicates the game has been fully decentralized
* Decentralized games can be filtered in the game list using filters

<figure><img src="/files/11450ab316cceca03d37771e7e7b20c69d4f1cbd" alt=""><figcaption></figcaption></figure>

***

## Technical implementation

At the smart contract level, decentralization is implemented in the following way:

```solidity
// Pseudocode
function decentralize() external onlyOwner {
    owner = address(0);  // Set owner to the zero address
    emit Decentralized();
}
```

Since all administrative functions have the `onlyOwner` modifier, and the zero address cannot initiate transactions, all administrative functions are permanently disabled.

### Why use the burn address (zero address)?

* **The burn address** is a special Ethereum address (`0x0000...0000`)
* No one owns the private key to the zero address
* The burn address cannot initiate transactions
* Therefore, setting it to the burn address is equivalent to **permanently renouncing ownership**

***

## FAQ

### Q: Can the owner fee still be charged after decentralization?

No. After decentralization, the owner fee rate remains unchanged, but since the owner is the zero address, the fees will be sent to the zero address (which is effectively equivalent to burning them). It is recommended to set the owner fee rate to 0% before decentralizing.

### Q: Will the game stop working after decentralization?

No. The game’s core functions (betting, deposits, withdrawals) are fully executed automatically by the smart contract and do not require any administrator intervention.

### Q: Can the contract still be upgraded after decentralization?

No. The MemeDice game contract does not use a proxy pattern; the code is immutable after deployment. Decentralization further ensures that no one can modify the game’s behavior through administrative privileges.

### Q: Can I run it for a while before decentralizing?

Yes. Many game creators choose to run it for a period first, confirm everything is working properly, and then decentralize. This is a recommended practice.

***

## Related links

* ⬅️ Back [Game management](/dapp.meme-en/manage-games/game-management-overview.md)
* 🔒 Learn about [Game Security](/dapp.meme-en/technical-overview/game-security.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dapp.meme/dapp.meme-en/manage-games/decentralized-operations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
