Skip to content

Commit 3993fa1

Browse files
author
mx
committed
wip ihm
1 parent 1fc5116 commit 3993fa1

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

app.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
import time
12
from flask import Flask, render_template
23
from network_integration import run
34

4-
# my_blockchain, network = run()
5-
65
app = Flask(__name__)
76

87
"""
@@ -12,11 +11,13 @@
1211
"""
1312

1413

15-
# @app.route('/')
16-
# def accueil():
17-
# chain = my_blockchain.chain
18-
# current_transactions = my_blockchain.current_transactions
19-
# return render_template('index.html', chain=chain, current_transactions=current_transactions)
14+
@app.route('/')
15+
def accueil():
16+
my_blockchain, network = run()
17+
18+
chain = my_blockchain.chain
19+
current_transactions = my_blockchain.current_transactions
20+
return render_template('index.html', chain=chain, current_transactions=current_transactions)
2021

2122

2223
if __name__ == '__main__':

network_integration.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ def run():
3232
return bc, network
3333

3434

35-
run()
35+
if __name__ == '__main__':
36+
run()

templates/index.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<th class="p-3 text-left">Creation time</th>
2020
<th class="p-3 text-left">Previous hash</th>
2121
<th class="p-3 text-left" width="110px">Number of transactions</th>
22+
<th>transactions</th>
2223
</tr>
2324
{% endfor %}
2425
</thead>
@@ -29,14 +30,23 @@
2930
<td class="border-grey-light border hover:bg-gray-100 p-3 truncate">{{ block.previous_hash }}</td>
3031
<td class="border-grey-light border hover:bg-gray-100 p-3 truncate">
3132
{{ block.transactions | length }}</td>
33+
34+
<td>
35+
{% for transaction in block.transactions %}
36+
{{ transaction.value }} - {{ transaction }}
37+
{% endfor %}
38+
</td>
3239
<!-- <td
3340
class="border-grey-light border hover:bg-gray-100 p-3 text-blue-400 hover:text-blue-600 hover:font-medium cursor-pointer">
3441
See more</td> -->
3542
</tr>
3643
{% endfor %}
37-
3844
</tbody>
3945
</table>
46+
47+
<!-- current transactions -->
48+
<table class="w-full flex flex-row flex-no-wrap sm:bg-white rounded-lg overflow-hidden sm:shadow-lg my-5">
49+
</table>
4050
</div>
4151
</body>
4252

0 commit comments

Comments
 (0)