Skip to main content

Crafting System

Convert gameplay materials into permanent on-chain NFTs via blending recipes and upgrades.


Purpose

The crafting system transforms ephemeral gameplay resources into permanent, tradeable on-chain assets. It exists because:

  • Gameplay generates materials that have no value if they remain off-chain
  • Crafting creates a meaningful THC sink (economic demand)
  • Permanent items create ownership stakes that improve retention
  • Blending recipes allow game designers to control item scarcity
  • Upgrades create a progressive investment loop

Design Philosophy

OFF-CHAIN                           ON-CHAIN
(gameplay creates) (crafting finalizes)

⚔️ Win matches
→ earn materials
→ accumulate resources
🔨 Craft recipe submitted
→ materials + THC consumed
→ NFT minted
→ asset tradeable

Only the output goes on-chain. The per-match material accumulation, inventory management, and resource tracking are all off-chain. The crafting action — which consumes resources and creates a permanent item — is the economic event that justifies an on-chain transaction.


Components

┌──────────────────────────────────────────────────────────┐
│ CRAFTING SYSTEM │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌───────────────┐ │
│ │ Recipes │ │ Blending │ │ Upgrades │ │
│ │ │ │ │ │ │ │
│ │ • input list │ │ • multi-NFT │ │ • level up │ │
│ │ • THC cost │ │ combine │ │ • stat boost │ │
│ │ • output NFT │ │ • rarity │ │ • evolution │ │
│ │ • success % │ │ upgrade │ │ • THC cost │ │
│ └──────────────┘ └──────────────┘ └───────────────┘ │
│ │
└──────────────────────────────────────────────────────────┘

Recipes

A recipe defines:

FieldTypeDescription
recipe_iduint256Unique recipe identifier
inputsMaterial[]Required materials and quantities
thc_costuint256THC consumed on craft
outputNFT definitionWhat is minted on success
success_rateuint8 (0-100)Probability of success (100 = guaranteed)
cooldownuint256Minimum time between crafts (optional)
activeboolWhether this recipe is currently usable

Example Recipes

[
{
recipe_id: 1,
name: "Smoke Blade",
inputs: [
{ material: "shadow_ore", quantity: 5 },
{ material: "fire_essence", quantity: 3 }
],
thc_cost: 500,
output: {
collection: "weapons",
template: "smoke_blade",
rarity: "rare"
},
success_rate: 100,
cooldown: 0
},
{
recipe_id: 2,
name: "Legendary Smoke Blade",
inputs: [
{ material: "smoke_blade_nft", quantity: 1 }, // NFT input
{ material: "dragon_scale", quantity: 10 },
{ material: "ancient_crystal", quantity: 1 }
],
thc_cost: 5000,
output: {
collection: "weapons",
template: "legendary_smoke_blade",
rarity: "legendary"
},
success_rate: 50, // 50% chance
cooldown: 86400 // 24 hour cooldown on retry
}
]

Blending

Blending combines multiple existing NFTs into a new, higher-tier NFT.

Flow

Player holds NFT A + NFT B + NFT C


Player submits blend request


Server verifies:
• player owns all input NFTs
• recipe exists and is active
• player has enough THC


Input NFTs burned (or locked)
THC deducted


If success_rate check passes:
→ Output NFT minted to player

If success_rate check fails:
→ Inputs consumed (no output)
→ Optional: partial refund or consolation item

Blend Types

TypeInputsOutput
Same-type fusion3x Common Card1x Uncommon Card
Cross-type fusionWeapon + ArmorEnhanced Set Piece
Material + NFTNFT + MaterialsUpgraded NFT
Sacrifice blend5x Any NFTRandom higher-rarity NFT

Upgrades

Upgrades improve an existing NFT's attributes without changing its identity.

Flow

Player owns NFT (Level 1)


Player submits upgrade request:
- target NFT
- upgrade type (e.g., "attack_boost")
- materials + THC payment


Contract verifies ownership and requirements


Materials consumed, THC deducted


NFT metadata updated:
- level: 1 → 2
- attack: 85 → 95
- upgrade_count: 0 → 1

Upgrade Limits

ParameterPurposeExample
max_levelCap on total upgrades10
cost_scalingHow THC cost increases per level1.5x per level
material_scalingHow material requirements increase+2 per level
cooldown_per_levelWait time between upgrades at higher levels1 hour × level

Cost Scaling Example

LevelTHC CostMaterials Required
1→21002 shadow_ore
2→31504 shadow_ore
3→42256 shadow_ore + 1 fire_ess
4→53378 shadow_ore + 2 fire_ess
...1.5x+2 per level

On-Chain vs Off-Chain Split

ComponentLocationReason
Material accumulationOff-chainHigh frequency, no economic finality
Inventory managementOff-chainGame state, updated per match
Recipe definitionsOff-chainGame design data, frequently tuned
Craft/blend executionOn-chainTHC consumed, NFT minted — economic event
Upgrade executionOn-chainTHC consumed, metadata changed — economic event
Failed craftsOn-chainTHC still consumed, must be recorded

Contract Interface

interface ICrafting {
// Craft an item from materials + THC
function craft(
uint256 recipeId,
uint256[] calldata inputTokenIds, // NFT inputs (if any)
uint256 nonce,
bytes calldata serverSignature // server attests material balance
) external returns (uint256 outputTokenId);

// Upgrade an existing NFT
function upgrade(
uint256 tokenId,
uint256 upgradeTypeId,
uint256 nonce,
bytes calldata serverSignature
) external returns (bool success);

// Blend multiple NFTs
function blend(
uint256 recipeId,
uint256[] calldata inputTokenIds,
uint256 nonce,
bytes calldata serverSignature
) external returns (uint256 outputTokenId);

// View
function getRecipe(uint256 recipeId) external view returns (Recipe memory);
function getUpgradeHistory(uint256 tokenId) external view returns (Upgrade[] memory);
}

Why server signatures? The server tracks off-chain materials. The contract cannot verify material balances directly. The server's signature attests that the player holds sufficient materials, and the contract trusts the authorized server key.


THC Sink Analysis

Crafting is a primary THC sink in the Monsuta Core economy:

ActionTHC ConsumedFrequencyAggregate Impact
Basic crafting100–500Several/dayMedium
Legendary crafting1000–5000WeeklyHigh
Upgrades (low)50–200DailyMedium
Upgrades (high)500–2000WeeklyHigh
Failed craftsFull costPer attemptActs as extra sink

The game designer controls inflation by tuning:

  • Recipe THC costs
  • Success rates (lower rate = more THC consumed per output)
  • Upgrade cost scaling

Integration Guide for Other Games

Step 1: Define Your Crafting Economy

  • What materials does your game produce?
  • What items can players craft?
  • What is the currency cost per craft?
  • Do you want probabilistic crafting (success rates)?

Step 2: Design Recipes

  • Map inputs (materials, NFTs, currency) to outputs (new NFTs)
  • Set THC costs that balance your mint/consumption rate
  • Define rarity tiers and upgrade paths

Step 3: Deploy Crafting Contract

  • Register recipes on-chain
  • Set the authorized server key
  • Connect to your ERC-20 token contract for THC deduction
  • Connect to your ERC-721/1155 contract for NFT minting

Step 4: Integrate with Game Server

  • Track material accumulation off-chain
  • Generate server signatures when crafting criteria are met
  • Either: player submits craft tx (player pays gas) or server submits (server pays gas)

Step 5: Balance and Iterate

  • Monitor THC consumption rates from crafting
  • Adjust recipe costs and success rates
  • Introduce new recipes each season to maintain sink demand