Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

differences in medium post code and github repo #1

Open
kdgosik opened this issue Jul 24, 2024 · 1 comment
Open

differences in medium post code and github repo #1

kdgosik opened this issue Jul 24, 2024 · 1 comment

Comments

@kdgosik
Copy link

kdgosik commented Jul 24, 2024

Hello,

Thanks for making a nice, easy to follow tutorial! I wanted to let you know that there are a couple of slight code differences in the Blockchain object code from the medium article and the github repo. I ran into issues when trying to copy and paste the code from the article and it didn't run. After looking at the repo, everything worked!

Namely the object takes a miner_address in the article. Also the chain is used to create the genesis block instead of using the method and it throws an error.

In the article:
class Blockchain:
def init(self, miner_address):
self.miner_address = miner_address
self.chain = [self.create_block(balances=dict(), previous_hash='0'*64)]
self.difficulty = '00000'
self.transactions = []
self.balances = dict()
self.peer_b = copy.deepcopy(self.chain)

def genesis_block(self):
block = self.create_block(balances=dict(), previous_hash='0'*64)
self.chain.append(block)

@nikavgeros
Copy link
Owner

nikavgeros commented Jul 25, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants