Skip to main content

Synopsis

cowboy init <network> [--rpc-url <url>]
Where <network> is one of: local, dev. The optional --rpc-url flag overrides the default RPC URL for the network. This is useful when testing against a different validator instance or ephemeral environment:
cowboy init dev --rpc-url http://my-staging-validator:4000

Behavior

  1. Create project directory structure:
.cowboy/
  key              # Ed25519 private key (hex)
  config.json      # { "network": "<network>", "rpc_url": "..." }
actors/
  hello/
    main.py        # Starter actor template
cowboy.toml        # Project manifest (placeholder)
  1. Generate a wallet — Calls the same logic as cowboy wallet create. Writes the private key to .cowboy/key.
  2. Write network config — Writes .cowboy/config.json with the RPC URL for the selected network (or the --rpc-url override).
  3. Create starter actor — Writes actors/hello/main.py with a minimal actor template.
  4. Fund the wallet (if faucet available) — For local and dev networks, sends a POST /faucet request to fund the new wallet with CBY. Prints the funded amount and balance.
  5. Print summary — Shows the created project structure, wallet address, and next steps.

Network Defaults

NetworkRPC URLFaucet
localhttp://localhost:4000Yes — POST http://localhost:4000/faucet
dev<your-validator-url>Yes — POST <your-validator-url>/faucet

Example

$ cowboy init local
Creating Cowboy project...
  Created .cowboy/key
  Created .cowboy/config.json (network: local, rpc: http://localhost:4000)
  Created actors/hello/main.py
  Created cowboy.toml

Wallet address: 0x7a3b...f92e
Requesting funds from faucet...
  Funded: 1000 CBY
  Balance: 1000 CBY

Next steps:
  cd actors/hello
  # Edit main.py
  cowboy actor deploy --code actors/hello/main.py

Edge Cases

  • Directory already exists — If .cowboy/ already exists, print a warning and skip wallet generation (do not overwrite existing key).
  • Faucet unreachable — If the faucet request fails (network down, local validator not running), print a warning but continue. The project is still usable.

Testing

# Test local init
cowboy init local
ls -la .cowboy/
cat .cowboy/config.json

# Verify wallet was created
cowboy wallet address

# Test idempotency (should warn, not overwrite)
cowboy init local