Skip to content

sehun-cha/blue

Repository files navigation

⛴️ Blue CLI

Blue CLI Logo

A comprehensive TypeScript CLI tool for Sui blockchain development, providing interactive consoles and utilities for Move package management, SuiNS domain operations, Walrus storage, and blockchain interactions.

📋 Table of Contents

🚀 Installation

npm install -g blue-cli
# or
git clone <repository>
cd blue
npm install
npm run build
npm link

⚙️ Configuration

Blue CLI uses YAML configuration files. Create a config file with the following structure:

chain:
  network: "testnet"  # mainnet, testnet, devnet, localnet
  url: ""  # optional custom RPC URL

auth:
  sender: "0x..."  # your wallet address
  threshold: 1     # keystore threshold
  keystore: "path/to/keystore"
  password: "optional_password"

db:  # optional database configuration
  type: "postgresql"  # postgresql, mysql, sqlite
  host: "localhost"
  port: 5432
  user: "username"
  password: "password"
  name: "database_name"
  # SSH tunnel support
  sshHost: "remote.server.com"
  sshUser: "user"
  sshKey: "path/to/ssh/key"

log:
  logLevel: "info"  # silly, debug, info, warn, error
  logToFile: false
  outputDir: "./output"

Environment variables are also supported (.env.{network}.{dbtype} files):

DB_HOST=localhost
DB_PORT=5432
DB_USER=username
DB_PASSWORD=password
DB_NAME=database_name
SSH_HOST=remote.server.com
SSH_USER=user
SSH_KEY=/path/to/ssh/key

📘 Main Commands

Key Management

gen-key

Generate a new keystore with specified cryptographic scheme.

blue gen-key --scheme <scheme>

Options:

  • -s, --scheme <scheme>: Keypair scheme (required)
    • ed25519: EdDSA signature scheme (default)
    • secp256k1: ECDSA with secp256k1 curve
    • secp256r1: ECDSA with secp256r1 curve

Example:

blue gen-key --scheme ed25519

import-key

Import a private key into keystore format.

blue import-key --scheme <scheme> --threshold <threshold>

Options:

  • -s, --scheme <scheme>: Keypair scheme (required)
    • ed25519: EdDSA signature scheme
    • secp256k1: ECDSA with secp256k1 curve
    • secp256r1: ECDSA with secp256r1 curve
  • -t, --threshold <threshold>: Keystore threshold (default: 1)

check-key

Check and verify a private key with the specified address and threshold.

blue check-key --address <address> --threshold <threshold>

Options:

  • -a, --address <address>: The address of the key to check (required)
  • -t, --threshold <threshold>: The threshold of the key to check (default: 1)

export-key

Export keystore to private key format.

blue export-key [--address <address>] [--threshold <threshold>]

Options:

  • --address <address>: Address of the key to export
  • --threshold <threshold>: Threshold of the key to export

encrypt-sss

Encrypt keystore using Shamir's Secret Sharing (SSS).

blue encrypt-sss [--address <address>] [--threshold <threshold>]

Package Management

gen-pkg

Generate a new Move package template.

blue gen-pkg --name <name> [--author <author>]

Options:

  • -n, --name <name>: Package name (required)
  • -a, --author <author>: Package author (default: "blue")

publish

Publish a Move package to the blockchain.

blue publish [--config <config>] [--path <path>]

Options:

  • --config <config>: Configuration file path
  • --path <path>: Path to Move package directory

upgrade

Upgrade an existing Move package.

blue upgrade [--config <config>] [--path <path>] [--package-id <id>] [--upgrade-cap-id <id>] [--upgrade-policy <policy>]

Options:

  • --config <config>: Configuration file path
  • --path <path>: Path to Move package directory
  • --package-id <id>: ID of package to upgrade
  • --upgrade-cap-id <id>: Upgrade capability object ID
  • --upgrade-policy <policy>: Upgrade policy (default: "COMPATIBLE")

🖥️ Interactive Consoles

Base Console Commands

The following commands are available in all console modes:

System Commands

  • help, h: Display available commands
  • quit, q, exit: Exit the console
  • clear, c: Clear screen and show welcome message
  • active: Activate keystore for transaction signing

Blockchain Query Commands

obj <objectIds...>

Query blockchain objects by their IDs.

