aboutsummaryrefslogtreecommitdiffstats
path: root/site/public/transaction-docs/index.html
blob: 593bcfef7edd9986c8d5afb4cfe2d839678cc39d (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Transactions | Gradecoin </title>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <style>
    :root {
        /* Primary theme color */
        --primary-color: #F8D12F;
        /* Primary theme text color */
        --primary-text-color: #1E2329;
        /* Primary theme link color */
        --primary-link-color: #2F57F7;
        /* Secondary color: the background body color */
        --secondary-color: #FAFAFA;
        --secondary-text-color: #303030;
        /* Highlight text color of table of content */
        --toc-highlight-text-color: #d46e13;
    }
</style>

    <link href="https://fonts.googleapis.com/css?family=Alfa+Slab+One&display=swap" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Fira+Sans:400,500,600&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="/normalize.css">
    <link rel="stylesheet" href="https:&#x2F;&#x2F;gradecoin.xyz&#x2F;juice.css">
    
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" />
<link rel="stylesheet" href="/site.css" />

</head>

<body>
    
<header class="box-shadow">
    

<a href="https:&#x2F;&#x2F;gradecoin.xyz&#x2F;">
    <div class="logo">
        <img src="https:&#x2F;&#x2F;gradecoin.xyz&#x2F;gradecoin.png" alt="logo">
        Gradecoin
    </div>
</a>

<nav>
    
    <a class="nav-item subtitle-text" href="https:&#x2F;&#x2F;gradecoin.xyz&#x2F;register-docs&#x2F;">Register</a>
    
    <a class="nav-item subtitle-text" href="https:&#x2F;&#x2F;gradecoin.xyz&#x2F;jwt&#x2F;">JWT</a>
    
    <a class="nav-item subtitle-text" href="https:&#x2F;&#x2F;gradecoin.xyz&#x2F;transaction-docs&#x2F;">Transactions</a>
    
    <a class="nav-item subtitle-text" href="https:&#x2F;&#x2F;gradecoin.xyz&#x2F;block-docs&#x2F;">Blocks</a>
    
    <a class="nav-item subtitle-text" href="https:&#x2F;&#x2F;gradecoin.xyz&#x2F;misc-docs&#x2F;">Misc</a>
    
    
        
        <a class="nav-item subtitle-text" href="https:&#x2F;&#x2F;github.com&#x2F;zhuowei&#x2F;nft_ptr#why">why?</a>
        
    
</nav>

</header>


    <main>
        
        
        
        
        
        <div class="toc">
            <div class="toc-sticky">
                
                <div class="toc-item">
                    <a class="subtext" href="https://gradecoin.xyz/transaction-docs/#requests">Requests</a>
                </div>
                
                
                <div class="toc-item-child">
                    <a class="subtext" href="https://gradecoin.xyz/transaction-docs/#get"><small>- GET</small></a>
                </div>
                
                <div class="toc-item-child">
                    <a class="subtext" href="https://gradecoin.xyz/transaction-docs/#post"><small>- POST</small></a>
                </div>
                
                
                
                <div class="toc-item">
                    <a class="subtext" href="https://gradecoin.xyz/transaction-docs/#fields">Fields</a>
                </div>
                
                
                <div class="toc-item">
                    <a class="subtext" href="https://gradecoin.xyz/transaction-docs/#hash">Hash</a>
                </div>
                
                
                <div class="toc-item">
                    <a class="subtext" href="https://gradecoin.xyz/transaction-docs/#bank">Bank</a>
                </div>
                
                
            </div>
        </div>
        
        

        <div class="content text">
            
<div class="heading-text">Transaction documentation</div>
<p>A transaction request between <code>source</code> and <code>target</code> to move <code>amount</code> Gradecoin.</p>
<h1 id="requests">Requests</h1>
<h2 id="get">GET</h2>
<p>A HTTP <code>GET</code> request to <a href="/transaction">/transaction</a> endpoint will return the current list of pending transactions.</p>
<h2 id="post">POST</h2>
<p>A HTTP <code>POST</code> request with Authorization using JWT to <a href="/transactions">/transaction</a> will allow you to propose your own transactions.</p>
<h1 id="fields">Fields</h1>
<pre style="background-color:#ffffff;">
<code><span style="color:#545052;">by: Fingerprint
source: Fingerprint
target: Fingerprint
amount: unsigned 16 bit integer
timestamp: ISO 8601 &lt;date&gt;T&lt;time&gt;
</span></code></pre><h1 id="hash">Hash</h1>
<p><code>tha</code> field in <a href="https://gradecoin.xyz/jwt/">jwt documentation</a> in fact stands for &quot;The Hash&quot;, in the case of a post request for a transaction, you need the Md5 hash of the serialized JSON representation of transaction. The resulting JSON string should look something like;</p>
<pre style="background-color:#ffffff;">
<code><span style="color:#545052;">{&quot;by&quot;:&quot;foo&quot;,&quot;source&quot;:&quot;bar&quot;,&quot;target&quot;:&quot;baz&quot;,&quot;amount&quot;:2,&quot;timestamp&quot;:&quot;2021-04-18T21:49:00&quot;}
</span></code></pre>
<p>Or; without any whitespace, separated with <code>:</code> and <code>,</code>.</p>
<h1 id="bank">Bank</h1>
<p>There is a <code>bank</code> account with Fingerprint <code>31415926535897932384626433832795028841971693993751058209749445923</code></p>
<blockquote class="tidbit">
    <p>
    First 64 digits of Pi
    </p>
</blockquote>
<p>This is the only account that will let you <em>withdraw</em> from them.</p>
<pre style="background-color:#ffffff;">
<code><span style="color:#545052;">by: this has to be your Fingerprint
source: this can be either you or the bank
target: this can be a valid fingerprint or yourself if source is the bank
...
</span></code></pre>

        </div>

        
        
    </main>

    
<footer>
Built For ⁂ CENG489 ⁂ Introduction to Computer Security
</footer>

</body>
<script>
    function highlightNav(heading) {
        let pathname = location.pathname;
        document.querySelectorAll(".toc a").forEach((item) => {
            item.classList.remove("active");
        });
        document.querySelector(".toc a[href$='" + pathname + "#" + heading + "']").classList.add("active");
    }

    let currentHeading = "";
    window.onscroll = function () {
        let h = document.querySelectorAll("h1,h2,h3,h4,h5,h6");
        let elementArr = [];

        h.forEach(item => {
            if (item.id !== "") {
                elementArr[item.id] = item.getBoundingClientRect().top;
            }
        });
        elementArr.sort();
        for (let key in elementArr) {
            if (!elementArr.hasOwnProperty(key)) {
                continue;
            }
            if (elementArr[key] > 0 && elementArr[key] < 300) {
                if (currentHeading !== key) {
                    highlightNav(key);
                    currentHeading = key;
                }
                break;
            }
        }
    }
</script>

</html>