01-edu / Branch-Blockchain

⛓️ Repository for the Blockchain branch content.
3 stars 5 forks source link

⛓️ Branch Blockchain

🐳 On Master - Build and Test Docker Image

Repository for the blockchain branch content and tests.

Content 📖

Exercises are progressive in difficulty. They are designed to learn the fundamentals of blockchains as well as the main technologies and tools used in the industry.

For more details see the introductions and the subjects

Tests ⚙️

Within the tests/ folder, run.sh builds a docker image and runs the tests. Solutions are expected to be in a tests/student folder. For each available solution file, the appropriate test will be launched individually. The docker daemon or docker desktop needs to be running.

cd tests
./run.sh

The final output should be similar to:

artists-do-work ✅ 4, basic-swap ✅ 4, basic-wallet ✅ 0, buy-tickets ✅ 2, check-document ✅ 6, connect-to-metamask ✅ 5, donation ✅ 6, eventful-token ✅ 3, fun-and-profit ✅ 3,
tests ran:9 in avg 4261 ms

It is also possible to run tests individually (with debug mode on):

./run.sh retrieve-block-date 

Commands

The following underlying commands can be launched individually from tests/ folder:

# build the docker image
docker build . -t blockchain 

# Run a BTC test
docker run --read-only --network none --memory 500M --user 1000:1000 -e DEBUG=true -e EXERCISE=retrieve-block-date --env HOME=/jail --env TMPDIR=/jail --workdir /jail --tmpfs /jail:size=100M,noatime,exec,nodev,nosuid,uid=1000,gid=1000,nr_inodes=5k,mode=1700 --volume $PWD/student.all:/jail/student:ro blockchain:latest

# Explore the docker image
docker run -it --entrypoint /bin/bash blockchain:latest

Authors ✍️

Xavier Lavayssière - 🐙 🐦