# Lattice MUD
## Metadata
**Status**:: #x
**Zettel**:: #zettel/fleeting
**Source**:: #from/browser
**URL**:: [mud.dev](https://mud.dev/)
**Host**:: [[mud.dev]]
**Created**:: [[2023-09-05]]
**Tags**:: #blockchain #game-server
## Synopsis
MUD – a framework for ambitious Ethereum applications.
## Architecture
1. **Store**: An [onchain database](https://mud.dev/store). No more bespoke data modeling for each app and gas-golfing events.
2. **World**: An [entry-point kernel](https://mud.dev/world) that brings standardized access-control, upgrades, and modules.
3. Blazing fast development tools based on [Foundry(opens in a new tab)](https://github.com/foundry-rs/foundry)
4. Client-side data-stores that magically reflect onchain state. No need to use view functions and events to get your contract data.
5. **MODE**: A Postgres database you can query with SQL that reflects your onchain state 1 to 1. Never write an indexer again.
### Storage
- Schema and serialization
- Primary key is entity ID, which is derived from user key.
- Indexing
- Store exposes table hooks to make derived state less error-prone and more maintainable: logic can be registered — even at runtime — to run when records or fields of records are updated within a specific table. Store uses this strategy to expose simple onchain indices to developers, but it is also possible to design custom indexers with that pattern (Quad Trees, B-Trees, etc).
- Events
- When a record or a single field is edited, or when a record is deleted, Store emits a standard event with enough information for off-chain actors to reconstruct the new version of the Store with event-sourcing.
```
event StoreSetRecord(uint256 tableId, bytes32[] key, bytes data);
event StoreSetField(uint256 tableId, bytes32[] key, uint8 schemaIndex, bytes data);
event StoreDeleteRecord(uint256 tableId, bytes32[] key);
```
- Schemas are stored in the dedicated table.
### World
- World contains Namespaces, Tables (Components), and Systems.
- **Access control:** resources in a namespace have “write” access to the other resources within their namespace.
## Articles
- [[Ludens on Lattice et al. - MUD An Engine for Autonomous Worlds (Highlights)]]
- [[Kaspar Chen - 全链上游戏3 - 意志的传承之 MUD and Dojo (Highlights)]]