# Hardhat

### Initialize Your Project

If you're starting your Hardhat project from scratch, we recommend you read the Hardhat Quick Start page.

### Setting up Your Account​

The quickest way to get Hardhat to deploy contracts to a non-local TestNet, is to export and use an existing MetaMask account.

To get an account's private key from MetaMask:

1. Open MetaMask.
2. Select the account you want to export.
3. Click the three dots on the right side.
4. Select "Account Details".
5. Select "Export Private Key".
6. Enter your password and select "Confirm".

You should see a 64-character hex string similar to the following:

`60ed0dd24087f00faea4e2b556c74ebfa2f0e705f8169733b01530ce4c619883`

Create a new file in your root folder called `private.json` with your private key in it:

```json
{
  "privateKey": "60ed0dd24087f00faea4e2b556c74ebfa2f0e705f8169733b01530ce4c619883"
}
```

Modify your `hardhat.config.js` file to include:

```javascript
// hardhat.config.js

// ...

const { privateKey } = require("./private.json");

// ...

module.exports = {
  // ...

  networks: {
    // Lumia faucet: https://testnet-faucet.lumia.org
    lumia-testnet: {
      url: "https://beam-rpc.lumia.org",
      chainId: 2030232745,
      accounts: [privateKey],
    },

    // ...
  },
};
```

Once your accounts are funded, you can deploy the sample contract to Lumia Testnet with `npx hardhat run --network lumia-testnet scripts/deploy.js`.


---

# 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.lumia.org/build/smartcontracts/deployment/hardhat.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.
