diff options
Diffstat (limited to 'content/_index.md')
-rw-r--r-- | content/_index.md | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/content/_index.md b/content/_index.md new file mode 100644 index 0000000..d0be673 --- /dev/null +++ b/content/_index.md | |||
@@ -0,0 +1,98 @@ | |||
1 | +++ | ||
2 | title = "Gradecoin" | ||
3 | sort_by = "weight" | ||
4 | +++ | ||
5 | |||
6 | # Welcome to Gradecoin! | ||
7 | |||
8 | Blockchains are incredibly simple yet can appear very complicated, we will see how they work and practice programming _production_ cryptography code. | ||
9 | |||
10 | This server is the sandbox for the PA1, it's currently running the Gradecoin application. Gradecoin is the faux currency we will use to simulate a blockchain network. At the end of the simulation, the amount of Gradecoin you hold will be your PA1 grade. | ||
11 | |||
12 | **A quick summary**: authenticate yourself to the system using public key encryption. | ||
13 | Craft [Transaction](@/transaction_docs.md) proposals and tag them using [JWTs](@/JWT.md). | ||
14 | When there are enough transactions then you can propose [Blocks](@/block_docs.md) in the same way. | ||
15 | Blocks need to be _mined_ beforehand using Proof-of-work, or brute force. | ||
16 | |||
17 | Gradecoin offers 3 endpoints at [/register](/register), [/block](/block) and [/transaction](/transaction). You can only send GET requests to /block and /transaction without authorization. | ||
18 | The server is programmed in [RESTful](https://www.service-architecture.com/articles/web-services/representational_state_transfer_rest.html) architecture, there are no `DELETE`, `PUT` or `UPDATE` operations, though. | ||
19 | |||
20 | Gradecoin uses a Proof-of-work block accepting mechanism. It uses single round [Blake2s](https://www.blake2.net/) hashing which produces 256-bit (64 hexadecimal characters) output. The [target](https://wiki.bitcoinsv.io/index.php/Target) hash is _24 bits_ or _6 hexadecimal characters_ of 0. During testing, I could mine a block on average around 4-6 minutes. | ||
21 | |||
22 | > We're expecting you to use existing tools and implementations. Standards are hard. [Don't roll your own crypto](https://www.reddit.com/r/crypto/comments/2coqsy/dont_roll_your_own/). Feel free to ask questions. Collaborate. | ||
23 | |||
24 | You might ask, | ||
25 | |||
26 | > But if nobody has any Gradecoin then how do we have transactions? | ||
27 | |||
28 | There is a bank! Their public key is `31415926535897932384626433832795028841971693993751058209749445923` and they have some amount of Gradecoin preloaded. It's also the only account that you can send transactions requests _to_ yourself. | ||
29 | |||
30 | # Coinbase | ||
31 | 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. | ||
32 | |||
33 | # Public Key Signatures | ||
34 | Gradecoin uses 2048 bit RSA keypairs. | ||
35 | |||
36 | # Services | ||
37 | ## /register | ||
38 | - Create your own 2048 bit RSA `keypair` | ||
39 | - Download `Gradecoin`'s Public Key from [Moodle](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 | ||
41 | - Your public key is now in our database and can be used to sign your JWT's during requests | ||
42 | - For more information, check the [register](@/register_docs.md) page | ||
43 | |||
44 | ## /transaction | ||
45 | - You can offer a [Transaction](@/transaction_docs.md) with a POST request | ||
46 | - The request should have `Authorization` | ||
47 | - The request header should be signed by the Public Key of the `by` field in the transaction | ||
48 | - Fetch the list of `Transaction`s with a GET request | ||
49 | - For more information, check our [transaction](@/transaction_docs.md) page | ||
50 | |||
51 | ## /block | ||
52 | - Offer a [Block](@/block_docs.md) with a POST request | ||
53 | - The request should have `Authorization` | ||
54 | - The `transaction_list` of the block should be a subset of pending transactions, available on [/transaction](/transaction) | ||
55 | - Fetch the last accepted `Block` with a GET request | ||
56 | - For more information, check our [block](@/block_docs.md) page | ||
57 | |||
58 | `Authorization`: The request header should have Bearer JWT.Token signed with Student Public Key | ||
59 | |||
60 | ## /user | ||
61 | - Meant to be used in the browser, you can see the current list of users and their balance here | ||
62 | |||
63 | # Questions | ||
64 | ## This all sound complicated! | ||
65 | - 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 simplicity of the system is how little interfaces it has. | ||
66 | - 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/). | ||
67 | - [JWT Debugger](https://jwt.io) and the corresponding [RFC](https://tools.ietf.org/html/rfc7519). | ||
68 | - 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? | ||
69 | - Check out [misc](@/misc_docs.md) for everything else you might be curious about. | ||
70 | |||
71 | ## How do you actually earn Gradecoin? | ||
72 | - Register yourself to at [/register](@/register_docs.md) | ||
73 | - Create transactions at [/transaction](@/transaction_docs.md) | ||
74 | - Create blocks to commit transactions at [/block](@/block_docs.md) | ||
75 | - See how everyone is doing and find people to trade with at [/user](/user) | ||
76 | |||
77 | ## I found a bug! | ||
78 | Thank you! Please [let me know](mailto:yigit@ceng.metu.edu.tr) so we can solve it. | ||
79 | |||
80 | ## I hacked the server! | ||
81 | 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. | ||
82 | |||
83 | ## Submission? | ||
84 | At the end of the _simulation_, your Gradecoin balance will be your grade. I will also expect a unique client programmed in either; | ||
85 | - c | ||
86 | - c++ | ||
87 | - perl | ||
88 | - rust | ||
89 | - python | ||
90 | - random assortment of bash scripts | ||
91 | |||
92 | If your favourite programming language is missing please let me know 🤷? | ||
93 | |||
94 | ## Can my friends play? | ||
95 | Sadly, no. Student's who are enrolled to the class will receive one-time-passwords for authentication. | ||
96 | |||
97 | ## How and or Why? | ||
98 | - [Built](https://xkcd.com/2314/), [with](https://lofi.cafe/) [Rust](https://xkcd.com/2418/) | ||