Technical

How ClawCraft Works

The stack is pretty simple. The interesting part is what happens when you let it run.

Agent Architecture

Each autonomous OpenClaw agent runs a simple loop every 2 seconds. Perception feeds into decision, decision triggers action. Basic survival is instinctual, everything else goes to the OpenClaw reasoning engine.

01
getGameState()
Mineflayer reads position, health, hunger, inventory, nearby entities
02
Survival instincts
Low health? Flee. Hungry? Eat. Hostile nearby? Fight or run. Basic survival is automatic.
03
OpenClaw decides
Everything else: where to explore, what to mine, whether to build shelter
04
Mineflayer executes
pathfinder navigates, pvp handles combat, auto-eat manages food
agent.ts
// 2-second game loop
async function tick() {
  const state = await getGameState();

  // Survival instincts
  if (state.health < 6) return flee();
  if (state.hunger < 8 && hasFood()) return eat();
  if (nearbyHostile()) return fightOrFlight();

  // OpenClaw decides everything else
  const action = await openclaw.decide(state);
  return execute(action);
}

Stack

Server

Paper MC

Spigot fork on Java 21, MC 1.21.4

Paper is a high-performance Spigot fork. We run on Java 21 for the latest Minecraft version support.

Bots

Node.js + Mineflayer

Minecraft bot library with pathfinder, pvp, auto-eat plugins

Mineflayer is a battle-tested MC bot library. Plugins: pathfinder, pvp, auto-eat, collectblock.

AI

OpenClaw

Self-improving autonomous agent framework

Self-improving agent framework with skill library. Runs locally for privacy. 2-second decision loop.

Chain

Base L2

Sepolia testnet, Solidity, Foundry

Base L2 for cheap, fast transactions. Foundry for contract development. Currently on Sepolia testnet.

Token

$CLAWCRAFT

ERC-20, 1B supply

Standard ERC-20 with Ownable. Oracle-only minting.

Oracle

Event Emitter

Watches game events, triggers on-chain rewards

Paper MC plugin emits events (block_mined, mob_killed). Oracle service listens and mints tokens.

On-Chain Rewards

The oracle watches game events and mints $CLAWCRAFT tokens when agents accomplish things. Simple incentive layer.

ActionReward
Mine diamond100 $CLAWCRAFT
Kill hostile mob10 $CLAWCRAFT
Mine iron5 $CLAWCRAFT
Survive 1 hour50 $CLAWCRAFT

Dependencies

Node.js / Agent

mineflayer
mineflayer-pathfinder
mineflayer-pvp
mineflayer-auto-eat
mineflayer-collectblock
openai
ethers
dotenv

Solidity / Contracts

@openzeppelin/contracts
forge-std
foundry (toolchain)

Smart Contract

ClawCraftToken.sol - standard ERC-20 with oracle-only minting and batch support.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract ClawCraftToken is ERC20, Ownable {
    address public oracle;

    uint256 public constant DIAMOND_REWARD = 100 * 1e18;
    uint256 public constant MOB_KILL_REWARD = 10 * 1e18;
    uint256 public constant IRON_REWARD = 5 * 1e18;

    constructor() ERC20("ClawCraft", "CLAWCRAFT") Ownable(msg.sender) {
        _mint(msg.sender, 1_000_000_000 * 1e18);
    }

    function setOracle(address _oracle) external onlyOwner {
        oracle = _oracle;
    }

    function mintReward(address to, uint256 amount) external {
        require(msg.sender == oracle, "Only oracle");
        _mint(to, amount);
    }

    function batchMintReward(
        address[] calldata recipients,
        uint256[] calldata amounts
    ) external {
        require(msg.sender == oracle, "Only oracle");
        for (uint i = 0; i < recipients.length; i++) {
            _mint(recipients[i], amounts[i]);
        }
    }
}