obj 0x123abc... 0x456def...
owned-obj [address] [type]

List objects owned by an address, optionally filtered by type.

owned-obj                           # your objects
owned-obj 0x123abc...              # specific address objects  
owned-obj 0x123abc... "0x2::coin::Coin<0x2::sui::SUI>"  # filtered by type
tx <digest>

Query transaction details by digest.

tx 0x789ghi...
balance [address] [coinType]

Check coin balance for an address.

balance                             # your SUI balance
balance 0x123abc...                # specific address SUI balance
balance SUI                        # your SUI balance (alternative)
balance 0x123abc... "0x2::sui::SUI"  # specific address and coin type
coins [address]

List all coins owned by an address.

coins                               # your coins
coins 0x123abc...                  # specific address coins

Transaction Building Commands

init

Initialize a new transaction builder.

init
commands

Display current transaction commands.

commands
remove <index>

Remove a command from the transaction builder.

remove 1                           # remove first command
transfer <address> <amount>

Add SUI transfer to transaction.

transfer 0x123abc... 1000000000    # transfer 1 SUI (in MIST)
transfer-obj <address> <objectIds...>

Add object transfer to transaction.

transfer-obj 0x123abc... 0x456def... 0x789ghi...
merge <destCoinId> <coinIds...>

Add coin merge operation to transaction.

merge 0x123abc... 0x456def... 0x789ghi...
merge-all <coin-type>

Merge all coins of a specific type into one coin.

merge-all 0x2::sui::SUI
merge-all "0x123abc...::my_coin::COIN"
split <coinId> <amounts...>

Add coin split operation to transaction.

split 0x123abc... 100000000 200000000 300000000

Move Function Interaction

address <packageName>

Get package ID by name from database.

address my_package
function-args <packageId> <module> <function>

Display function arguments with auto-resolution.

function-args my_package counter increment
function-args 0x123abc... counter increment
movec <packageId> <module> <function> [args...]

Add Move function call to transaction.

movec my_package counter increment
movec 0x123abc... counter increment 42 "hello"
movew <packageId> <module> <function> [args...]

Execute Move function in view mode (read-only).

movew my_package counter get_value
movew 0x123abc... counter get_value 0x456def...

Transaction Execution

write

Build, sign, and optionally execute the current transaction.

write
sign

Sign a transaction from file.

sign
# prompts for file path
send

Send a signed transaction from file.

send
# prompts for file path
publish <path>

Publish a Move package from the specified path.

publish ./my_package
exec <command> [args...]

Execute system commands.

exec ls -la
exec sui client active-address

NS Console (SuiNS)

Start the SuiNS console for domain name operations:

blue ns-console [--config <config>] [--active]

In addition to all base console commands, NS Console provides:

Domain Query Commands

record <name>

Query name record information.

record example.sui
record example              # automatically adds .sui
price

Display current registration prices.

price
renewal-price

Display renewal prices.

renewal-price
discounts

Show coin type discounts.

discounts
price-info <coinType>

Get price information for specific coin type.

price-info SUI
price-info USDC

Domain Management Commands

register <name> [years] [payType]

Register a new domain name.

register example.sui 1 sui         # 1 year, pay with SUI
register example 2 usdc            # 2 years, pay with USDC
register example                   # 1 year, pay with SUI (defaults)

Arguments:

  • name: Domain name (automatically adds .sui if not present)
  • years: Registration period 1-5 years (default: 1)
  • payType: Payment method - sui, mist, or usdc (default: sui)
renew <nftId> <years> [payType]

Renew an existing domain.

renew 0x123abc... 1 sui
renew 123abc 2 usdc                # 0x prefix optional

Arguments:

  • nftId: Domain NFT object ID
  • years: Renewal period 1-5 years
  • payType: Payment method - sui, mist, or usdc (default: sui)
set-target <nftId> <address>

Set target address for a domain.

set-target 0x123abc... 0x456def...
set-target 123abc 456def           # 0x prefix optional
set-default <name>

Set default domain for your address.

set-default example.sui
set-default example                # automatically adds .sui

Subdomain Management Commands

create-subname <parentNftId> <subname> <expirationMs> [allowChild] [allowExtension]

Create a new subdomain.

create-subname 0x123abc... sub 1735689600000 true true

