> For the complete documentation index, see [llms.txt](https://docs.swisstronik.com/swisstronik-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.swisstronik.com/swisstronik-docs/development/guides/contract-deployment-hardhat/2.-configure-hardhat.config.js.md).

# 2. Configure hardhat.config.js

> ### <mark style="color:red;">⚠️ Important Security Warning</mark>
>
> <mark style="color:red;">**Do Not Commit Sensitive Information**</mark>
>
> <mark style="color:red;">**Accidentally committing sensitive information such as seed phrases can lead to the loss of funds. Always double-check your code and configurations before committing. Use**</mark><mark style="color:red;">**&#x20;**</mark><mark style="color:red;">**`.gitignore`**</mark><mark style="color:red;">**&#x20;**</mark><mark style="color:red;">**files and environment variables to protect sensitive data.**</mark>

After successfully setting up your Hardhat project, the next step is to configure the hardhat.config.js file. This will be the essential configuration file where you can customize the networks, plugins, compiler settings, and more.&#x20;

1. Open the `hardhat.config.js` file

<mark style="color:red;">⚠️</mark>**Note:** Avoid using `import "@openzeppelin/hardhat-upgrades";` because this library calls `getStorageAt`, which will not work if storage is disabled.

<figure><img src="https://3739409932-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fvh80ue5X9nMskPC6XjLd%2Fuploads%2FOE9LmxMlE6LKy8hUfrXY%2Fimage.png?alt=media&amp;token=8f5ab20e-1f01-453b-a27f-87aafdea0a0b" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
For the scope of this tutorial, we will only configure the **networks**, leaving the solidity compiler at its default version 0.8.19.
{% endhint %}

2. Set a variable with your private key

To set the variable, use the following command:&#x20;

```bash
npx hardhat vars set PRIVATE_KEY
```

After running the command, you will be prompted to enter your private key.

You can read more about setting the configuration variables [here](https://hardhat.org/hardhat-runner/docs/guides/configuration-variables).

3. Setup the Swisstronik's network

```javascript
require("@nomicfoundation/hardhat-toolbox");
// Remember to use the private key of a testing account
// For better security practices, it's recommended to use npm i dotenv for storing secret variables

//use configuration-variables in hardhat to set PRIVATE_KEY variable
const PRIVATE_KEY = vars.get("PRIVATE_KEY");

module.exports = {
  defaultNetwork: "swisstronik",
  solidity: "0.8.19",
  networks: {
    swisstronik: {
      url: "https://json-rpc.testnet.swisstronik.com/",
      accounts: [`0x` + `${PRIVATE_KEY}`],
    },
  },
};

```

{% hint style="warning" %}
Make sure you have enough funds in this wallet to deploy/interact with the smart contract. otherwise, you can [get SWTR test tokens here](/swisstronik-docs/development/get-test-coins.md)
{% endhint %}
