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

# Mainnet deployment

> Launch your dApp on Stacks mainnet

Deploy your production dApp to Stacks mainnet.

<Warning>
  Mainnet deployments are permanent and costly. Test thoroughly on testnet first.
</Warning>

## Contents

* [Requirements](#requirements)
* [Security checklist](#security-checklist)
* [Configure mainnet settings](#configure-mainnet-settings)
* [Deploy to mainnet](#deploy-to-mainnet)
* [Start production frontend](#start-production-frontend)
* [Post-deployment](#post-deployment)
* [Emergency procedures](#emergency-procedures)
* [Costs](#costs)

## Requirements

| Requirement       | Notes                                |
| ----------------- | ------------------------------------ |
| Mainnet STX       | Deployment and transaction fees      |
| Mainnet sBTC      | Only if your contracts use it        |
| Deployer mnemonic | In `contracts/settings/Mainnet.toml` |

## Security checklist

* [ ] Comprehensive testnet testing completed
* [ ] All contracts audited (recommended)
* [ ] Emergency functions implemented
* [ ] Upgrade mechanisms planned
* [ ] Sufficient STX for fees

## Configure mainnet settings

Add your mainnet mnemonic to `Mainnet.toml`:

```toml theme={null}
[accounts.deployer]
mnemonic = "your mainnet seed phrase"
derivation = "m/44'/5757'/0'/0/0"
```

## Deploy to mainnet

```bash theme={null}
stacksdapp deploy --network mainnet
```

Review fees and contract list first:

```bash theme={null}
stacksdapp deploy --network mainnet --dry-run
```

Monitor deployment on [Stacks Explorer](https://explorer.stacks.co/).

## Start production frontend

```bash theme={null}
stacksdapp dev --network mainnet
```

## Post-deployment

* Update frontend with mainnet addresses
* Monitor contract interactions
* Plan for future upgrades

## Emergency procedures

If issues arise:

1. Pause contract functions (if implemented)
2. Assess impact
3. Deploy fixes as new contract versions
4. Communicate with users

## Costs

* Deployment: \~0.1-1 STX per contract
* Function calls: variable based on complexity
* Storage: paid by contract owner initially

Monitor fees on [Stacks Explorer](https://explorer.stacks.co/).
