Skip to content

dojoengine/dojo-intro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dojo intro

This repository contains a (very) simple Dojo game.

The goal is to showcase how Dojo works and ease the developement for on-chain applications and games.

The game is built with 3 components:

  • contracts: The Dojo contracts deployed on Starknet.
  • client: The client application that interacts with the contracts (and read data using Torii).
  • pkg: Contains the wasm and js bindings to use Torii client (v1.5.0). This is usually abstracted by dojo.js, but here we're doing it manually for educational purposes.

Setup

To work with Dojo, a docker image with all the binaries is available on the Dojo repository.

docker pull ghcr.io/dojoengine/dojo:v1.5.0

# You will then want to use host network for development and mount the contracts directory.

Or you can use dojoup script to install the latest binaries for your OS:

curl -L https://install.dojoengine.org | bash
source ~/.bashrc
dojoup install

Or you can use asdf:

asdf plugin add dojo https://github.com/dojoengine/asdf-dojo
asdf install dojo 1.5.0
asdf set -u dojo 1.5.0

Don't forget to have also Scarb installed, using asdf being the recommended way to go:

asdf plugin add scarb
asdf install scarb 2.10.1
asdf set -u scarb 2.10.1

To run Katana, in some cases, you may need to use brew to install the following:

brew install llvm@19 --quiet

Contracts

To work on the contracts, change directory to contracts and do:

# Build the contracts.
sozo build
# Declare and deploys the contract on the configured network
sozo migrate

Client

A very simple vite project without any framework, configured to use https locally to use Cartridge controller wallet.

Heads to the client directory and do:

pnpm install
pnpm run dev

Working with Dojo toolchain

Katana is a starknet sequencer that is optimized for performance and low latency, but can also be used as a local development node.

Torii is the automatic indexer for Dojo, it will index the state of the contracts and make it available to the client.

# Start Katana
katana --config contracts/katana.toml

# Start Torii
torii --config contracts/torii_dev.toml

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published