xinetd docker for building ethereum contract challenges in capture the flag (CTF).
docker run -it -p 20000:20000 -e WEB3_PROVIDER_URI=https://ropsten.infura.io/v3/YOUR-PROJECT-ID chainflag/eth-challenge-base
nc 127.0.0.1 20000
Create challenge project based on example
contracts
is the challenge contract directory, you should code isSolved() function for the contract to check if it is solvedchallenge.yml
is the config for specifying challenge description, flag, contract name, constructor, gas limit etc. See comments in this file for more detail.env
is used to set environment variables of docker container, including web3 provider, token secret and proof of work difficulty
Environment variable defaults
Name | Default Value |
---|---|
TOKEN_SECRET | openssl rand |
POW_DIFFICULTY | 0(no proof of work) |
You can build multi-contract challenges by deploying contracts in a setup contract's constructor
docker run -d -p 20000:20000 --env-file .env -v `pwd`/contracts:/home/ctf/contracts -v `pwd`/challenge.yml:/home/ctf/challenge.yml chainflag/eth-challenge-base:0.9.3
or
docker-compose up -d
- Launch an anti-plagiarism PoA network by referring here
- Keep the web3 provider defaults in the
.env
file - Run the docker container using the following command
docker run -d -p 20000:20000 --network geth_default --env-file .env -v `pwd`/contracts:/home/ctf/contracts -v `pwd`/challenge.yml:/home/ctf/challenge.yml chainflag/eth-challenge-base:0.9.3
- Python3
- Packages
pip install -r requirements.txt
python develop.py
pip install -r requirements-dev.txt
make format
Distributed under the MIT License. See LICENSE for more information.