# Deploying Contract

Deploying and compiling the contract is different for the zkSync Hyperchain. Here we discuss the steps to deploy your first contract in the zkSync Hyperchain network.

**Step 1: Get the RPC URL -** Follow the instructions in [rpc-access](https://docs.zeeve.io/rollups/zksync-hyperchain/rpc-access "mention") to get the RPC endpoints

**Step 2: Get Explorer URL -** In the network overview page in the top right corner, you can see an explorer button. it will open the explorer URL.

**Step 3: Create a zkSync project -** create a zkSync project with the help of zkSync-cli.

<pre class="language-sh"><code class="lang-sh"><strong># initialize the project with
</strong>npx zksync-cli create contract-deploy
</code></pre>

<figure><img src="https://2761463242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4rJKli4PHnZkHP4Y6plD%2Fuploads%2FqjWBoWEQJjcv0zd1Fq4m%2Fimage.png?alt=media&#x26;token=7964c254-615b-4f0a-b962-00ee2372945d" alt=""><figcaption><p>project step 1</p></figcaption></figure>

Select the contracts in the type of project to deploy the contract

<figure><img src="https://2761463242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4rJKli4PHnZkHP4Y6plD%2Fuploads%2Fip6Bj2ZayeScle4d9rzQ%2Fimage.png?alt=media&#x26;token=7f36afbe-2b7e-4964-b0e7-46c385889f4b" alt=""><figcaption><p>project step 2</p></figcaption></figure>

Choose the Ethereum framework version v6 recommended

<figure><img src="https://2761463242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4rJKli4PHnZkHP4Y6plD%2Fuploads%2FyUPgUzx2J90UbN0maAZf%2Fimage.png?alt=media&#x26;token=58d82437-12a4-48e0-aaef-6a2fef00d61b" alt=""><figcaption><p>project step 3</p></figcaption></figure>

Choose the template to use Hardhat + Solidity recommended

<figure><img src="https://2761463242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4rJKli4PHnZkHP4Y6plD%2Fuploads%2FQCjAj6hsMnF4aENDgBas%2Fimage.png?alt=media&#x26;token=16a8861a-a6a6-4c5a-b540-6810587ab00b" alt=""><figcaption><p>project step 4</p></figcaption></figure>

Enter your private key which has enough tokens in the zkSync Hyperchain (l2 network) for the gas price.

<figure><img src="https://2761463242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4rJKli4PHnZkHP4Y6plD%2Fuploads%2F68VRyuHk4D7pezVirfAM%2Fimage.png?alt=media&#x26;token=e5e9b545-73de-41af-a219-6e11b974109f" alt=""><figcaption><p>project step 5</p></figcaption></figure>

Choose one package manager to manage the project dependency npm recommended. It will start cloning and setting up the environment

**Step 4:  Changing config values -** Once the project setup is done. change the directory to the project directory and install all the dependency

```bash
# changing directory
cd contract-deploy
# install packages
npm i
```

Change the **hardhat.config.ts** file in the root of the project, replace the URL of your Rpc with **url** variable and your explorer URL with /contract\_verification appended in the end with the **verifyURL** variable in the **zkSyncSepoliaTestnet** object.

<figure><img src="https://2761463242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4rJKli4PHnZkHP4Y6plD%2Fuploads%2FNdy8bcDfh1x3B7Ud9I8X%2Fimage.png?alt=media&#x26;token=5fc2feb6-6102-4fb9-8c52-359a5ea5e9ec" alt=""><figcaption></figcaption></figure>

**Step 5: Compile and deploy your contract -** To compile the contract you need to run the command listed below. It will compile all the contracts in the /contracts directory. deploy command will only deploy the Greeting.sol contract to the blockchain.

```bash
# to compile
npm run compile
# to deploy
npm run deploy
```

**Step 6: Interacting with the contract -** once it is deployed copy the contract address from the logs, you can see in the below screenshot 0x71Ae38d9b09716a4D7d7EB6bcA392710Cbf4cd66

<figure><img src="https://2761463242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4rJKli4PHnZkHP4Y6plD%2Fuploads%2FAVrNyAuRQsYMhyyeSZCp%2Fimage.png?alt=media&#x26;token=c0726cbf-d114-4f5f-b982-ef39d3020048" alt=""><figcaption></figcaption></figure>

Replace this address in the /deploy/interact.ts file in the **CONTRACT\_ADDRESS** variable. save it and run the command for interacting with the contract

```bash
# to interact
npm run interact
```

<figure><img src="https://2761463242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4rJKli4PHnZkHP4Y6plD%2Fuploads%2FEmsKpK9sdyBie0hI1qrj%2Fimage.png?alt=media&#x26;token=c1c23e56-73eb-4cd6-b612-72e17013cd90" alt=""><figcaption></figcaption></figure>

You will see output something like this, you can modify and play around with the /deploy/interact.ts to interact with the contract with different values.
