# Use hardhat-laika

**What is hardhat-laika ?**

`hardhat-laika` is Laika's own Hardhat plugin that helps you sync your compiled contracts with Laika. This enables you to make a request without having to write a single line of extra code.

In counterview, it also boosts your performance when developing with Hardhat! 💪

**Let’s try it out!**

First, we are going to start a new Hardhat project using

```
npx hardhat init
```

Then, pick a configuration you like (We'll be usingthis configuration and Greeter.sol as an example contract in this guiding example)

```
✔ What do you want to do? · Create a JavaScript project
✔ Hardhat project root: · /Users/custom/Development/HARDHAT-LAIKA-TUTORIAL
✔ Do you want to add a .gitignore? (Y/n) · y
✔ Do you want to install this sample project's dependencies with npm (hardhat @nomicfoundation/hardhat-toolbox)? (Y/n) · y
```

After the project setup is completed, let’s install hardhat-laika by using

```
npm i hardhat-laika
```

Now, **import it to your hardhat.config.js** By adding a require(…) statement at the top

{% embed url="<https://gist.github.com/nonkung51/b3a7e1dade2f0c89f2b41c9731565001#file-hardhat-config-js>" %}

Alright, now we’re all set! Let’s try to use it!

There are two ways to use hardhat-laika, viz.&#x20;

1. through the command line&#x20;
2. through your own scripts (by defining a hardhat-laika task)

Let’s try the first way.

1. **The Hardhat Runner CLI**

First, Let’s compile our contract so we can get the ABIs.

```
npx hardhat compile
```

Then, use the **laika-sync** task to sync it to Laika

```
npx hardhat laika-sync --contract <contract_name> --address <OPTIONAL address_of_that_contract>
```

For this example, we'll use the command with the following parameters:

```
npx hardhat laika-sync --contract Lock --address 0x5FbDB2315678afecb367f032d93F642f64180aa3
```

You should be able to see something like this.

<br>

![laika-sync task](https://miro.medium.com/max/1232/1*2bkX75lbOFii1pl_UCdA1A.gif)

<figure><img src="/files/divMpwLonIHzULaGHMD3" alt=""><figcaption><p>laika-sync task</p></figcaption></figure>

**2. Creating a Script**

Let’s take a look at scripts/sample-script.js

{% embed url="<https://gist.github.com/nonkung51/d9e0137c2005a2c91fc8c2e43c13b44f#file-sample-script-js>" %}

We just have to simply **add hre.run() to line 25** and we’re set! We can run it using the command.

```
npx hardhat run --network localhost scripts/deploy.js
```

You should be able to see something like this.

![](https://miro.medium.com/max/1200/0*SjVc6BI5SiEUakBU.gif)

<figure><img src="/files/b9mWakrpkTsnaBGawksV" alt=""><figcaption></figcaption></figure>

Both methods enable you to directly integrate Laika with your Hardhat environment as shown.


---

# 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.getlaika.app/docs/advanced/use-hardhat-laika.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.