Arguments:

  • parentNftId: Parent domain NFT ID
  • subname: Subdomain name
  • expirationMs: Expiration timestamp in milliseconds
  • allowChild: Allow child creation (default: true)
  • allowExtension: Allow time extension (default: true)
edit-subname <name> <parentNftId> <allowChild> <allowExtension>

Edit subdomain settings.

edit-subname sub.example.sui 0x123abc... true false
extend-subname <nftId> <expirationMs>

Extend subdomain expiration.

extend-subname 0x123abc... 1735689600000
create-leaf <parentNftId> <name> <targetAddress>

Create a leaf subdomain (no NFT, direct mapping).

create-leaf 0x123abc... leaf 0x456def...
remove-leaf <parentNftId> <name>

Remove a leaf subdomain.

remove-leaf 0x123abc... leaf

Domain Data Management

set-data <nftId> <key> <value> [isSubname]

Set metadata for a domain.

set-data 0x123abc... avatar "https://example.com/avatar.png" false
set-data 0x123abc... description "My domain" true

Arguments:

  • nftId: Domain NFT object ID
  • key: Metadata key
  • value: Metadata value
  • isSubname: Whether this is a subdomain (default: false)
burn-expired <nftId> [isSubname]

Burn an expired domain to reclaim storage.

burn-expired 0x123abc... false
burn-expired 0x123abc... true      # for subdomain

Walrus Console

Start the Walrus console for decentralized storage operations:

blue walrus-console [--config <config>] [--active]

In addition to all base console commands, Walrus Console provides:

Storage Commands

cost <filePath> <epochs>

Calculate storage cost for a file.

cost ./document.pdf 10
cost /path/to/image.jpg 5

Arguments:

  • filePath: Path to the file to calculate cost for
  • epochs: Number of epochs to store (storage duration)

Output:

  • File size and cost breakdown
  • Storage cost in MIST and WAL
  • Write cost in MIST and WAL
  • Total cost calculation
upload <filePath> <epochs>

Upload a file to Walrus storage.

upload ./document.pdf 10
upload /path/to/image.jpg 5

Arguments:

  • filePath: Path to the file to upload
  • epochs: Number of epochs to store

Interactive Prompts:

  • Confirms storage cost and asks for approval
  • Asks whether to make the blob deletable
  • Requires active keystore for signing

Output:

  • Blob ID for accessing the stored file
  • Object ID on Sui blockchain
  • Access URL for retrieving the file
  • Storage metadata (epochs, encoding, etc.)

DB Console (DeepBook)

Start the DeepBook console for DEX operations:

blue db-console [--config <config>] [--active]

In addition to all base console commands, DB Console provides:

Pool Management Commands

create-pool <baseCoinKey> <quoteCoinKey> <tickSize> <lotSize> <minSize>

Create a new trading pool on DeepBook.

create-pool SUI USDC 1000000 1000000 1000000

Arguments:

  • baseCoinKey: Base coin identifier (e.g., "SUI")
  • quoteCoinKey: Quote coin identifier (e.g., "USDC")
  • tickSize: Minimum price increment
  • lotSize: Minimum quantity increment
  • minSize: Minimum order size

🗄️ Database Support

Blue CLI supports multiple database backends for storing package and module information:

Supported Databases

  • PostgreSQL: Full-featured with SSH tunnel support
  • MySQL: Complete functionality with connection pooling
  • SQLite: Lightweight, file-based option

Database Schema

The database automatically creates tables for:

  • packages: Published Move packages
  • modules: Module definitions and ABIs
  • function_call: Function call metadata
  • function_object_arg: Function parameter information
  • indexer_objects: Object indexing for parameter resolution

SSH Tunnel Support

For remote database connections, Blue CLI supports SSH tunneling:

db:
  type: "postgresql"
  host: "localhost"
  port: 5432
  sshHost: "remote.server.com"
  sshUser: "username"
  sshKey: "/path/to/ssh/private/key"

📚 Examples

Basic Package Development Workflow

# Generate a new keystore
blue gen-key --scheme ed25519

# Import existing private key (alternative)
blue import-key --scheme ed25519 --threshold 1

# Check keystore integrity
blue check-key --address 0x123abc... --threshold 1

# Generate a new package
blue gen-pkg --name my_counter --author developer

