blob: 1c9eae25fddb20583327a44956d6043f5a657dc2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# Gradecoin
[![ci](https://github.com/yigitsever/gradecoin/actions/workflows/rust.yml/badge.svg?branch=main)](https://github.com/yigitsever/gradecoin/actions/workflows/rust.yml)
Gradecoin is a undergraduate level cryptography simulation/game that masquerades as a cryptocurrency.
The project is live at https://gradecoin.yigitsever.com.
```sh
# Test the project
$ cargo test
# Read the documentation
$ cargo doc --open
```
The executable `main` needs the `/templates`, `users` and `blocks` folders. It also expects a `secrets/gradecoin.pem` file with the private key of the system.
# Running Locally
Create RSA keys:
```sh
$ mkdir secrets
$ cd secrets
$ openssl genrsa -out gradecoin.pem 2048
$ openssl rsa -in gradecoin.pem -outform PEM -pubout -out gradecoin.pub
```
Use `gradecoin.pub` file in your client program.
Create students list: `students.csv` should be in the following form:
```
User ID, Password
e123456,register_password
e123456,register_password
```
First line is ignored.
Run the server:
```sh
$ cargo run
```
The server should be up on `localhost:8080`.
We recommend using Nginx to reverse proxy Gradecoin so it can be served as HTTPS.
The default config file is `config.yaml`.
You can specify another config file with:
```sh
$ cargo run another_config.yaml
```
You can even run multiple networks at once by giving multiple configuration files:
```sh
# Run both the main network (at /) and testnet (at /testnet)
# For example, register for main network at `localhost:8080/register`,
# testnet network at `localhost:8080/testnet/register`
$ cargo run config.yaml testnet.yaml
```
In the config file, `url_prefix` field determines the address of the network.
You can clear the database for all networks by running:
```sh
$ rm -rf blocks users
```
Or you can delete the database for a particular network by removing `blocks/network_name` and `users/network_name`.
|