Synopsis
<network> is one of: local, dev, summit. Passing summit currently errors out with “Summit (mainnet) is not available yet” — included in the enum for forward compatibility.
The optional --rpc-url flag overrides the default RPC URL for the network. This is useful when testing against a different validator instance or an ephemeral environment:
Behavior
- Create project directory structure:
cowboy init is safe to run multiple times — each run adds a new environment to .cowboy/config.json without overwriting keys. Starter actor scaffolding lives under cowboy actor new <name> and is not part of init.
-
Generate a wallet — Calls the same logic as
cowboy wallet createbut targets.cowboy/keys/<network>instead of.cowboy/key. Each network gets its own key so you never accidentally sign a mainnet transaction with a local-only key. -
Write / merge network config — Reads any existing
.cowboy/config.json, adds or updates the entry for<network>, and sets the active environment to the one just initialised. The new schema looks like:Fordev, the CLI also writes the well-knownwatchtower_registryaddress socowboy watchtowercommands work without extra flags. Old flat-format configs ({ "network": "...", "rpc_url": "..." }) are migrated on first run. -
Auto-discover network identity (optional) — If a
test/peers.yamlis present in the current directory or any ancestor,cowboy initextracts the BLS12-381 network identity and stores it asenvironments.<network>.identityso RAS / CBFS commands can verify chain artefacts without an extra flag. -
Fund the wallet (if faucet available) — For
localanddev, sendsPOST <rpc_url>/faucetto fund the new wallet with CBY. Prints the funded amount and balance. If the faucet is unreachable, prints a warning and continues — the project is still usable. - Print summary — Shows the created key path, config path, wallet address, and next steps.
Network Defaults
| Network | Default RPC URL | Faucet |
|---|---|---|
local | http://localhost:4000 | Yes — POST http://localhost:4000/faucet |
dev | https://rpc.mesa.cowboylabs.net | Yes — POST https://rpc.mesa.cowboylabs.net/faucet |
summit | Not yet available (mainnet, TBD) | — |
Example
cowboy init dev next adds dev to the same config without touching local:
Edge Cases
- Existing key for the same network — If
.cowboy/keys/<network>already exists,cowboy init <network>skips wallet generation and reuses the existing key. No overwrite ever happens. - Faucet unreachable — If the faucet request fails (network down, local validator not running), print a warning but continue. The project is still usable.
- Old flat config format — If
.cowboy/config.jsonuses the legacy{ "network": "...", "rpc_url": "..." }schema,cowboy initmigrates it in place to theenvironmentsschema on the next run. summitnetwork — Rejected with a clear error message; reserved for the future mainnet launch.

