- Generate and verify a Move smart contract for the game logic.
- Deploy the contract to your live appchain.
- Scaffold and connect a React frontend for players to interact with the game.
- Verify the on-chain functionality.
Your Project Structure
The following steps will instruct your AI agent to create these directories inside yourmy-initia-project folder:
Project Structure
Prerequisite: Ensure you have a Move-compatible appchain running
locally. If you haven’t launched one yet, complete the
Step-by-Step Guide first.
Readiness Check
Before you start, verify that your local infrastructure is healthy. Prompt:Step 1: Create and Unit Test the Smart Contract
Instead of writing the code yourself, instruct your AI agent to do it for you using theinitia-appchain-dev skill. Your AI agent will generate the contract
and automatically run unit tests to ensure the logic is sound.
Example Prompt:
blockforge project, including the
items.move module and a test script, and confirm that everything passes.
Manual Approach: The Move Module
Manual Approach: The Move Module
If you prefer to create the Move module and project manually, follow these steps in your Now, update the Next, create Add the following unit tests inside the same Once the files are created, verify everything is correct by building and testing
the project. Replace If the build succeeds and the tests pass, BlockForge is ready to deploy.
blockforge directory. This is what your AI agent would generate for you.First, create a new Move package named blockforge:Create Move Package
Move.toml file to use the Initia stdlib dependency directly.
Replace the content of blockforge/Move.toml with the following:Move.toml
blockforge/sources/items.move with the following content.sources/items.move
module blockforge::items { ... }
block, immediately before the final closing } of items.move, so you can
verify minting, crafting, and the insufficient-shards failure path:Unit Tests
<YOUR_HEX_ADDRESS_WITH_0X_PREFIX> with your deployment
address hex (0x...).Build Move Package
Step 2: Deploy to your Appchain
Now that the logic is verified, build and publish the contract to your live appchain using the Gas Station account. Prompt:Manual Approach: Deploy via CLI
Manual Approach: Deploy via CLI
First, get your Gas Station address and convert it to hex:Then, build and publish the compiled module to your appchain. Substitute
Get Gas Station Hex Address
<YOUR_HEX_ADDRESS_WITH_0X_PREFIX> with 0x + the bytes value from
the previous command.Publish Move Module
Move modules do not have a separate instantiate transaction. For this
tutorial, the first gameplay call (for example
mint_shard) initializes
per-player inventory state on demand.Step 3: Smoke Test the Deployed Contract On-Chain
Before frontend work, smoke test the deployed module directly on chain. This keeps contract/module debugging separate from UI integration. Example Prompt:Manual Approach: On-Chain Interaction
Manual Approach: On-Chain Interaction
Here are the equivalent
minitiad commands to interact with the module.Mint 3 Shards
Query Inventory
Craft Relic
Query Inventory Again
Step 4: Create a Frontend
A game needs a user interface. Let’s create one using theinitia-appchain-dev
skill.
1. Scaffold the Frontend:
Manual Approach: Scaffold and Connect
Manual Approach: Scaffold and Connect
If you prefer to set up the frontend manually, follow these steps:1. Create the Project and Install Dependencies:Create a new Vite + React app and install the dependencies used by the working
BlockForge frontend:Then update 2. Gather Runtime Values for Frontend Config:Collect the values you will use for frontend configuration:3. Create 4. Set up Providers in 5. Add the Game Component:Then create Render
Create Frontend Project
vite.config.js so browser builds have the required Node polyfills:vite.config.js
Gather Frontend Values
.env from Runtime Values:Create Frontend Env
main.jsx:Wrap your application with InterwovenKitProvider to enable wallet
connectivity. Ensure the customChain includes fee_tokens, staking, and
bech32_prefix.main.jsx
src/Game.jsx:Game.jsx
<Game /> from src/App.jsx.Step 5: Wallet Funding and UI Verification
Ask your AI agent to fund your browser wallet, then verify frontend behavior manually in the browser:- Start the frontend:
Start Vite Dev Server
- Open your browser wallet and copy your address (
init1...). - Give this prompt to your AI agent, replacing
<YOUR_WALLET_ADDRESS>with the address you just copied:
- Connect your wallet in
blockforge-frontend. - Test the gameplay flow by minting shards, crafting a relic, and confirming the displayed inventory state updates correctly after each action.
⚡ Power-Up: Auto-signing
To make your BlockForge game natively integrated with the Initia stack, you can enable Auto-signing to create a frictionless experience where players don’t see wallet popups for every game action. Auto-signing works by deriving a unique, application-specificGhost Wallet
from a one-time signature. Your primary wallet then grants this Ghost Wallet
permission (Authz) to execute specific functions and use its balance for
fees (Feegrant), allowing for seamless, session-based gameplay.
Step 6: Update the Frontend
You can enable session-based signing by modifying your provider configuration and adding a toggle in your UI. Example Prompt:Manual Approach: Auto-signing Logic
Manual Approach: Auto-signing Logic
First, enable the feature in your provider:Then, use the
main.jsx
useInterwovenKit hook in your component to manage the session:Game.jsx
Manual Approach: Final Frontend Reference
Manual Approach: Final Frontend Reference
If you want a single copyable end-state after completing the manual steps
above, use this consolidated reference. It combines:src/main.jsxsrc/App.jsxsrc/Game.jsxThis reference assumes:
- runtime config from
.env, - InterwovenKit provider wiring in
main.jsx, - wallet connect/display in
App.jsx, and - live Move inventory, actions, and auto-sign toggle flow in
Game.jsx.
.env
src/main.jsx
src/App.jsx
src/Game.jsx
- your module owner is stored in
.envas bech32, moduleAddressinMsgExecuteuses that bech32 value,- inventory reads use
rest.move.resourcewith a hex struct tag.
Power-Up Verification
- Connect your wallet in
blockforge-frontend. - Enable Auto-sign and approve the one-time Auto-sign setup.
- Click
Mint Shardand confirm the transaction completes without a new wallet signature prompt. - Disable Auto-sign.
- Click
Mint Shardagain and confirm a wallet signature prompt is required.