# Start console and publish
blue console --config config.yaml --active
> publish ./my_counter
> movec my_counter counter increment
> write

SuiNS Domain Management

# Start NS console
blue ns-console --config config.yaml --active

# Check prices and register domain
> price
> register mydomain.sui 2 sui
> set-target <nft-id> 0x123abc...
> create-subname <nft-id> api 1735689600000

Walrus Storage Operations

# Start Walrus console
blue walrus-console --config config.yaml --active

# Upload file to decentralized storage
> cost ./document.pdf 10
> upload ./document.pdf 10

Advanced Transaction Building

blue console --config config.yaml

# Build complex transaction
> init
> transfer 0x123abc... 1000000000
> movec package_name module_name function_name arg1 arg2
> split 0x456def... 500000000 300000000
> commands
> write

🔧 Development

# Install dependencies
npm install

# Build the project
npm run build

# Link for development
npm link

# Run tests
npm test

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details on:

  • 🐛 Reporting bugs
  • 💡 Suggesting enhancements
  • 🔧 Submitting pull requests
  • 📝 Improving documentation

Quick Start for Contributors

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes and add tests
  4. Run tests: npm test
  5. Commit using conventional commits: git commit -m "feat: add amazing feature"
  6. Push to your fork: git push origin feature/amazing-feature
  7. Open a Pull Request

🔒 Security

If you discover a security vulnerability, please follow our Security Policy for responsible disclosure.


🇰🇷 한국어 안내서 (Korean Guide)

Blue CLI는 Sui 블록체인 개발을 위한 종합 TypeScript CLI 도구로, Move 패키지 관리, SuiNS 도메인, Walrus 스토리지, 블록체인 상호작용을 위한 다양한 콘솔과 유틸리티를 제공합니다.

📋 목차

🚀 설치

npm install -g blue-cli
# 또는
git clone <repository>
cd blue
npm install
npm run build
npm link

⚙️ 설정

Blue CLI는 YAML 설정 파일을 사용합니다. 다음과 같은 구조로 config 파일을 만드세요:

chain:
  network: "testnet"  # mainnet, testnet, devnet, localnet
  url: ""  # (선택) 커스텀 RPC URL

auth:
  sender: "0x..."  # 지갑 주소
  threshold: 1     # 키스토어 threshold
  keystore: "path/to/keystore"
  password: "optional_password"

db:  # (선택) 데이터베이스 설정
  type: "postgresql"  # postgresql, mysql, sqlite
  host: "localhost"
  port: 5432
  user: "username"
  password: "password"
  name: "database_name"
  # SSH 터널 지원
  sshHost: "remote.server.com"
  sshUser: "user"
  sshKey: "path/to/ssh/key"

log:
  logLevel: "info"  # silly, debug, info, warn, error
  logToFile: false
  outputDir: "./output"

환경 변수도 지원합니다(.env.{network}.{dbtype} 파일):

DB_HOST=localhost
DB_PORT=5432
DB_USER=username
DB_PASSWORD=password
DB_NAME=database_name
SSH_HOST=remote.server.com
SSH_USER=user
SSH_KEY=/path/to/ssh/key

📘 주요 명령어

키 관리

gen-key

지정한 암호화 방식으로 새 키스토어를 생성합니다.

blue gen-key --scheme <scheme>

옵션:

  • -s, --scheme <scheme>: 키페어 방식 (필수)
    • ed25519: EdDSA (기본값)
    • secp256k1: secp256k1 곡선 ECDSA
    • secp256r1: secp256r1 곡선 ECDSA

import-key

개인키를 키스토어 형식으로 가져옵니다.

blue import-key --scheme <scheme> --threshold <threshold>

옵션:

  • -s, --scheme <scheme>: 키페어 방식 (필수)
  • -t, --threshold <threshold>: 키스토어 threshold (기본값: 1)

check-key

지정한 주소와 threshold로 개인키를 검증합니다.

blue check-key --address <address> --threshold <threshold>

옵션:

  • -a, --address <address>: 확인할 키의 주소 (필수)
  • -t, --threshold <threshold>: threshold (기본값: 1)

export-key

키스토어를 개인키 형식으로 내보냅니다.

blue export-key [--address <address>] [--threshold <threshold>]

