> For the complete documentation index, see [llms.txt](https://documentation.script.tv/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.script.tv/smart-contract-and-app-development/hardhat.md).

# Hardhat

To demonstrate how to develop DApps on Script using the Hardhat suite (<https://hardhat.org/hardhat-runner/docs/getting-started#overview>). This guide will walk you through the steps to deploy and test on Script using Hardhat and ethers.js (<https://docs.ethers.org/v6/>).

> Setup the Hardhat project

> Fund the test accounts with some SPAY

Execute the two commands below to fun the test accounts with some SPAY:

export SEQ=`scriptcli query account --address=0x2E833968E5bB786Ae419c4d13189fB081Cc43bab | grep sequence | grep -o '[[:digit:]]\+'`

scriptcli tx send --chain="scriptnet" --from=0x2E833968E5bB786Ae419c4d13189fB081Cc43bab --to=0x19E7E376E7C213B7E7e7e46cc70A5dD086DAff2A --spay=1000 --password=qwertyuiop --seq=$(($SEQ+1))

scriptcli tx send --chain="scriptnet" --from=0x2E833968E5bB786Ae419c4d13189fB081Cc43bab --to=0x1563915e194D8CfBA1943570603F7606A3115508 --spay=1000 --password=qwertyuiop --seq=$(($SEQ+2))

> Deploy the contract to the script testnet

First, edit the hardhat.config.js file, replace "11...1" with the actual private key of the deployer wallet (should delete the key after use, do NOT commit the private key to GitHub):

...&#x20;

script\_testnet: {&#x20;

url: `https://testeth-rpc-api.script.tv/rpc`,&#x20;

accounts: \["1111111111111111111111111111111111111111111111111111111111111111"],&#x20;

chainId: 742,&#x20;

gasPrice: 4000000000000 }, ...

Next, go to the repository's root folder and run this to deploy your contract:

npx hardhat run scripts/deploy.js --network script\_testnet

> Special Notes on Testing with the Ethers.js+Waffle framework

**Note 1**: Currently the RPC Adaptor does NOT support non-standard methods such as evm\_snapshot, evm\_revert, and evm\_mine. Thus, test cases using Fixtures (e.g. waffle.loadFixture()) are expected to fail when running against the Script blockchain.

**Note 2:** Currently the RPC Adaptor returns a generic "evm: execution reverted" messages in most case when the Script EVM execution fails. Some test cases may check the EVM errors with code like this:

await expect(this.bar.leave("200")).to.be.revertedWith("ERC20: burn amount exceeds balance")

To make these test pass, for now we need to replace the expected error message with "evm: execution reverted" as shown below:

await expect(this.bar.leave("200")).to.be.revertedWith("evm: execution reverted")


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://documentation.script.tv/smart-contract-and-app-development/hardhat.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
