Cycle

The Scriptorium

Smart Assembly code templates and tools for on-chain development in Eve Frontier.

SA Fundamentals
BeginnerChapter 2 of 515 min read

MUD Framework Basics

Eve Frontier's Smart Assembly system is built on MUD — an open-source framework for building on-chain applications. Understanding MUD is the foundation for all Smart Assembly development.

Core Concepts

World

The World is the top-level container. Eve Frontier runs a single World contract that holds all game state. Every Smart Assembly, player, and resource exists within this World.

Systems

Systems are the logic layer. They're Solidity contracts that read and write state. A System is like a function — it takes input, processes it, and modifies tables.
solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

import { System } from "@latticexyz/world/src/System.sol";
import { Counter } from "../codegen/tables/Counter.sol";

contract IncrementSystem is System {
  function increment() public returns (uint32) {
    uint32 counter = Counter.get();
    uint32 newValue = counter + 1;
    Counter.set(newValue);
    return newValue;
  }
}

Tables

Tables are the storage layer. They define structured on-chain data with typed columns. MUD generates Solidity libraries for reading and writing each table.
solidity
// mud.config.ts — Table definition
export default mudConfig({
  tables: {
    Counter: {
      keySchema: {},
      valueSchema: {
        value: "uint32",
      },
    },
  },
});

How MUD Differs From Standard Solidity

FeatureStandard SolidityMUD
StorageContract state variablesTyped tables
LogicContract functionsSystems
UpgradesProxy patternsNamespace permissions
EventsCustom eventsAuto-generated from tables

Setting Up Your Environment

To develop Smart Assemblies locally, you'll need:

  • Node.js (v18+) and pnpm
  • Foundry for Solidity compilation and testing
  • The MUD CLI (pnpm create mud)
  • Docker for running a local chain (optional)
  • bash
    # Install Foundry
    curl -L https://foundry.paradigm.xyz | bash
    foundryup
    
    # Create a new MUD project
    pnpm create mud my-smart-assembly
    cd my-smart-assembly
    pnpm install

    In the next chapter, we'll write our first system from scratch.

    Sign in to track your progress.