옵션:

  • --address <address>: 내보낼 키의 주소
  • --threshold <threshold>: 내보낼 키의 threshold

encrypt-sss

Shamir's Secret Sharing(SSS) 방식으로 키스토어를 암호화합니다.

blue encrypt-sss [--address <address>] [--threshold <threshold>]

패키지 관리

gen-pkg

새 Move 패키지 템플릿을 생성합니다.

blue gen-pkg --name <name> [--author <author>]

옵션:

  • -n, --name <name>: 패키지 이름 (필수)
  • -a, --author <author>: 패키지 작성자 (기본값: "blue")

publish

Move 패키지를 블록체인에 배포합니다.

blue publish [--config <config>] [--path <path>]

옵션:

  • --config <config>: 설정 파일 경로
  • --path <path>: Move 패키지 디렉토리 경로

upgrade

기존 Move 패키지를 업그레이드합니다.

blue upgrade [--config <config>] [--path <path>] [--package-id <id>] [--upgrade-cap-id <id>] [--upgrade-policy <policy>]

옵션:

  • --config <config>: 설정 파일 경로
  • --path <path>: Move 패키지 디렉토리 경로
  • --package-id <id>: 업그레이드할 패키지 ID
  • --upgrade-cap-id <id>: 업그레이드 권한 오브젝트 ID
  • --upgrade-policy <policy>: 업그레이드 정책 (기본값: "COMPATIBLE")

🖥️ 인터랙티브 콘솔

기본 콘솔 명령어

모든 콘솔 모드에서 사용 가능한 명령어입니다:

시스템 명령어

  • help, h: 사용 가능한 명령어 표시
  • quit, q, exit: 콘솔 종료
  • clear, c: 화면 초기화 및 환영 메시지 표시
  • active: 트랜잭션 서명을 위한 키스토어 활성화

블록체인 쿼리 명령어

obj <objectIds...>

오브젝트 ID로 블록체인 오브젝트 조회

obj 0x123abc... 0x456def...
owned-obj [address] [type]

주소가 소유한 오브젝트를 조회, 타입으로 필터링 가능

owned-obj                           # 내 오브젝트
owned-obj 0x123abc...              # 특정 주소 오브젝트
owned-obj 0x123abc... "0x2::coin::Coin<0x2::sui::SUI>"  # 타입 필터링
tx <digest>

트랜잭션 해시로 상세 정보 조회

tx 0x789ghi...
balance [address] [coinType]

주소의 코인 잔액 조회

balance                             # 내 SUI 잔액
balance 0x123abc...                # 특정 주소 SUI 잔액
balance SUI                        # 내 SUI 잔액 (대체)
balance 0x123abc... "0x2::sui::SUI"  # 특정 주소 및 코인 타입
coins [address]

주소가 소유한 모든 코인 조회

coins                               # 내 코인
coins 0x123abc...                  # 특정 주소 코인

트랜잭션 빌딩 명령어

init

새 트랜잭션 빌더 초기화

init
commands

현재 트랜잭션 명령어 표시

commands
remove <index>

트랜잭션 빌더에서 명령어 제거

remove 1                           # 첫 번째 명령어 제거
transfer <address> <amount>

SUI 전송 명령 추가

transfer 0x123abc... 1000000000    # 1 SUI 전송 (MIST 단위)
transfer-obj <address> <objectIds...>

오브젝트 전송 명령 추가

transfer-obj 0x123abc... 0x456def... 0x789ghi...
merge <destCoinId> <coinIds...>

코인 병합 명령 추가

merge 0x123abc... 0x456def... 0x789ghi...
merge-all <coin-type>

특정 코인 타입의 모든 코인을 하나로 병합

merge-all 0x2::sui::SUI
merge-all "0x123abc...::my_coin::COIN"
split <coinId> <amounts...>

코인 분할 명령 추가

split 0x123abc... 100000000 200000000 300000000

Move 함수 상호작용

address <packageName>

DB에서 패키지 이름으로 패키지 ID 조회

address my_package
function-args <packageId> <module> <function>

함수 파라미터 자동 해석 및 표시

function-args my_package counter increment
function-args 0x123abc... counter increment
movec <packageId> <module> <function> [args...]

Move 함수 호출 명령 추가

movec my_package counter increment
movec 0x123abc... counter increment 42 "hello"
movew <packageId> <module> <function> [args...]

