Skip to content

Commit

Permalink
feat: hardhat node but tests not running
Browse files Browse the repository at this point in the history
  • Loading branch information
Westlad committed Apr 10, 2024
1 parent 311ed93 commit 1e1f3d0
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 2 deletions.
4 changes: 4 additions & 0 deletions bin/setup-nightfall
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,7 @@ fi
if [[ -z "${NF_SERVICES_TO_START}" || "${NF_SERVICES_TO_START}" == *"worker"* ]]; then
docker-compose -f docker/docker-compose.yml -f docker/docker-compose.dev.yml build ${NO_CACHE_FLAG} worker
fi

if [[ -z "${NF_SERVICES_TO_START}" || "${NF_SERVICES_TO_START}" == *"blockchain"* ]]; then
docker-compose -f docker/docker-compose.yml -f docker/docker-compose.dev.yml -f docker/docker-compose.hardhat.yml build ${NO_CACHE_FLAG} blockchain
fi
4 changes: 2 additions & 2 deletions bin/start-nightfall
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ FILE=
usage()
{
echo "Usage:"
echo " -g or --ganache; for a ganache simulator"
echo " -g or --hardhat; for a hardhat simulator"
echo " -l or --localhost; to connect to an already running blockchain on ws://localhost:8546"
echo " -h or --help; to print this message"
echo " -d or --dev; to bind mount the filesystem and use it for development"
Expand All @@ -22,7 +22,7 @@ fi
rm -f ${ENV_FILE}
while [ -n "$1" ]; do
case $1 in
-g | --ganache ) FILE="-f docker/docker-compose.yml -f docker/docker-compose.ganache.yml";
-g | --hardhat ) FILE="-f docker/docker-compose.yml -f docker/docker-compose.hardhat.yml"
;;
-l | --localhost ) FILE="-f docker/docker-compose.yml -f docker/docker-compose.host.docker.internal.yml"
;;
Expand Down
13 changes: 13 additions & 0 deletions docker/docker-compose.hardhat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '3.5'
# Use this script for running up nightfall_3 in 'developer' mode with local
# bindings and using a Hardhat netwrok private blockchain. See the readme for more information.
# It acts as an override file for docker-compose.yml
services:
blockchain:
build:
dockerfile: docker/hardhat.Dockerfile
context: ..
networks:
- nightfall_network
ports:
- "8546:8546"
56 changes: 56 additions & 0 deletions docker/hardhat.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
FROM node:18.19.1-bullseye-slim

# This creates a 'hardhat network' blockchain node (replaces ganache)
WORKDIR /app
RUN npm install --save hardhat
RUN echo '\
module.exports = {\
networks: {\
hardhat: {\
chainId: 1337,\
accounts: [\
{\
privateKey: "0x4775af73d6dc84a0ae76f8726bda4b9ecf187c377229cb39e1afa7a18236a69e",\
balance: "10000000000000000000000",\
},\
{\
privateKey: "0x4775af73d6dc84a0ae76f8726bda4b9ecf187c377229cb39e1afa7a18236a69d",\
balance: "10000000000000000000000",\
},\
{\
privateKey: "0xd42905d0582c476c4b74757be6576ec323d715a0c7dcff231b6348b7ab0190eb",\
balance: "10000000000000000000000",\
},\
{\
privateKey: "0xfbc1ee1c7332e2e5a76a99956f50b3ba2639aff73d56477e877ef8390c41e0c6",\
balance: "10000000000000000000000",\
},\
{\
privateKey: "0xabf4ed9f30bd1e4a290310d726c7bbdf39cd75a25eebd9a3a4874e10b4a0c4ce",\
balance: "10000000000000000000000",\
},\
{\
privateKey: "0xcbbf1d0686738a444cf9f66fdc96289035c384c4e8d26768f94fa81f3ab6596a",\
balance: "10000000000000000000000",\
},\
{\
privateKey: "0x1da216993fb96745dcba8bc6f2ef5deb75ce602fd92f91ab702d8250033f4e1c",\
balance: "10000000000000000000000",\
},\
{\
privateKey: "0x955ff4fac3c1ae8a1b7b9ff197476de1f93e9f0bf5f1c21ff16456e3c84da587",\
balance: "10000000000000000000000",\
},\
],\
loggingEnabled: false,\
mining: {\
auto: false,\
interval: 1000,\
},\
},\
},\
}\
' > hardhat.config.js

EXPOSE 8546
ENTRYPOINT ["npx", "hardhat", "node", "--port", "8546", "--hostname", "0.0.0.0"]

0 comments on commit 1e1f3d0

Please sign in to comment.