> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cowboy.inc/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy and operate

> Pick an environment, fund a wallet, deploy an actor, then call it, watch it, keep it funded and ship changes

The [Quickstart](https://docs.cowboy.inc/getting-started/quickstart.md) got `hello` deployed. To keep an actor running and improve it over time, you need a little more: which network your commands reach, what a deploy does, how an actor pays for its work, and how to ship a change once its code is fixed.

## Environments

Every command talks to a network, which the CLI calls an **environment**. You'll normally deploy to `cloud`, the public one. Once you choose an environment, the project remembers it, whether you chose it with `cowboy init --env`, with `cowboy deploy --env`, or like this:

```bash theme={"system"}
cowboy env use cloud
cowboy env current
```

```text Output theme={"system"}
  Environment: cloud (project, built in)
  RPC URL: https://rpc.cloud.cowboy.inc (from environment)
  Key: default
  Signer: 0x2858…423C (from keystore)
```

`env current` shows the network, address and key this folder's commands will use. [Networks](https://docs.cowboy.inc/getting-started/networks.md) has more on each one.

## Wallets

Your **wallet** pays for deploys and calls. `cowboy wallet create` keeps its key in `~/.cowboy/keys/`, outside every project. Back that folder up, because whoever has the key controls the wallet and every actor it owns.

A new wallet can get a one-time credit with `cowboy credit claim`, and [Billing](https://docs.cowboy.inc/hire/billing.md) covers adding more.

## Deploy

```bash theme={"system"}
cowboy deploy hello --init-payload hello
```

```text Output theme={"system"}
  Riding to cloud · hello

  ✓ Built application · actor runtime verified (0.8s)
    Wallet 0x2858…423C · balance 50 CBY
    Spend up to 1.29 CBY · actor funding 1 CBY
  ✓ Actor deployment committed (7.8s)
  ✓ Actor funding committed (2.6s)

  🤠 Yeehaw! hello is live on cloud

  Actor    0x2858…c20c
  Inspect  cowboy actor inspect hello
```

A deploy starts by building the actor and working out the most it can cost, and it stops there if your wallet can't cover that. Otherwise, it creates the actor at a new address, runs its `init`, and makes you its owner.

It also asks how much to move from your wallet to the actor, 1 CBY by default. To skip the question, pass `--fund <CBY>`.

If a deploy stops partway, run the same command again to continue. [`cowboy deploy`](https://docs.cowboy.inc/cli-specs/cowboy-deploy) lists the other flags.

## After deploy

Once the actor is live, you can call it and see what it's doing. Every `actor` command takes the actor's name inside the project, or any actor's address.

| Command | What it does | Costs |
| - | - | - |
| `cowboy actor call hello --handler main` | Calls a handler. | A fee from your wallet |
| `cowboy actor state hello` | Shows the actor's state. | Free |
| `cowboy actor inspect hello` | Shows its owner, balance and URL. | Free |
| `cowboy actor logs hello` | Shows the events it sent. | Free |
| `cowboy actor timers hello` | Shows its scheduled runs. | Free |

A call reports that it went through, not what the handler returned.

## Keep it funded

An actor that can't pay stops working, so it helps to know who pays for what. Whoever calls a handler pays that call's fee. The work the actor starts itself comes out of its own balance: its scheduled runs, its runner jobs and off-chain calls, and the state it stores.

You can add money at any time. `cowboy actor fund hello --amount 5` moves 5 CBY from your wallet to the actor. If you'd rather not do that by hand, `cowboy actor auto-topup set hello --target 0.5 --cap 10` refills the actor to 0.5 CBY about once a day, up to 10 CBY in all. An actor that spends faster can still run short.

Your wallet also backs the actor up by default. When the actor's balance runs short, your wallet covers its messages and the delivery of its job results, with no cap. Scheduled runs still come only from the actor's balance. `cowboy actor owner-funding hello` shows the setting, and `--off` turns it off.

The actor also pays rent for the state it stores, and if that stays unpaid for about a month, the state can be removed ([CIP-4](https://docs.cowboy.inc/cips/cip-4-storage.md)).

## Ship a change

You can't replace a deployed actor's code, so shipping a change means deploying a new actor. Edit the actor, run `cowboy check` and `cowboy test`, then deploy it with `--new`:

```bash theme={"system"}
cowboy deploy hello --new --init-payload hello
```

```text Output theme={"system"}
  🤠 Yeehaw! hello is live on cloud

  Actor    0x2858…91fd
```

The new actor gets a new address and fresh state, and `hello` now points at it. The old actor keeps running, with its own state, balance and schedules. If you leave out `--new`, a terminal asks first and a script stops.

Two things can change without a new actor. `cowboy actor update-offchain` replaces a project's off-chain code and keeps the actor's code, address and state. And deploying a workload again updates it ([Run a web app or service](https://docs.cowboy.inc/developers/ship-a-web-app.md)).

> [!WARNING]
>
> Once a workload is registered, a deploy won't change its owning actor or routes. Settle its routes before the first deploy.

## List it in the General Store

When the actor is ready for others, [submit it on Cloud](https://cloud.cowboy.inc/general-store/submit).

## Next

* [Run a web app or service](https://docs.cowboy.inc/developers/ship-a-web-app.md)
* [Billing](https://docs.cowboy.inc/hire/billing.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.