> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://v3.viem.sh/api/mcp` to find what you need.

# Deploy Contracts

## Overview

[`contract.deploy`](/docs/actions/wallet/contract/deploy) ABI-encodes constructor arguments after the
deployment bytecode and broadcasts a contract-creation transaction. The sync variant returns the
receipt. Direct CREATE receipts include the deployed contract address.

## Recipes

These recipes assume you have [set up a Client](/docs) with an Account and [`walletActions`](/docs/actions/wallet).

### Deploy and Return the Hash

Use the asynchronous variant when deployment tracking happens elsewhere.

:::code-group
```ts twoslash [example.ts]
import { Abi } from 'viem/utils'
import { client } from './viem.config'

const hash = await client.contract.deploy({ // [!code focus]
  abi: Abi.from(['constructor(address owner)']), // [!code focus]
  args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], // [!code focus]
  bytecode: '0x608060405260405161083e38038061083e8339810160408190', // [!code focus]
}) // [!code focus]
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
// [!include ~/snippets/docs/viem.config.ts:setup]
```
:::

### Deploy and Read the Address

[`contract.deploySync`](/docs/actions/wallet/contract/deploy) waits for inclusion and returns the
deployment receipt.

:::code-group
```ts twoslash [example.ts]
import { Abi } from 'viem/utils'
import { client } from './viem.config'

const receipt = await client.contract.deploySync({ // [!code focus]
  abi: Abi.from(['constructor(address owner)']), // [!code focus]
  args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], // [!code focus]
  bytecode: '0x608060405260405161083e38038061083e8339810160408190', // [!code focus]
}) // [!code focus]

const address = receipt.contractAddress // [!code focus]
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
// [!include ~/snippets/docs/viem.config.ts:setup]
```
:::

## Best Practices

### Verify the Artifact Pair

Use the ABI and bytecode emitted by the same compiler build. A constructor ABI from another artifact
can encode valid bytes that the deployment bytecode interprets incorrectly.

### Persist the Receipt

Record the transaction hash, deployed address, Chain ID, and artifact version together. This record
supports later verification and incident investigation.

## See More

<Cards>
  <Card icon="lucide:scan-search" title="Track Transactions" description="Recover the deployment receipt from its transaction hash." to="/docs/guides/transactions/track" />

  <Card icon="lucide:box" title="Contract Instances" description="Bind the deployed address to its ABI and Client." to="/docs/guides/contracts/instances" />
</Cards>
