diff options
author | Yigit Sever | 2021-04-19 18:21:06 +0300 |
---|---|---|
committer | Yigit Sever | 2021-04-19 18:21:06 +0300 |
commit | df6fa5f322fc972b3894e720f2c406eb2d8f5f5a (patch) | |
tree | 4864006b54c512dea971d0c50efcacca65b12c6e /site/public/block-docs/index.html | |
parent | d1b2e4bbd8f1ec5fe40c3d8c85ea4d13c8bfd755 (diff) | |
download | gradecoin-df6fa5f322fc972b3894e720f2c406eb2d8f5f5a.tar.gz gradecoin-df6fa5f322fc972b3894e720f2c406eb2d8f5f5a.tar.bz2 gradecoin-df6fa5f322fc972b3894e720f2c406eb2d8f5f5a.zip |
Moving site to separate repo
Diffstat (limited to 'site/public/block-docs/index.html')
-rw-r--r-- | site/public/block-docs/index.html | 190 |
1 files changed, 0 insertions, 190 deletions
diff --git a/site/public/block-docs/index.html b/site/public/block-docs/index.html deleted file mode 100644 index 8edc5a0..0000000 --- a/site/public/block-docs/index.html +++ /dev/null | |||
@@ -1,190 +0,0 @@ | |||
1 | <!DOCTYPE html> | ||
2 | <html lang="en"> | ||
3 | |||
4 | <head> | ||
5 | <meta charset="UTF-8"> | ||
6 | <title>Blocks | Gradecoin </title> | ||
7 | <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
8 | <style> | ||
9 | :root { | ||
10 | /* Primary theme color */ | ||
11 | --primary-color: #F8D12F; | ||
12 | /* Primary theme text color */ | ||
13 | --primary-text-color: #1E2329; | ||
14 | /* Primary theme link color */ | ||
15 | --primary-link-color: #2F57F7; | ||
16 | /* Secondary color: the background body color */ | ||
17 | --secondary-color: #FAFAFA; | ||
18 | --secondary-text-color: #303030; | ||
19 | /* Highlight text color of table of content */ | ||
20 | --toc-highlight-text-color: #d46e13; | ||
21 | } | ||
22 | </style> | ||
23 | |||
24 | <link href="https://fonts.googleapis.com/css?family=Alfa+Slab+One&display=swap" rel="stylesheet"> | ||
25 | <link href="https://fonts.googleapis.com/css?family=Fira+Sans:400,500,600&display=swap" rel="stylesheet"> | ||
26 | <link rel="stylesheet" href="/normalize.css"> | ||
27 | <link rel="stylesheet" href="https://gradecoin.xyz/juice.css"> | ||
28 | |||
29 | <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" /> | ||
30 | <link rel="stylesheet" href="/site.css" /> | ||
31 | |||
32 | </head> | ||
33 | |||
34 | <body> | ||
35 | |||
36 | <header class="box-shadow"> | ||
37 | |||
38 | |||
39 | <a href="https://gradecoin.xyz/"> | ||
40 | <div class="logo"> | ||
41 | <img src="https://gradecoin.xyz/gradecoin.png" alt="logo"> | ||
42 | Gradecoin | ||
43 | </div> | ||
44 | </a> | ||
45 | |||
46 | <nav> | ||
47 | |||
48 | <a class="nav-item subtitle-text" href="https://gradecoin.xyz/register-docs/">Register</a> | ||
49 | |||
50 | <a class="nav-item subtitle-text" href="https://gradecoin.xyz/jwt/">JWT</a> | ||
51 | |||
52 | <a class="nav-item subtitle-text" href="https://gradecoin.xyz/transaction-docs/">Transactions</a> | ||
53 | |||
54 | <a class="nav-item subtitle-text" href="https://gradecoin.xyz/block-docs/">Blocks</a> | ||
55 | |||
56 | <a class="nav-item subtitle-text" href="https://gradecoin.xyz/misc-docs/">Misc</a> | ||
57 | |||
58 | |||
59 | |||
60 | <a class="nav-item subtitle-text" href="https://github.com/zhuowei/nft_ptr#why">why?</a> | ||
61 | |||
62 | |||
63 | </nav> | ||
64 | |||
65 | </header> | ||
66 | |||
67 | |||
68 | <main> | ||
69 | |||
70 | |||
71 | |||
72 | |||
73 | |||
74 | <div class="toc"> | ||
75 | <div class="toc-sticky"> | ||
76 | |||
77 | <div class="toc-item"> | ||
78 | <a class="subtext" href="https://gradecoin.xyz/block-docs/#requests">Requests</a> | ||
79 | </div> | ||
80 | |||
81 | |||
82 | <div class="toc-item-child"> | ||
83 | <a class="subtext" href="https://gradecoin.xyz/block-docs/#get"><small>- GET</small></a> | ||
84 | </div> | ||
85 | |||
86 | <div class="toc-item-child"> | ||
87 | <a class="subtext" href="https://gradecoin.xyz/block-docs/#post"><small>- POST</small></a> | ||
88 | </div> | ||
89 | |||
90 | |||
91 | |||
92 | <div class="toc-item"> | ||
93 | <a class="subtext" href="https://gradecoin.xyz/block-docs/#fields">Fields</a> | ||
94 | </div> | ||
95 | |||
96 | |||
97 | <div class="toc-item"> | ||
98 | <a class="subtext" href="https://gradecoin.xyz/block-docs/#mining">Mining</a> | ||
99 | </div> | ||
100 | |||
101 | |||
102 | <div class="toc-item"> | ||
103 | <a class="subtext" href="https://gradecoin.xyz/block-docs/#hash">Hash</a> | ||
104 | </div> | ||
105 | |||
106 | |||
107 | </div> | ||
108 | </div> | ||
109 | |||
110 | |||
111 | |||
112 | <div class="content text"> | ||
113 | |||
114 | <div class="heading-text">Block Documentation</div> | ||
115 | <p>A block that was proposed to commit Transactions in <code>transaction_list</code> to the | ||
116 | ledger with a nonce that made <code>hash</code> valid; 6 zeroes at the left hand side of the | ||
117 | hash (24 bytes).</p> | ||
118 | <p>We are <em>mining</em> using <a href="https://www.blake2.net/">blake2s</a> algorithm, which produces 256 bit hashes. Hash/second is roughly 20x10<sup>3</sup> on my machine, a new block can be mined in around 4-6 minutes.</p> | ||
119 | <h1 id="requests">Requests</h1> | ||
120 | <h2 id="get">GET</h2> | ||
121 | <p>A HTTP <code>GET</code> request to <a href="/block">/block</a> endpoint will return the latest mined block.</p> | ||
122 | <h2 id="post">POST</h2> | ||
123 | <p>A HTTP <code>POST</code> request with Authorization using JWT will allow you to propose your own blocks.</p> | ||
124 | <h1 id="fields">Fields</h1> | ||
125 | <pre style="background-color:#ffffff;"> | ||
126 | <code><span style="color:#545052;">transaction_list: [array of Fingerprints] | ||
127 | nonce: unsigned 32-bit integer | ||
128 | timestamp: ISO 8601 <date>T<time> | ||
129 | hash: String | ||
130 | </span></code></pre><h1 id="mining">Mining</h1> | ||
131 | <p>The <em>mining</em> process for the hash involves;</p> | ||
132 | <ul> | ||
133 | <li>Creating a temporary JSON object with <code>transaction_list</code>, <code>timestamp</code> and <code>nonce</code> values</li> | ||
134 | <li>Serializing it</li> | ||
135 | <li>Calculating blake2s hash of the serialized string</li> | ||
136 | </ul> | ||
137 | <p>If the resulting hash is valid, then you can create a <code>Block</code> JSON object with the found <code>nonce</code> and <code>hash</code>.</p> | ||
138 | <h1 id="hash">Hash</h1> | ||
139 | <p><code>tha</code> field in <a href="/jwt">jwt documentation</a> in fact stands for "The Hash", in the case of a post request for a block, you need to use hash field of the block.</p> | ||
140 | <p><a href="https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations">ISO 8601 Reference</a></p> | ||
141 | |||
142 | |||
143 | </div> | ||
144 | |||
145 | |||
146 | |||
147 | </main> | ||
148 | |||
149 | |||
150 | <footer> | ||
151 | Built For ⁂ CENG489 ⁂ Introduction to Computer Security | ||
152 | </footer> | ||
153 | |||
154 | </body> | ||
155 | <script> | ||
156 | function highlightNav(heading) { | ||
157 | let pathname = location.pathname; | ||
158 | document.querySelectorAll(".toc a").forEach((item) => { | ||
159 | item.classList.remove("active"); | ||
160 | }); | ||
161 | document.querySelector(".toc a[href$='" + pathname + "#" + heading + "']").classList.add("active"); | ||
162 | } | ||
163 | |||
164 | let currentHeading = ""; | ||
165 | window.onscroll = function () { | ||
166 | let h = document.querySelectorAll("h1,h2,h3,h4,h5,h6"); | ||
167 | let elementArr = []; | ||
168 | |||
169 | h.forEach(item => { | ||
170 | if (item.id !== "") { | ||
171 | elementArr[item.id] = item.getBoundingClientRect().top; | ||
172 | } | ||
173 | }); | ||
174 | elementArr.sort(); | ||
175 | for (let key in elementArr) { | ||
176 | if (!elementArr.hasOwnProperty(key)) { | ||
177 | continue; | ||
178 | } | ||
179 | if (elementArr[key] > 0 && elementArr[key] < 300) { | ||
180 | if (currentHeading !== key) { | ||
181 | highlightNav(key); | ||
182 | currentHeading = key; | ||
183 | } | ||
184 | break; | ||
185 | } | ||
186 | } | ||
187 | } | ||
188 | </script> | ||
189 | |||
190 | </html> | ||