---
title: Deployment
description: "Common ways to deploy Tact contracts to the testnet or mainnet of TON Blockchain"
---

:::note

  This page is being rewritten as per [#890](https://github.com/tact-lang/tact/issues/890).

:::

Tact Deployer is a small library that integrates with [TON Verifier](https://verifier.ton.org), allowing you to safely deploy your contracts using your favorite wallet without needing to manage keys or deploy contracts manually. Tact Deployer also automatically verifies your contract's source code, ensuring that your compiler is not compromised.

## Requirements

Your contract MUST have the `Deployer` trait from the `@stdlib/deploy` package to be able to use Tact Deployer.

## Installation

To add Tact Deployer to your project, just use `yarn`:

```bash
yarn add @tact-lang/deployer
```

## How to use

When you build your smart contracts using Tact, it produces a package (*.pkg) file that contains all the required information about the built smart contract. To deploy your smart contract, you need to create a deployer instance, pass your package file to it, and provide initial data for your contract.

```typescript
import * as fs from 'fs';
import * as path from 'path';
import { Address, contractAddress } from "ton";
import { SampleTactContract } from "./output/sample_SampleTactContract";
import { prepareTactDeployment } from "@tact-lang/deployer";

// Parameters
let testnet = true;                                 // Flag for testnet or mainnet
let packageName = 'sample_SampleTactContract.pkg';  // Name of your package to deploy
let outputPath = path.resolve(__dirname, 'output'); // Path to output directory
let owner = Address.parse('<put_address_here>');    // Our sample contract has an owner
let init = await SampleTactContract.init(owner);    // Create initial data for our contract

// Calculations
let address = contractAddress(0, init);     // Calculate contract address. MUST match the address in the verifier
let data = init.data.toBoc();               // Create init data
let pkg = fs.readFileSync(                  // Read package file
    path.resolve(outputPath, packageName)
);

// Prepare deployment
let link = await prepareTactDeployment({ pkg, data, testnet });

// Present a deployment link and contract address
console.log('Address: ' + address.toString({ testOnly: testnet }));
console.log('Deploy link: ' + link);
```

After following this link, you will be able to deploy and verify your smart contract.