---
title: Connecting Hardhat to Caduceus
slug: connecting-hardhat-to-caduceus
docTags: 
createdAt: 2022-07-26T15:35:41.000Z
---

## Forking a Hardhat Project

We recommend you create a clone a repository like [https://github.com/OpenZeppelin/openzeppelin-contracts](https://github.com/OpenZeppelin/openzeppelin-contracts) which already has Hardhat set up and working. It also comes with an extensive amount of expertly written smart contracts which can be used to bootstrap your development. So fork the repository and go through the readme to get you up and running&#x20;

```shell
# clone the repository
git clone https://github.com/OpenZeppelin/openzeppelin-contracts.git
# enter into the directory
cd openzeppelin-contracts
# installs packages
yarn
```

alternatively you can also do this hardhat tutorial to initialise a new project: [https://hardhat.org/hardhat-runner/docs/getting-started#quick-start](https://hardhat.org/hardhat-runner/docs/getting-started#quick-start)

## Changing the Config

Inside your `hardhat.config.js` there will be a networks object. this object is where you can define other networks for hardhat to deploy and test the smart contracts on. This means you can point hardhat to the Testnet.

:::hint{type="info"}
note that the hardhat network is the default network used.
:::

:::CodeblockTabs
hardhat.config.js

```javascript
module.exports = {
    networks: {
        hardhat: {
            blockGasLimit: 10000000,
            allowUnlimitedContractSize: !withOptimizations,
        },
    },
},
```
:::

To add the caduceus network you have to add the RPC endpoint along with a test wallet that ideally has Test CMP tokens. As deploying and interacting with contracts will take up CMP for gas.&#x20;

:::CodeblockTabs
hardhat.config.js

```javascript
module.exports = {
    networks: {
        hardhat: {
            blockGasLimit: 10000000,
            allowUnlimitedContractSize: !withOptimizations,
        },
        caduceusTestnet: {
            url: 'https://galaxy.block.caduceus.foundation',
            accounts: {
                mnemonic: 'test test test test test test test test test test test test',
                path: "m/44'/60'/0'/0",
                initialIndex: 0,
                count: 20,
                passphrase: '',
            },
        },
    },
},
```
:::

As you can see the url is set to our testnet RPC endpoint. Also there is an accounts object which includes the wallets Secret Recovery Phrase along with other path details. These path details are the default path details for HD wallets thus they might work for your wallet as well.&#x20;

If you use MetaMask you can copy your mnemonic phrase from the app and paste it in here with this config and it should work.

Go to here to see how to get your mnemonic phrase from MetaMask - [Create a Wallet](docId\:H-T8uZ4zN1ZNn6rowisFp)

[Click here to learn more about hardhat configuration and networks](https://hardhat.org/hardhat-network/docs/overview)

***

## Running tests

&#x20;Now your hardhat configuration is set up you can execute tests by doing&#x20;

```shell
npx hardhat test ./test/finance/VestingWallet.test.js --network caduceusTestnet
```

where the `--network` flag is the key of the of the network object in the config file. In our case we named it caduceusTestnet.

:::hint{type="info"}
When you decide to run tests that deploy and interact with contracts then make sure that each account has enough CMP tokens to do so. [Getting Testnet Tokens](docId\:Yo3XlS6Dblqwb3CCB_BK5) can help you get test CMP.
:::

