https://github.com/amanusk/cairo-paradigm-ctf
Solutions and scripts for Cairo Challenges of Paradigm CTF 2022
https://github.com/amanusk/cairo-paradigm-ctf
cairo cairo-lang ctf-solutions ctf-writeups starknet
Last synced: 8 months ago
JSON representation
Solutions and scripts for Cairo Challenges of Paradigm CTF 2022
- Host: GitHub
- URL: https://github.com/amanusk/cairo-paradigm-ctf
- Owner: amanusk
- Created: 2022-08-25T08:56:54.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-25T12:46:31.000Z (over 3 years ago)
- Last Synced: 2025-01-29T04:16:00.212Z (10 months ago)
- Topics: cairo, cairo-lang, ctf-solutions, ctf-writeups, starknet
- Language: Cairo
- Homepage:
- Size: 313 KB
- Stars: 11
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Running Cairo paradigm CTF solutions locally
This repository contains solutions for the Cairo challenges of the 2022 Paradigm-CTF
## Creating env instructions
- create virtual environment
```
python3 -m venv ./venv
source ./venv/bin/activate
```
- Install requirements
```
pip install -requirements ./requirements.txt
```
- Run the server for deploying local environments
```
cd ./paradigm-ctf-infrastructure/images/cairo-challenge-base
python -m cairo_sandbox.server
```
## Compiling the contracts
The compiled contrats have already been place in the correct direcotry.
### Compiling the contrats from source:
Contracts can be compiled by running `nile compile`. This generates both the compiled contract files and abis in the `artifacts` dir
Although the generated files have a `.json` extension, the individual challenge scripts expect the file to be named `.cairo`
- Rename files to fit format: (for example)
`mv artifacts/almost_erc20.json compiled/almost_erc20.cairo`
Copy the files to the infrastructure directory: (for example)
`cp ./artifacts/almost_erc20.json paradigm-ctf-infrastructure/images/cairo-challenge-base/compiled/almost_erc20.cairo`
## Running individual challanges
- Run the challenge script. The sever script should already be running in another terminal.
```
cd ./paradigm-ctf-infrastructure/images/cairo-challenge-base
python -m cairo_sandbox.proxy-chal.py
```
- Choose option 1 to create new environment
- Input any number (e.g. 1) as ticket
- Wait for the contracts to be deployed
- Copy the `rpc endpoint`, `private key` and `contract` to their respecable value in the solution script
## Run the solution script
Run the solution script with
```
python ./scripts/cairo-auction.py
```
## Thanks
If you like it then you shoulda put a start ⭐ on it
Twitter: [@amanusk\_](https://twitter.com/amanusk_)
## License
MIT