# 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="https://4276181174-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBAYSQIWd7IsbIjaYskIf%2Fuploads%2FHzrkKydwZZsqGpOIHxyr%2Fezgif.com-video-to-gif%20(1).gif?alt=media&#x26;token=53fa83ce-cca9-45f4-baf7-d8eb0e254e40" 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="https://4276181174-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBAYSQIWd7IsbIjaYskIf%2Fuploads%2FZ7ow9UXaFvQHtZveMlq2%2Fezgif.com-video-to-gif.gif?alt=media&#x26;token=a773c622-1ac6-4b85-812b-aa83d2702615" alt=""><figcaption></figcaption></figure>

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