Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -272,21 +272,7 @@ def mychain_mine_block_send(balance, chain_r=None,chain_n=None):
|
|
| 272 |
'proof': block['proof'],
|
| 273 |
'previous_hash': block['previous_hash']
|
| 274 |
}
|
| 275 |
-
|
| 276 |
-
previous_post = mychain_send.print_previous_block()
|
| 277 |
-
|
| 278 |
-
block = {'index': previous_post['index'],
|
| 279 |
-
'timestamp': previous_post['timestamp'],
|
| 280 |
-
'sender': previous_post['transactions'][0]['sender'],
|
| 281 |
-
'recipient': previous_post['transactions'][0]['recipient'],
|
| 282 |
-
'amount': previous_post['transactions'][0]['amount'],
|
| 283 |
-
'balance': previous_post['balance'],
|
| 284 |
-
'proof': previous_post['proof'],
|
| 285 |
-
'previous_hash': previous_post['previous_hash']}
|
| 286 |
-
bc_transactions(block)
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
message = "A block is MINED"
|
| 291 |
show_chain = display_chain_send()
|
| 292 |
|
|
@@ -321,7 +307,36 @@ def mychain_mine_block_rec(balance, chain_r=None,chain_n=None):
|
|
| 321 |
message = "New Chain Created at Max 20 Blocks"
|
| 322 |
return response, show_chain, message
|
| 323 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 324 |
|
|
|
|
|
|
|
| 325 |
def issue_tokens(send,rec,amount):
|
| 326 |
response_send={}
|
| 327 |
response_rec={}
|
|
|
|
| 272 |
'proof': block['proof'],
|
| 273 |
'previous_hash': block['previous_hash']
|
| 274 |
}
|
| 275 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 276 |
message = "A block is MINED"
|
| 277 |
show_chain = display_chain_send()
|
| 278 |
|
|
|
|
| 307 |
message = "New Chain Created at Max 20 Blocks"
|
| 308 |
return response, show_chain, message
|
| 309 |
|
| 310 |
+
def merge_trans():
|
| 311 |
+
trans_bx = []
|
| 312 |
+
previous_post_send = mychain_send.print_previous_block()
|
| 313 |
+
|
| 314 |
+
send_block = {
|
| 315 |
+
'name': previous_post_send['transactions'][0]['sender']
|
| 316 |
+
'index': previous_post_send['index'],
|
| 317 |
+
'timestamp': previous_post_send['timestamp'],
|
| 318 |
+
'recipient': previous_post_send['transactions'][0]['recipient'],
|
| 319 |
+
'amount': previous_post_send['transactions'][0]['amount'],
|
| 320 |
+
'balance': previous_post_send['balance'],
|
| 321 |
+
'proof': previous_post_send['proof'],
|
| 322 |
+
'previous_hash': previous_post['previous_hash']}
|
| 323 |
+
rec_block = {
|
| 324 |
+
'name': previous_post_send['transactions'][0]['recipient']
|
| 325 |
+
'index': previous_post['index'],
|
| 326 |
+
'timestamp': previous_post['timestamp'],
|
| 327 |
+
'sender': previous_post['transactions'][0]['sender'],
|
| 328 |
+
'amount': previous_post['transactions'][0]['amount'],
|
| 329 |
+
'balance': previous_post['balance'],
|
| 330 |
+
'proof': previous_post['proof'],
|
| 331 |
+
'previous_hash': previous_post['previous_hash']}
|
| 332 |
+
trans_bx.append(send_block)
|
| 333 |
+
trans_bx.append(rec_block)
|
| 334 |
+
|
| 335 |
+
bc_transactions(trans_bx)
|
| 336 |
+
|
| 337 |
|
| 338 |
+
|
| 339 |
+
|
| 340 |
def issue_tokens(send,rec,amount):
|
| 341 |
response_send={}
|
| 342 |
response_rec={}
|