# 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](/rollups/zksync-hyperchain/rpc-access.md) 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="/files/wZSO9RUitwQOgrHd2Ega" alt=""><figcaption><p>project step 1</p></figcaption></figure>

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

<figure><img src="/files/IrkvIvhPMgmwWjoCY9dl" alt=""><figcaption><p>project step 2</p></figcaption></figure>

Choose the Ethereum framework version v6 recommended

<figure><img src="/files/PXF2k87rH749ILcruGau" alt=""><figcaption><p>project step 3</p></figcaption></figure>

Choose the template to use Hardhat + Solidity recommended

<figure><img src="/files/f8l28o1KWFvQlFvU3Fqf" 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="/files/vCgr8Zs5tQURKFH4d4hC" 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="/files/rA5ArJYFBnX9dKiM29sa" 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="/files/LXCi1tk2LTrRtbIYY4og" 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="/files/JO31HsnPeNFFN8chfnzw" 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zeeve.io/rollups/zksync-hyperchain/demo-network/deploying-contract.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
