This repository contains a working Cosmos SDK chain that implements a checkers game module. It uses minimal modules and serves as a starting point for building your own chain with game functionality.
Minid
is built with the latest version of Cosmos-SDK and includes:
- Basic chain functionality
- Checkers game module
- Account management
- Token handling (mini tokens)
- Go 1.21 or later (installation guide)
- Configure your environment:
export PATH="$PATH:/usr/local/go/bin:$(/usr/local/go/bin/go env GOPATH)/bin"
- Clone and build the chain:
git clone https://github.com/cybertronprime/chain-minimal.git
cd chain-minimal
make install # Install the minid binary
make init # Initialize the chain
- Start the chain:
minid start --minimum-gas-prices="0mini"
minid tx checkers create-game <game-id> \
<black-player-address> \
<red-player-address> \
--from <creator-address> \
--gas auto \
--gas-prices 0mini \
--chain-id demo \
--yes
Example:
minid tx checkers create-game myGame1 \
mini1dyr9fktej5af9mq3vdwv76uy9dvptkaxqnqm24 \
mini10gl9v6utc7hz6dflasdaw3d29z9368ynphh683 \
--from alice --yes
minid query checkers get-game <game-id>
Example:
minid query checkers get-game myGame1
Example output:
Game:
black: mini1dyr9fktej5af9mq3vdwv76uy9dvptkaxqnqm24
board: '*b*b*b*b|b*b*b*b*|*b*b*b*b|********|********|r*r*r*r*|*r*r*r*r|r*r*r*r*'
red: mini10gl9v6utc7hz6dflasdaw3d29z9368ynphh683
turn: b
To export the current state of the chain:
minid export
This will output the entire chain state including:
- Account balances
- Game states
- Validator information
- Module parameters
After initialization, two accounts are created:
- Alice (with 10,000,000 mini tokens)
- Bob (with 1,000 mini tokens)
Keep the generated mnemonics safe - they are required to recover these accounts.
-
If
minid
is not found after installation:- Verify your
$PATH
configuration - Run
which minid
to check the installation - Try re-running
make install
- Verify your
-
If you get a gas price error:
- Always include
--gas-prices
in your transactions - Or set minimum gas prices in ~/.minid/config/app.toml
- Always include
-
If a game query returns empty:
- Verify the game ID is correct
- Ensure the transaction to create the game was successful
- Check the chain is running and synced
The chain includes several key components:
- Custom checkers module
- Cosmos SDK core modules (auth, bank, staking)
- Minimal dependency set for optimal performance
To run all tests in the chain:
To run specific module tests (e.g., checkers module):
go test ./x/checkers/... -v
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the terms of the MIT license.