diff options
-rw-r--r-- | content/_index.md | 18 | ||||
-rw-r--r-- | content/block_docs.md | 2 | ||||
-rw-r--r-- | content/misc_docs.md | 7 | ||||
-rw-r--r-- | content/register_docs.md | 6 | ||||
-rw-r--r-- | content/transaction_docs.md | 4 |
5 files changed, 18 insertions, 19 deletions
diff --git a/content/_index.md b/content/_index.md index 733fcbd..0023e9e 100644 --- a/content/_index.md +++ b/content/_index.md | |||
@@ -7,7 +7,7 @@ sort_by = "weight" | |||
7 | Blockchains are incredibly simple, but they can seem very complicated. | 7 | Blockchains are incredibly simple, but they can seem very complicated. |
8 | We will see how they work and practice programming _production grade_ cryptography code. | 8 | We will see how they work and practice programming _production grade_ cryptography code. |
9 | 9 | ||
10 | This server is the sandbox for PA1 and it is currently running the Gradecoin application. | 10 | This server is the sandbox for PA1, and it is currently running the Gradecoin application. |
11 | Gradecoin is the faux currency we will use to simulate a blockchain network. | 11 | Gradecoin is the faux currency we will use to simulate a blockchain network. |
12 | **At the end of the simulation, the amount of Gradecoin you hold will be your PA1 grade.** | 12 | **At the end of the simulation, the amount of Gradecoin you hold will be your PA1 grade.** |
13 | 13 | ||
@@ -27,7 +27,7 @@ Then you can earn block rewards by proposing blocks, create some Gradecoins by g | |||
27 | The first transactions of a block is called the `coinbase`. They are the **author** of the block proposal and if the block is accepted then they get compensated for their efforts with some Gradecoin. | 27 | The first transactions of a block is called the `coinbase`. They are the **author** of the block proposal and if the block is accepted then they get compensated for their efforts with some Gradecoin. |
28 | 28 | ||
29 | # Public Key Signatures | 29 | # Public Key Signatures |
30 | Gradecoin uses 2048 bit RSA keypairs. | 30 | Gradecoin uses 2048-bit RSA key pairs. |
31 | 31 | ||
32 | # Services | 32 | # Services |
33 | Please respect the system and others. | 33 | Please respect the system and others. |
@@ -35,7 +35,7 @@ Keep your request rate below a reasonable limit. | |||
35 | Programming a bot is absolutely fine as long as it's not aggressively sending requests. | 35 | Programming a bot is absolutely fine as long as it's not aggressively sending requests. |
36 | 36 | ||
37 | ## /register | 37 | ## /register |
38 | - Create your own 2048 bit RSA `keypair` | 38 | - Create your own 2048-bit RSA `keypair` |
39 | - Download `Gradecoin`'s public key from [ODTUClass](https://odtuclass.metu.edu.tr/my/) | 39 | - Download `Gradecoin`'s public key from [ODTUClass](https://odtuclass.metu.edu.tr/my/) |
40 | - Encrypt your [JSON](https://www.json.org/json-en.html) wrapped `Public Key`, `Student ID` and one time `passwd` using Gradecoin's public key | 40 | - Encrypt your [JSON](https://www.json.org/json-en.html) wrapped `Public Key`, `Student ID` and one time `passwd` using Gradecoin's public key |
41 | - Your public key is now in the database. You can use your private key to sign your JWTs during requests | 41 | - Your public key is now in the database. You can use your private key to sign your JWTs during requests |
@@ -56,7 +56,7 @@ Programming a bot is absolutely fine as long as it's not aggressively sending re | |||
56 | - Fetch the last accepted `Block` with a GET request | 56 | - Fetch the last accepted `Block` with a GET request |
57 | - For more information, check our [block](@/block_docs.md) page | 57 | - For more information, check our [block](@/block_docs.md) page |
58 | 58 | ||
59 | > `Authorization`: The request header should have Bearer JWT.Token signed with student's private key | 59 | > `Authorization`: The request header should have `Bearer JWT.Token` signed with student's private key |
60 | 60 | ||
61 | ## /user | 61 | ## /user |
62 | - Looking for people to conduct business with? Everyone is listed on this page! | 62 | - Looking for people to conduct business with? Everyone is listed on this page! |
@@ -74,9 +74,9 @@ I've trained them personally using state-of-the-art neural networks running on t | |||
74 | # Questions | 74 | # Questions |
75 | ## This all sound complicated! | 75 | ## This all sound complicated! |
76 | - I've drawn inspiration from [actual Bitcoin transactions](https://explorer.bitcoin.com/btc) and [warp](https://github.com/seanmonstar/warp/blob/master/examples/todos.rs). The system has only 3 interfaces. It's simple once you read everything over a couple of times. | 76 | - I've drawn inspiration from [actual Bitcoin transactions](https://explorer.bitcoin.com/btc) and [warp](https://github.com/seanmonstar/warp/blob/master/examples/todos.rs). The system has only 3 interfaces. It's simple once you read everything over a couple of times. |
77 | - Don't know where to start? Gradecoin uses RESTful API; simple `curl` commands or even your browser will work! [This website can help as well](https://curl.trillworks.com/). | 77 | - Don't know where to start? Gradecoin uses RESTful API; simple `curl` commands or even your browser will work! [This website can help as well](https://sqqihao.github.io/trillworks.html). |
78 | - Check out [JWT Debugger](https://jwt.io) and the corresponding [RFC](https://tools.ietf.org/html/rfc7519). | 78 | - Check out [JWT Debugger](https://jwt.io) and the corresponding [RFC](https://tools.ietf.org/html/rfc7519). |
79 | - Remember that you are absolutely encouraged to grab off-the-shelf implementations for every cryptography primitive you will use. You can start by finding a code snippet to generate a RSA keypair? | 79 | - Remember that you are absolutely encouraged to grab off-the-shelf implementations for every cryptography primitive you will use. You can start by finding a code snippet to generate an RSA key pair? |
80 | - Check out [misc](@/misc_docs.md) for everything else you might be curious about. | 80 | - Check out [misc](@/misc_docs.md) for everything else you might be curious about. |
81 | 81 | ||
82 | ## How do you actually earn Gradecoin? | 82 | ## How do you actually earn Gradecoin? |
@@ -89,12 +89,12 @@ I've trained them personally using state-of-the-art neural networks running on t | |||
89 | Thank you! Please [let me know](mailto:yigit@ceng.metu.edu.tr) so we can solve it. | 89 | Thank you! Please [let me know](mailto:yigit@ceng.metu.edu.tr) so we can solve it. |
90 | 90 | ||
91 | ## I hacked the server! | 91 | ## I hacked the server! |
92 | That wasn't supposed to happen :( I did not place any intentional vulnerabilities to the system so if you cracked something, it was not intended. Please don't abuse it and let me know so I can patch it. | 92 | That wasn't supposed to happen 😢. I did not place any intentional vulnerabilities to the system so if you cracked something, it was not intended. Please don't abuse it and let me know, so I can patch it. |
93 | 93 | ||
94 | ## I want to contribute! | 94 | ## I want to contribute! |
95 | Thank you! The code for Gradecoin and this site are open source so you can take a look and let me know if you have any improvements, corrections, typos to point out or whatever. | 95 | Thank you! The code for Gradecoin and this site are open source, so you can take a look and let me know if you have any improvements, corrections, typos to point out or whatever. |
96 | Both documentation (this site) and code contributions are appreciated. | 96 | Both documentation (this site) and code contributions are appreciated. |
97 | [My git server](https://git.yigitsever.com/) will be somewhat ahead of the [GitHub](https://github.com/yigitsever/gradecoin) repository but I will sync them at every major milestone. | 97 | [My git server](https://git.yigitsever.com/) will be somewhat ahead of the [GitHub](https://github.com/yigitsever/gradecoin) repository, but I will sync them at every major milestone. |
98 | 98 | ||
99 | ## Submission? | 99 | ## Submission? |
100 | At the end of the _simulation_, your Gradecoin balance will be your grade. I will also expect your client for submission, programmed in either; | 100 | At the end of the _simulation_, your Gradecoin balance will be your grade. I will also expect your client for submission, programmed in either; |
diff --git a/content/block_docs.md b/content/block_docs.md index 807403c..dccd23b 100644 --- a/content/block_docs.md +++ b/content/block_docs.md | |||
@@ -12,7 +12,7 @@ We use Blocks to commit proposed [Transactions](@/transaction_docs.md) to the le | |||
12 | In order to create a valid block, the proposer must find a suitable `nonce` value that makes the `hash` of the block valid. | 12 | In order to create a valid block, the proposer must find a suitable `nonce` value that makes the `hash` of the block valid. |
13 | The properties a valid hash should have will be explained in subsequent sections. | 13 | The properties a valid hash should have will be explained in subsequent sections. |
14 | 14 | ||
15 | We are _mining_ using [blake2s](https://www.blake2.net/) algorithm, which produces 256 bit hashes. | 15 | We are _mining_ using [blake2s](https://www.blake2.net/) algorithm, which produces 256-bit hashes. |
16 | Hash/second is roughly {{ exp(num="20x10", exponent="3") }} on my machine, a new block can be mined in around 4-6 minutes. | 16 | Hash/second is roughly {{ exp(num="20x10", exponent="3") }} on my machine, a new block can be mined in around 4-6 minutes. |
17 | 17 | ||
18 | # Requests | 18 | # Requests |
diff --git a/content/misc_docs.md b/content/misc_docs.md index a318251..6cfb260 100644 --- a/content/misc_docs.md +++ b/content/misc_docs.md | |||
@@ -7,10 +7,10 @@ weight = 10 | |||
7 | # Fingerprint | 7 | # Fingerprint |
8 | ## Definition | 8 | ## Definition |
9 | 9 | ||
10 | A fingerprint is a 256 bit 64 character hexadecimal user identifier for users. Fingerprints are used in defining users in [transactions](@/transaction_docs.md) and [blocks](@/block_docs.md). | 10 | Fingerprints are 256-bit, 64 character hexadecimal user identifiers. Fingerprints are used in defining users in [transactions](@/transaction_docs.md) and [blocks](@/block_docs.md). |
11 | 11 | ||
12 | ## Fingerprint Generation | 12 | ## Fingerprint Generation |
13 | A user's finger print is generated via applying SHA256 sum of the user's public RSA key. | 13 | A user's fingerprint is generated via applying SHA256 sum of the user's public RSA key. |
14 | 14 | ||
15 | # Config | 15 | # Config |
16 | The [/config](/config) endpoint will return the current parameters that Gradecoin uses. | 16 | The [/config](/config) endpoint will return the current parameters that Gradecoin uses. |
@@ -19,7 +19,7 @@ The [/config](/config) endpoint will return the current parameters that Gradecoi | |||
19 | - `url_prefix`: URL prefix for the network. All API commands will be served under this prefix. | 19 | - `url_prefix`: URL prefix for the network. All API commands will be served under this prefix. |
20 | - For example, if url_prefix is `example`, register at `gradecoin.xyz/example/register`. | 20 | - For example, if url_prefix is `example`, register at `gradecoin.xyz/example/register`. |
21 | - It can be empty, in which case the endpoints are accessed directly from `/`. Example: `gradecoin.xyz/register`. | 21 | - It can be empty, in which case the endpoints are accessed directly from `/`. Example: `gradecoin.xyz/register`. |
22 | - `preapproved_users`: The name of the CSV file that contains the list of users who can register. This doesn't concern you as an end-user. | 22 | - `preapproved_users`: The name of the CSV file that contains the list of users who can register. Only relevant for the admins. |
23 | - `block_transaction_count`: A valid block should have at least this many transactions. | 23 | - `block_transaction_count`: A valid block should have at least this many transactions. |
24 | - `hash_zeros`: Determines the number of zero hexadecimal characters a correct hash should start with. | 24 | - `hash_zeros`: Determines the number of zero hexadecimal characters a correct hash should start with. |
25 | - `register_bonus`: Initial registration bonus. This will determine your balance after registration. | 25 | - `register_bonus`: Initial registration bonus. This will determine your balance after registration. |
@@ -32,6 +32,5 @@ The [/config](/config) endpoint will return the current parameters that Gradecoi | |||
32 | - Each key will be the fingerprint of a bot. | 32 | - Each key will be the fingerprint of a bot. |
33 | - Each value will be another JSON object. Currently, it only contains one self-explanatory field: `starting_balance`. | 33 | - Each value will be another JSON object. Currently, it only contains one self-explanatory field: `starting_balance`. |
34 | 34 | ||
35 | |||
36 | # Version | 35 | # Version |
37 | The [/version](/version) endpoint will return the current version that's currently live on this server. | 36 | The [/version](/version) endpoint will return the current version that's currently live on this server. |
diff --git a/content/register_docs.md b/content/register_docs.md index 9f5596e..f5bd11d 100644 --- a/content/register_docs.md +++ b/content/register_docs.md | |||
@@ -4,19 +4,19 @@ description = "Register Documentation" | |||
4 | weight = 3 | 4 | weight = 3 |
5 | +++ | 5 | +++ |
6 | 6 | ||
7 | Here you can authenticate yourself with the system with **your own RSA keypair**. | 7 | Here you can authenticate yourself with the system with **your own RSA key pair**. |
8 | Only people who are enrolled to the class can open Gradecoin accounts, with some exceptions for people who asked nicely. | 8 | Only people who are enrolled to the class can open Gradecoin accounts, with some exceptions for people who asked nicely. |
9 | This is enforced with your Student ID (e123456) and a one time password you received with your complementary *Welcome to Gradecoin* email. | 9 | This is enforced with your Student ID (e123456) and a one time password you received with your complementary *Welcome to Gradecoin* email. |
10 | 10 | ||
11 | # Authentication Process | 11 | # Authentication Process |
12 | > The cryptographic outputs you are sending over the network are all Base64 Encoded | 12 | > The cryptographic outputs you are sending over the network are all Base64 Encoded |
13 | 13 | ||
14 | - Gradecoin's Public Key (`gradecoin_public_key`) is listed on our Moodle page and [here](/gradecoin.pub). Download and load it it to your client. | 14 | - Gradecoin's Public Key (`gradecoin_public_key`) is listed on our Moodle page and [here](/gradecoin.pub). Download and load it to your client. |
15 | - Create a JSON object (`P_AR`) with your `metu_id` ("e"+`6 chars`) and the `public key` you have created before in base64 (PEM) format (`S_PK`) [reference](https://tls.mbed.org/kb/cryptography/asn1-key-structures-in-der-and-pem) | 15 | - Create a JSON object (`P_AR`) with your `metu_id` ("e"+`6 chars`) and the `public key` you have created before in base64 (PEM) format (`S_PK`) [reference](https://tls.mbed.org/kb/cryptography/asn1-key-structures-in-der-and-pem) |
16 | ```json | 16 | ```json |
17 | { | 17 | { |
18 | "student_id": "e123456", | 18 | "student_id": "e123456", |
19 | "passwd": "15 char secret", | 19 | "passwd": "32 char secret", |
20 | "public_key": "---BEGIN PUBLIC KEY..." | 20 | "public_key": "---BEGIN PUBLIC KEY..." |
21 | } | 21 | } |
22 | ``` | 22 | ``` |
diff --git a/content/transaction_docs.md b/content/transaction_docs.md index 3b4c2a1..3c556b4 100644 --- a/content/transaction_docs.md +++ b/content/transaction_docs.md | |||
@@ -29,7 +29,7 @@ Since there are many ways to convert an object to JSON, we enforce the following | |||
29 | - The order of fields should be exactly as shown above. | 29 | - The order of fields should be exactly as shown above. |
30 | - All keys and string values must be enclosed with quotation marks (`"`). | 30 | - All keys and string values must be enclosed with quotation marks (`"`). |
31 | 31 | ||
32 | Here's an example demostrating how your JSON string should look like: | 32 | Here's an example on how your JSON string should look like: |
33 | ```json | 33 | ```json |
34 | {"source":"bar","target":"baz","amount":2,"timestamp":"2021-04-18T21:49:00"} | 34 | {"source":"bar","target":"baz","amount":2,"timestamp":"2021-04-18T21:49:00"} |
35 | ``` | 35 | ``` |
@@ -39,7 +39,7 @@ Here's an example demostrating how your JSON string should look like: | |||
39 | - You cannot create multiple transactions with the same `source`/`target` pair. | 39 | - You cannot create multiple transactions with the same `source`/`target` pair. |
40 | - Transactions generate traffic which is something we desperately need in Gradecoin, so for every transaction you send, some Gradecoin will be generated out of thin air and will appear on your account. | 40 | - Transactions generate traffic which is something we desperately need in Gradecoin, so for every transaction you send, some Gradecoin will be generated out of thin air and will appear on your account. |
41 | - The amount of Gradecoin that will be generated is given by `tx_traffic_reward` field of [`/config`](/config). | 41 | - The amount of Gradecoin that will be generated is given by `tx_traffic_reward` field of [`/config`](/config). |
42 | - For example, if `tx_traffic_reward` is 1 and you send 2 coins, only 1 coin will be deduced from your account since you will be given 1 coin for generating traffic. The target will receive 2 coins. | 42 | - For example, if `tx_traffic_reward` is 1, and you send 2 coins, only 1 coin will be deduced from your account since you will be given 1 coin for generating traffic. The target will receive 2 coins. |
43 | - On the other hand, transactions have to be processed which requires valuable CPU power. So, an amount named `tx_gas_fee` of [`/config`](/config) is deducted from the user on every transaction proposal to cover the cost. | 43 | - On the other hand, transactions have to be processed which requires valuable CPU power. So, an amount named `tx_gas_fee` of [`/config`](/config) is deducted from the user on every transaction proposal to cover the cost. |
44 | - Don't worry if your transaction goes unaccepted! Transactions do not disappear until they are committed into the ledger with a block. | 44 | - Don't worry if your transaction goes unaccepted! Transactions do not disappear until they are committed into the ledger with a block. |
45 | - Every transaction has a unique ID generated using the `source`, `target` and `timestamp` fields. | 45 | - Every transaction has a unique ID generated using the `source`, `target` and `timestamp` fields. |