Welcome to the exciting world of Solidity Capture the Flag (CTF) challenges! With SolidCTF, an infrastructure solution designed to make CTF challenge setup simpler and quicker, you can focus on what truly matters – creating engaging smart contract puzzles. In this article, we’ll provide a step-by-step guide on how to get started with SolidCTF, from installation to running your first challenge.
Getting Started
Let’s dive right into setting up SolidCTF. Below, you will find a quick demo command to run SolidCTF.
Quick Demo
To run a quick demo of SolidCTF, use the following command:
docker run -it -p 20000:20000 -e WEB3_PROVIDER_URI=https://rpc.sepolia.org chainflagsolidctf:1.0 nc 127.0.0.1 20000
Usage Instructions
Follow these steps to create a new challenge project using SolidCTF:
- Clone the solidity-ctf-template repository:
- Navigate to the contract directory and code your challenge contract. Make sure to implement the isSolved() function to replace the example contract.
- For multi-contract challenges, deploy them using the constructor in your setup contract.
- Edit the challenge.yml file to configure your challenge. Check the comments within the file for configuration details.
- Put your flag in the flag.txt file and update the private key for the alloc address in the .env file.
- Finally, run the following commands to start serving your challenge:
git clone git@github.com:chainflag/solidity-ctf-template.git
docker-compose pull
docker-compose up -d
Development Mode Setup
To run SolidCTF in development mode, ensure you have the following prerequisites:
- Docker
- Python3
- Required packages (install via
pip install -r requirements.txt
)
Now, follow these steps:
- Clone the SolidCTF repository:
- Generate protobuf code and run the server:
git clone git@github.com:chainflag/solidctf.git
git submodule update --init --recursive
make proto
export WEB3_PROVIDER_URI=your_web3_provider
make dev
Python Source Code Formatting
To format the Python source code, you will need to install additional packages:
pip install -r requirements-dev.txt
Then run the formatting command:
make format
Troubleshooting
If you encounter any issues while running SolidCTF, consider these troubleshooting steps:
- Ensure that Docker is installed and running properly on your machine.
- Check your Web3 provider URL; make sure it is correct and accessible.
- If you experience issues with dependencies, try reinstalling them via pip.
- Review the configuration details in the
challenge.yml
file to make sure everything is set up correctly.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Conclusion
By following these steps, you should be well-equipped to create and manage your own Solidity CTF challenges using SolidCTF. Have fun designing your puzzles and testing your skills!
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.