$ mkdir my-first-project $ cd my-first-project $ npm init -y $ npm install --save-dev hardhat $ npx hardhat # Select to run advanced example with TypeScript
The first time you run
npx hardhat, it will initialize a project for you.
Afterwards, you can run
npx hardhat again to display the help and available tasks.
Tasks come from the
You can run an example
accounts task that was created like so:
$ npx hardhat accounts # ... lists accounts
The sample project comes with tests that use
You can run the tests with
npx hardhat test.
I made some updates to enable importing of the contracts.
To deploy the contract, you can run
npx hardhat run scripts/sample-script.js --network <network>.
In my case, I was deploying the contract to Rinkeby:
$ npx hardhat run scripts/deploy.ts --network rinkeby
It will give the address that your contract has been deployed to like
You can use the Remix IDE online to test out the contract deployed.