Move 함수 view 모드 실행 (읽기 전용)

movew my_package counter get_value
movew 0x123abc... counter get_value 0x456def...

트랜잭션 실행

write

트랜잭션 빌드, 서명, 실행

write
sign

파일에서 트랜잭션 서명

sign
# 파일 경로 입력 프롬프트
send

파일에서 서명된 트랜잭션 전송

send
# 파일 경로 입력 프롬프트
publish <path>

지정 경로의 Move 패키지 배포

publish ./my_package
exec <command> [args...]

시스템 명령어 실행

exec ls -la
exec sui client active-address

NS 콘솔 (SuiNS)

도메인 네임 관리용 SuiNS 콘솔 실행:

blue ns-console [--config <config>] [--active]

기본 콘솔 명령어 외에, NS 콘솔은 다음을 지원합니다:

도메인 쿼리 명령어

record <name>

네임 레코드 정보 조회

record example.sui
record example              # .sui 자동 추가
price

등록 가격 조회

price
renewal-price

갱신 가격 조회

renewal-price
discounts

코인 타입별 할인 정보

discounts
price-info <coinType>

특정 코인 타입 가격 정보

price-info SUI
price-info USDC

도메인 관리 명령어

register <name> [years] [payType]

도메인 등록

register example.sui 1 sui         # 1년, SUI 결제
register example 2 usdc            # 2년, USDC 결제
register example                   # 1년, SUI 결제(기본)

인자:

  • name: 도메인 이름 (.sui 자동 추가)
  • years: 등록 기간(1~5년, 기본: 1)
  • payType: 결제 방식 - sui, mist, usdc (기본: sui)
renew <nftId> <years> [payType]

도메인 갱신

renew 0x123abc... 1 sui
renew 123abc 2 usdc                # 0x 생략 가능

인자:

  • nftId: 도메인 NFT 오브젝트 ID
  • years: 갱신 기간(1~5년)
  • payType: 결제 방식 - sui, mist, usdc (기본: sui)
set-target <nftId> <address>

도메인 대상 주소 설정

set-target 0x123abc... 0x456def...
set-target 123abc 456def           # 0x 생략 가능
set-default <name>

기본 도메인 설정

set-default example.sui
set-default example                # .sui 자동 추가

서브도메인 관리 명령어

create-subname <parentNftId> <subname> <expirationMs> [allowChild] [allowExtension]

서브도메인 생성

create-subname 0x123abc... sub 1735689600000 true true

인자:

  • parentNftId: 상위 도메인 NFT ID
  • subname: 서브도메인 이름
  • expirationMs: 만료 타임스탬프(ms)
  • allowChild: 하위 생성 허용(기본: true)
  • allowExtension: 기간 연장 허용(기본: true)
edit-subname <name> <parentNftId> <allowChild> <allowExtension>

서브도메인 설정 변경

edit-subname sub.example.sui 0x123abc... true false
extend-subname <nftId> <expirationMs>

서브도메인 만료 연장

extend-subname 0x123abc... 1735689600000
create-leaf <parentNftId> <name> <targetAddress>

리프 서브도메인 생성(별도 NFT 없음)

create-leaf 0x123abc... leaf 0x456def...
remove-leaf <parentNftId> <name>

리프 서브도메인 제거

remove-leaf 0x123abc... leaf

도메인 데이터 관리

set-data <nftId> <key> <value> [isSubname]

도메인 메타데이터 설정

set-data 0x123abc... avatar "https://example.com/avatar.png" false
set-data 0x123abc... description "My domain" true

인자:

  • nftId: 도메인 NFT 오브젝트 ID
  • key: 메타데이터 키
  • value: 메타데이터 값
  • isSubname: 서브도메인 여부(기본: false)
burn-expired <nftId> [isSubname]

만료 도메인 소각

burn-expired 0x123abc... false
burn-expired 0x123abc... true      # 서브도메인

Walrus 콘솔

탈중앙화 스토리지 작업용 Walrus 콘솔 실행:

blue walrus-console [--config <config>] [--active]

기본 콘솔 명령어 외에, Walrus 콘솔은 다음을 지원합니다:

스토리지 명령어

cost <filePath> <epochs>

파일 스토리지 비용 계산

