aboutsummaryrefslogtreecommitdiffstats
path: root/site/public/block-docs
diff options
context:
space:
mode:
Diffstat (limited to 'site/public/block-docs')
-rw-r--r--site/public/block-docs/index.html19
1 files changed, 16 insertions, 3 deletions
diff --git a/site/public/block-docs/index.html b/site/public/block-docs/index.html
index 3c2c3df..8edc5a0 100644
--- a/site/public/block-docs/index.html
+++ b/site/public/block-docs/index.html
@@ -95,6 +95,11 @@
95 95
96 96
97 <div class="toc-item"> 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">
98 <a class="subtext" href="https://gradecoin.xyz/block-docs/#hash">Hash</a> 103 <a class="subtext" href="https://gradecoin.xyz/block-docs/#hash">Hash</a>
99 </div> 104 </div>
100 105
@@ -110,7 +115,7 @@
110<p>A block that was proposed to commit Transactions in <code>transaction_list</code> to the 115<p>A block that was proposed to commit Transactions in <code>transaction_list</code> to the
111ledger with a nonce that made <code>hash</code> valid; 6 zeroes at the left hand side of the 116ledger with a nonce that made <code>hash</code> valid; 6 zeroes at the left hand side of the
112hash (24 bytes).</p> 117hash (24 bytes).</p>
113<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^3 on my machine, a new block can be mined in around 4-6 minutes.</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>
114<h1 id="requests">Requests</h1> 119<h1 id="requests">Requests</h1>
115<h2 id="get">GET</h2> 120<h2 id="get">GET</h2>
116<p>A HTTP <code>GET</code> request to <a href="/block">/block</a> endpoint will return the latest mined block.</p> 121<p>A HTTP <code>GET</code> request to <a href="/block">/block</a> endpoint will return the latest mined block.</p>
@@ -122,8 +127,16 @@ hash (24 bytes).</p>
122nonce: unsigned 32-bit integer 127nonce: unsigned 32-bit integer
123timestamp: ISO 8601 &lt;date&gt;T&lt;time&gt; 128timestamp: ISO 8601 &lt;date&gt;T&lt;time&gt;
124hash: String 129hash: String
125</span></code></pre><h1 id="hash">Hash</h1> 130</span></code></pre><h1 id="mining">Mining</h1>
126<p><code>tha</code> field in <a href="/jwt">jwt documentation</a> in fact stands for &quot;The Hash&quot;, in the case of a post request for a block, you need to use hash field of the block. </p> 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 &quot;The Hash&quot;, in the case of a post request for a block, you need to use hash field of the block.</p>
127<p><a href="https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations">ISO 8601 Reference</a></p> 140<p><a href="https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations">ISO 8601 Reference</a></p>
128 141
129 142