helpers | ||
models | ||
utils | ||
.dockerignore | ||
.gitignore | ||
.mega-linter.yml | ||
docker-compose.yml | ||
Dockerfile | ||
go.mod | ||
go.sum | ||
KermaProtocol.pdf | ||
main.go | ||
Makefile | ||
README.md | ||
run.sh | ||
test.txt |
KermaGo
What is this?
This repo is a Go implementation of the Kerma cryptocurrency, specified as a challenge to the TUWien Cryptocurrency course. For more information adhere to the protocol specification. All rights belong to Dr. Zeta Avarikioti and Prof. Matteo Maffei from TUWien.
Prerequisites
GNU Make and docker/Go installed on the machine
Config via environment variables
Name | Description | Default value |
---|---|---|
KERMA_DEBUG |
Run in debug mode | false |
KERMA_IP_ADDR |
Public IP Address to return to other nodes (if node behind port-forwarding) | 3.126.74.45 |
KERMA_PORT |
Port to listen on | 18018 |
KERMA_CONN_TIMEOUT |
Connection timeout | 10 |
KERMA_INITIAL_PEER_LIST |
Comma-separated string of initial peers to connect to | "" |
KERMA_STORE_BASE_DIR |
Base directory to store data. The docker container will mount this under ./data in the current directory |
/var/local/badkerma |
KERMA_PEER_LIST_STORE |
Filename of the peer list | peers.json |
KERMA_BLOCK_STORE |
Filename of the blockchain | blocks.json |
KERMA_TRANSACTION_STORE |
Filename of the transactions | transactions.json |
KERMA_PRIVATE_KEY_FILE |
Filename of the private key file | private.pem |
You can create a .env
file and docker will read the variables from there.
NOTE: You need to set KERMA_INITIAL_PEER_LIST
to a valid node address when running the node for the first time or after you have cleaned the persistent store. Thereafter, the node gossips a known node list and keeps it up-to-date.
Run it locally
make run
Compile it locally
make build
Test it locally
make test
You can also test with netcat. Start the program and run:
cat test.txt | nc localhost 18018 -p 50001
Run in debug mode locally
make debug
Build the docker image
DOCKER_REGISTRY=localhost make docker-build
Run docker container in debug mode
DOCKER_REGISTRY=localhost make docker-debug
Run docker container in background
DOCKER_REGISTRY=localhost make docker-run
Stop running docker container
make docker-stop