cost ./document.pdf 10
cost /path/to/image.jpg 5

인자:

  • filePath: 비용 계산할 파일 경로
  • epochs: 저장 기간(epoch)

출력:

  • 파일 크기 및 비용 내역
  • MIST/WAL 기준 스토리지 비용
  • MIST/WAL 기준 쓰기 비용
  • 총 비용 계산
upload <filePath> <epochs>

파일 업로드

upload ./document.pdf 10
upload /path/to/image.jpg 5

인자:

  • filePath: 업로드할 파일 경로
  • epochs: 저장 기간(epoch)

인터랙티브 프롬프트:

  • 비용 확인 및 승인 요청
  • 삭제 가능 여부 선택
  • 서명을 위한 키스토어 필요

출력:

  • Blob ID (파일 접근용)
  • Sui 블록체인 오브젝트 ID
  • 파일 접근 URL
  • 스토리지 메타데이터(epochs, encoding 등)

DB 콘솔 (DeepBook)

DEX 작업용 DeepBook 콘솔 실행:

blue db-console [--config <config>] [--active]

기본 콘솔 명령어 외에, DB 콘솔은 다음을 지원합니다:

풀 관리 명령어

create-pool <baseCoinKey> <quoteCoinKey> <tickSize> <lotSize> <minSize>

새 거래 풀 생성

create-pool SUI USDC 1000000 1000000 1000000

인자:

  • baseCoinKey: 기준 코인 식별자(예: "SUI")
  • quoteCoinKey: 상대 코인 식별자(예: "USDC")
  • tickSize: 최소 가격 단위
  • lotSize: 최소 수량 단위
  • minSize: 최소 주문 크기

🗄️ 데이터베이스 지원

Blue CLI는 패키지/모듈 정보를 저장하기 위해 다양한 데이터베이스 백엔드를 지원합니다:

지원 데이터베이스

  • PostgreSQL: SSH 터널 지원, 완전한 기능
  • MySQL: 커넥션 풀링 지원, 완전한 기능
  • SQLite: 경량, 파일 기반

데이터베이스 스키마

DB는 다음 테이블을 자동 생성합니다:

  • packages: 배포된 Move 패키지
  • modules: 모듈 정의 및 ABI
  • function_call: 함수 호출 메타데이터
  • function_object_arg: 함수 파라미터 정보
  • indexer_objects: 파라미터 해석용 오브젝트 인덱싱

SSH 터널 지원

원격 DB 연결 시 SSH 터널링 지원:

db:
  type: "postgresql"
  host: "localhost"
  port: 5432
  sshHost: "remote.server.com"
  sshUser: "username"
  sshKey: "/path/to/ssh/private/key"

📚 예시

기본 패키지 개발 워크플로우

# 새 키스토어 생성
blue gen-key --scheme ed25519

# 기존 개인키 import (대안)
blue import-key --scheme ed25519 --threshold 1

# 키스토어 무결성 확인
blue check-key --address 0x123abc... --threshold 1

# 새 패키지 생성
blue gen-pkg --name my_counter --author developer

# 콘솔 실행 및 배포
blue console --config config.yaml --active
> publish ./my_counter
> movec my_counter counter increment
> write

SuiNS 도메인 관리

# NS 콘솔 실행
blue ns-console --config config.yaml --active

# 가격 확인 및 도메인 등록
> price
> register mydomain.sui 2 sui
> set-target <nft-id> 0x123abc...
> create-subname <nft-id> api 1735689600000

Walrus 스토리지 작업

# Walrus 콘솔 실행
blue walrus-console --config config.yaml --active

# 파일 업로드
> cost ./document.pdf 10
> upload ./document.pdf 10

고급 트랜잭션 빌딩

blue console --config config.yaml

# 복합 트랜잭션 빌드
> init
> transfer 0x123abc... 1000000000
> movec package_name module_name function_name arg1 arg2
> split 0x456def... 500000000 300000000
> commands
> write

🔧 개발

# 의존성 설치
npm install

# 빌드
npm run build

# 개발용 링크
npm link

# 테스트 실행
npm test

📄 라이선스

[라이선스 정보]

🤝 기여

[기여 가이드라인]


Blue CLI - Sui 블록체인 개발을 위한 종합 툴킷

About

No description, website, or topics provided.

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published