Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion simpleCoin/miner.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,14 @@ def consensus(blockchain):


def validate_blockchain(block):
"""Validate the submitted chain. If hashes are not correct, return false
"""Validate the submitted chain. If hashes are not correct, return False
block(str): json
"""

for i in range(len(block)-1):
if not block[i].hash_block() == block[i+1].previous_hash:
return False

return True


Expand Down
5 changes: 3 additions & 2 deletions simpleCoin/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import time
import base64
import ecdsa
import json


def wallet():
Expand Down Expand Up @@ -92,11 +93,11 @@ def check_transactions():
"""
try:
res = requests.get('http://localhost:5000/blocks')
print(res.text)
print(json.dumps(res.json(),indent=2))
except requests.ConnectionError:
print('Connection error. Make sure that you have run miner.py in another terminal.')



def generate_ECDSA_keys():
"""This function takes care of creating your private and public (your address) keys.
Expand Down