Home

Awesome

Starknet Hardhat TypeScript Example

Example setup of a Starknet-Hardhat-TypeScript project. This is an empty project that you can take a fork. It's configured and works following the instructions.

Setup

Install system dependencies (more details here):

# Ubuntu
sudo apt install -y libgmp3-dev
# macOS
brew install python gmp

Setup the python venv:

# Create a local venv
python3 -m venv ~/cairo_venv

# Activate it
source ~/cairo_venv/bin/activate

# Install cairo-lang in the local venv
pip3 install cairo-lang

If you are on macOS and installing cairo-lang fails, use this guide.

Install the node dependencies:

yarn install

Getting started

In a tab start the devnet:

nvm use
starknet-devnet

In another tab:

# Set correct version of Node
nvm use

# Activate the correct Python venv
source ~/cairo_venv/bin/activate

# Compile
yarn hardhat starknet-compile

# Test
yarn hardhat test

# Deploy
yarn hardhat starknet-deploy --starknet-network devnet --inputs "123"

# Deploy an account
yarn hardhat starknet-deploy-account --starknet-network devnet --wallet OpenZeppelin

For more documentation.

Useful links

Repo is inspired from Starknet Hardhat Example. Based on the Starknet Hardhat plugin.

Author

Claudio, clacla.eth