A starter template for building on Midnight Network with React frontend and smart contract integration.
# Install and initialize Git LFS
sudo dnf install git-lfs # For Fedora/RHEL
git lfs install
# Install the latest Compact tools
curl --proto '=https' --tlsv1.2 -LsSf \
https://github.com/midnightntwrk/compact/releases/latest/download/compact-installer.sh | sh
# Install the latest compiler
compact update
# Check versions
node -v # v18+
npm -v # v9+
docker -v
git lfs version
compact check # Should show latest version
├── counter-cli/ # CLI tools
├── counter-contract/ # Smart contracts
└── frontend-vite-react/ # React application
-
Set Network ID
- Open
frontend-vite-react/src/App.tsx
- Ensure
setNetworkId(NetworkId.TestNet)
is set
- Open
-
Configure Contract Address
- In the same file, locate the
contractAddress
constant - Replace with a Counter Testnet-network contract address
- In the same file, locate the
-
Start Development
# In one terminal (from project root) npm install npm run build npm run start-app-testnet
-
Configure Your own wallet Address
- Open
counter-cli/src/scripts/prepare-standalone.test.ts
- Replace with your own undeployed-network wallet address
- Open
-
Set Network ID
- Open
frontend-vite-react/src/App.tsx
- Change to
setNetworkId(NetworkId.Undeployed)
- Open
-
Start Local Development
# In one terminal (from project root) npm install npm run build npm run dev:undeployed-instances # In another terminal (from project root) npm run start-app-undeployed
-
Configure Contract Address
- You will need to deploy a new contract in the undeployed-network first
- Open
frontend-vite-react/src/App.tsx
, locate thecontractAddress
constant, and replace it with the newly deployed contract address