Synopsis
Subcommands
cowboy wallet create
Generate a new secp256k1 keypair and write the private key to a PEM file.
Behavior:
- Generate a cryptographically random secp256k1 private key.
- Write the 32-byte private key in PEM envelope format to the output file.
- Print the public address (EVM-style checksum hex).
| Flag | Default | Description |
|---|---|---|
--output | .cowboy/key | Path to write the private key file |
- If the output file already exists, print an error and exit. Do not overwrite.
- Create parent directories (
.cowboy/) if they don’t exist.
cowboy wallet address
Print the public address derived from a private key file.
Behavior:
- Load the private key using key auto-discovery.
- Derive the secp256k1 public key.
- Print the EVM-style checksum hex address (20-byte,
0x-prefixed).
| Flag | Default | Description |
|---|---|---|
--key | Auto-discovered | Path to private key file |
cowboy wallet balance
Query the account balance from the chain.
Behavior:
- Load the private key using key auto-discovery.
- Derive the public address.
- Send
GET /account/<address>to the RPC endpoint. - Print the balance in CBY.
| Flag | Default | Description |
|---|---|---|
--key | Auto-discovered | Path to private key file |
--rpc-url | From .cowboy/config.json or http://localhost:4000 | RPC endpoint |
- If the account doesn’t exist on-chain, print
Balance: 0 CBY(not an error). - If the RPC endpoint is unreachable, print an error with the URL that was tried.
cowboy wallet upgrade
Convert a hex-format private key file to PEM envelope format.
Behavior:
- Load the private key file (auto-discovered or explicit path).
- If the file is already in PEM format, print a message and exit (no-op).
- If the file is in hex format, re-encode as PEM and overwrite the file in-place.
| Flag | Default | Description |
|---|---|---|
--key | Auto-discovered | Path to private key file |
- If the key is already PEM, prints a message and exits successfully without modifying the file.
- Both hex (64-char string) and
0x-prefixed hex are accepted as input.
cowboy wallet create-mnemonic
Generate a new BIP-39 mnemonic phrase and derive a secp256k1 private key from it.
Behavior:
- Generate a random 12-word BIP-39 mnemonic phrase.
- Derive a secp256k1 private key using HD derivation path
m/44'/60'/0'/0/<index>. - Write the private key in PEM format to the output file.
- Print the mnemonic phrase and derived address.
| Flag | Default | Description |
|---|---|---|
--output | .cowboy/key | Path to write the private key file |
--index | 0 | HD derivation index |
- If the output file already exists, print an error and exit. Do not overwrite.
cowboy wallet import-mnemonic
Import an existing BIP-39 mnemonic phrase and derive a private key from it.
Behavior:
- Validate the provided mnemonic phrase (must be valid BIP-39).
- Derive a secp256k1 private key using HD derivation path
m/44'/60'/0'/0/<index>. - Write the private key in PEM format to the output file.
- Print the derived address.
| Flag | Default | Description |
|---|---|---|
--mnemonic | Required | BIP-39 mnemonic phrase (quoted string) |
--output | .cowboy/key | Path to write the private key file |
--index | 0 | HD derivation index |
- If the mnemonic is invalid, print
Error: Invalid mnemonic phraseand exit. - If the output file already exists, print an error and exit. Do not overwrite.
cowboy wallet accounts
List multiple derived addresses from a BIP-39 mnemonic phrase.
Behavior:
- Validate the provided mnemonic phrase.
- Derive
countaddresses using sequential HD derivation indices (m/44'/60'/0'/0/0throughm/44'/60'/0'/0/<count-1>). - Print each index and its corresponding address.
| Flag | Default | Description |
|---|---|---|
--mnemonic | Required | BIP-39 mnemonic phrase (quoted string) |
--count | 5 | Number of addresses to derive |
- If the mnemonic is invalid, print
Error: Invalid mnemonic phraseand exit. - This command does not write any key files — it only prints addresses.

