Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -442,18 +442,7 @@ with gr.Blocks() as bc:
|
|
442 |
gr.Markdown("""<h1><center>Blockchain Simulator<br><h3>(Transactions have no value)<br><h4>Chain will reset at 20 blocks""")
|
443 |
#blockchain = gr.State()
|
444 |
with gr.Row():
|
445 |
-
|
446 |
-
with gr.Accordion("Key"):
|
447 |
-
with gr.Row():
|
448 |
-
input_address = gr.Image(label="Wallet",type="filepath")
|
449 |
-
input_key = gr.Image(label="Key",type="filepath")
|
450 |
-
|
451 |
-
with gr.Row():
|
452 |
-
with gr.Column():
|
453 |
-
|
454 |
-
send_mes=gr.Textbox(label="Message", lines=6)
|
455 |
-
send_mes_btn=gr.Button()
|
456 |
-
rec_mes = gr.Textbox(lines=6)
|
457 |
|
458 |
with gr.Tab("OG"):
|
459 |
with gr.Row():
|
@@ -468,7 +457,9 @@ with gr.Blocks() as bc:
|
|
468 |
#send=gr.Textbox(label="Sender")
|
469 |
send = gr.Dropdown(label="Sender", choices=[f for f in send_list], value = "Bank")
|
470 |
rec=gr.Dropdown(label="Recipient", choices=[f for f in rec_list], allow_custom_value=True)
|
471 |
-
|
|
|
|
|
472 |
send_trans=gr.Button("Post Transaction")
|
473 |
mine_b = gr.Button("Mine Block")
|
474 |
check = gr.Button("Check Chain")
|
@@ -534,7 +525,18 @@ with gr.Blocks() as bc:
|
|
534 |
rsa_dec_btn = gr.Button("RSA Decrypt")
|
535 |
rsa_dec_mes = gr.Textbox(label="decoded")
|
536 |
|
537 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
538 |
|
539 |
def res_bc():
|
540 |
bc_utils.blockchain.reset(create="chain1.json")
|
@@ -662,7 +664,7 @@ with gr.Blocks() as bc:
|
|
662 |
#os.environ['PRIV'] = ""
|
663 |
|
664 |
|
665 |
-
|
666 |
#send_mes_btn.click(send_message,[send_mes,input_address,input_key],[rec_mes])
|
667 |
|
668 |
gen_wal_btn.click(crypt.generate_keys,None,[out2,out1, img3,out3,img1,img2]).then(create_new_chain,out3,[json_out,block_text,send,rec]).then(crypt.test_fn,[img1,img2],[priv_key_in,pub_key_in,priv_key_in1])
|
@@ -675,8 +677,8 @@ with gr.Blocks() as bc:
|
|
675 |
reset_blockchain.click(res_bc,None,block_text)
|
676 |
reset_source.click(res_source,None,block_text)
|
677 |
|
678 |
-
send_trans.click(issue_tokens,[send,rec,am],[block_text,out_box_bool,json_out_send,json_out_rec,chain_json_send,chain_json_rec,trans_data_send,trans_data_rec,block_text_send,block_text_rec,send,rec,trans_data])
|
679 |
-
issue_btn.click(issue_tokens,[send,rec,am],[block_text,out_box_bool,json_out_send,json_out_rec,chain_json_send,chain_json_rec,trans_data_send,trans_data_rec,block_text_send,block_text_rec,send,rec,trans_data])
|
680 |
#issue_btn.click(issue_tokens,[send,rec,am],[block_text,out_box_bool,json_out_send])
|
681 |
|
682 |
node_add.click(bc_utils.add_node,[this_space,node_repo,node_space,node_file],block_text)
|
|
|
442 |
gr.Markdown("""<h1><center>Blockchain Simulator<br><h3>(Transactions have no value)<br><h4>Chain will reset at 20 blocks""")
|
443 |
#blockchain = gr.State()
|
444 |
with gr.Row():
|
445 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
446 |
|
447 |
with gr.Tab("OG"):
|
448 |
with gr.Row():
|
|
|
457 |
#send=gr.Textbox(label="Sender")
|
458 |
send = gr.Dropdown(label="Sender", choices=[f for f in send_list], value = "Bank")
|
459 |
rec=gr.Dropdown(label="Recipient", choices=[f for f in rec_list], allow_custom_value=True)
|
460 |
+
send_mes=gr.Textbox(label="Message", lines=6)
|
461 |
+
|
462 |
+
#am=gr.Textbox(label="Amount")
|
463 |
send_trans=gr.Button("Post Transaction")
|
464 |
mine_b = gr.Button("Mine Block")
|
465 |
check = gr.Button("Check Chain")
|
|
|
525 |
rsa_dec_btn = gr.Button("RSA Decrypt")
|
526 |
rsa_dec_mes = gr.Textbox(label="decoded")
|
527 |
|
528 |
+
with gr.Tab("Messages"):
|
529 |
+
with gr.Accordion("Key"):
|
530 |
+
with gr.Row():
|
531 |
+
input_address = gr.Image(label="Wallet",type="filepath")
|
532 |
+
input_key = gr.Image(label="Key",type="filepath")
|
533 |
+
|
534 |
+
with gr.Row():
|
535 |
+
with gr.Column():
|
536 |
+
|
537 |
+
#send_mes=gr.Textbox(label="Message", lines=6)
|
538 |
+
send_mes_btn=gr.Button()
|
539 |
+
rec_mes = gr.Textbox(lines=6)
|
540 |
|
541 |
def res_bc():
|
542 |
bc_utils.blockchain.reset(create="chain1.json")
|
|
|
664 |
#os.environ['PRIV'] = ""
|
665 |
|
666 |
|
667 |
+
send_trans.click(send_message,[send,rec,send_mes],[block_text,out_box_bool,json_out_send,json_out_rec,chain_json_send,chain_json_rec,trans_data_send,trans_data_rec,block_text_send,block_text_rec,send,rec,trans_data])
|
668 |
#send_mes_btn.click(send_message,[send_mes,input_address,input_key],[rec_mes])
|
669 |
|
670 |
gen_wal_btn.click(crypt.generate_keys,None,[out2,out1, img3,out3,img1,img2]).then(create_new_chain,out3,[json_out,block_text,send,rec]).then(crypt.test_fn,[img1,img2],[priv_key_in,pub_key_in,priv_key_in1])
|
|
|
677 |
reset_blockchain.click(res_bc,None,block_text)
|
678 |
reset_source.click(res_source,None,block_text)
|
679 |
|
680 |
+
#send_trans.click(issue_tokens,[send,rec,am],[block_text,out_box_bool,json_out_send,json_out_rec,chain_json_send,chain_json_rec,trans_data_send,trans_data_rec,block_text_send,block_text_rec,send,rec,trans_data])
|
681 |
+
#issue_btn.click(issue_tokens,[send,rec,am],[block_text,out_box_bool,json_out_send,json_out_rec,chain_json_send,chain_json_rec,trans_data_send,trans_data_rec,block_text_send,block_text_rec,send,rec,trans_data])
|
682 |
#issue_btn.click(issue_tokens,[send,rec,am],[block_text,out_box_bool,json_out_send])
|
683 |
|
684 |
node_add.click(bc_utils.add_node,[this_space,node_repo,node_space,node_file],block_text)
|