97 lines
2.2 KiB
Markdown
97 lines
2.2 KiB
Markdown
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](./KermaProtocol.pdf).
|
|
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
|
|
---
|
|
|
|
```bash
|
|
make run
|
|
```
|
|
|
|
Compile it locally
|
|
---
|
|
|
|
```bash
|
|
make build
|
|
```
|
|
|
|
Test it locally
|
|
---
|
|
|
|
```bash
|
|
make test
|
|
```
|
|
|
|
You can also test with netcat. Start the program and run:
|
|
|
|
```bash
|
|
cat test.txt | nc localhost 18018 -p 50001
|
|
```
|
|
|
|
Run in debug mode locally
|
|
---
|
|
|
|
```bash
|
|
make debug
|
|
```
|
|
|
|
Build the docker image
|
|
---
|
|
|
|
```bash
|
|
DOCKER_REGISTRY=localhost make docker-build
|
|
```
|
|
|
|
Run docker container in debug mode
|
|
---
|
|
|
|
```bash
|
|
DOCKER_REGISTRY=localhost make docker-debug
|
|
```
|
|
|
|
Run docker container in background
|
|
---
|
|
|
|
```bash
|
|
DOCKER_REGISTRY=localhost make docker-run
|
|
```
|
|
|
|
Stop running docker container
|
|
---
|
|
|
|
```bash
|
|
make docker-stop
|
|
```
|