Skip to main content

Dubhe CLI for Sui

Before getting started with Dubhe CLI, please install the required dependencies:
Note: @0xobelisk/sui-common contains essential configuration type definitions like DubheConfig.

The Dubhe CLI

The Dubhe CLI is a development toolkit for building and managing Dubhe projects on the Sui blockchain. Core features:
  1. schemagen: Generate Dubhe schemas automatically from your store schemas configuration
  2. publish: Deploy your Dubhe projects to any Sui network (mainnet/testnet/devnet/localnet)
  3. upgrade: Upgrade your Dubhe Move contracts
  4. node: Manage local Sui node for development
  5. faucet: Interface with Sui faucets to fund addresses on testnet/devnet/localnet
  6. generate-key: Generate a new account key pair and save it to a .env file
  7. check-balance: Check the balance of the account
  8. config-store: Store configuration for the Dubhe project
  9. build: Build Dubhe Move contracts
  10. test: Run tests for Dubhe contracts
  11. doctor: Check development environment and install required tools
  12. wait: Wait for services to be ready
  13. watch: Watch configuration file for changes
  14. switch-env: Switch between different network environments
  15. convert-json: Convert Dubhe config to JSON format
  16. load-metadata: Load package metadata
  17. info: Display account and network information

Installation

The CLI should be installed as a project dependency rather than globally. When you create a new project using pnpm create dubhe, the CLI is automatically added as a dev dependency.

Using the CLI

Some commands expect a dubhe config in the same folder where the CLI is being executed. This includes schemagen and publish. faucet and node can be executed anywhere.

Commands

schemagen

Generate Store libraries from a dubhe.config.ts file. See the Store Config and schemagen documentation in the Store section for more details.

publish

Deploy Dubhe contracts to Sui network. This tool will use the dubhe.config.ts to detect all systems and schemas to deploy them to the specified network. Before deploying the contract, please ensure:
  1. You have sufficient tokens in your account for deployment fees
  2. For testnet/devnet/localnet deployments, you can get test tokens via dubhe faucet
  3. For localnet deployments, ensure your local node is running

upgrade

Upgrade deployed Dubhe contracts.

node

Manage local Sui node using the official sui binary.
Local RPC endpoint: http://127.0.0.1:9000 Note: Make sure your local node is running properly before using other commands that require a local node (e.g., dubhe publish --network localnet).

faucet

Request test tokens from the Sui faucet. The default faucet service automatically gives test tokens to accounts in .env.

generate-key

Generate new account keypair.

check-balance

Check account balance on specified network.

config-store

Store configuration for the Dubhe project.

build

Build your Dubhe Move contracts.

test

Run tests for Dubhe contracts.

doctor

Check development environment and install required tools automatically.
The doctor command checks for:
  • Node.js version compatibility
  • Docker service availability
  • Required development tools (sui, postgres, etc.)
  • Port availability for local services
  • Network connectivity

wait

Wait for service(s) to be ready before proceeding.
Examples:
  1. Wait for a specific service:
  1. Wait for all localnet services:

watch

Watch configuration file for changes and automatically run schemagen.
This command monitors dubhe.config.ts for changes and automatically runs dubhe schemagen when the file is modified.

switch-env

Switch between different network environments.

convert-json

Convert Dubhe configuration to JSON format.

load-metadata

Load package metadata for a deployed contract.

info

Display account and network information.
This command shows:
  • Current network
  • Account address
  • Account balance

Environment Setup

Some commands require environment variables to be set:
  • PRIVATE_KEY: Required for deployment and some other operations
  • Can be set up using a .env file in your project root
When using the deployer, you must set the private key of the deployer using the PRIVATE_KEY environment variable. You can make this easier by using dotenv before running commands.

Network Support

The CLI supports the following networks:
  • Mainnet
  • Testnet
  • Devnet
  • Localnet
For testnet/devnet/localnet operations, you can get test tokens using the faucet command.