blockchain
blockchain copied to clipboard
Can't get to nodes to communicate on the same chain
Hi there, when I try setup 2 nodes I cannot get them to operate on the same chain.
Does anyone have a solution to this?
change if not self.valid_proof(last_block['proof'], block['proof'], last_block['previous_hash']) to if not self.valid_proof(last_block['proof'], block['proof'], block['previous_hash']), try again
i have only one computer,so I create two ports 5000 and 5100 simulate two computer, copy the python file to two, change they port to 5000 and 5100,now we have two address(mine is http://127.0.0.1:5000/ and http://127.0.0.1:5100/) use /nodes/register api to register one address to anther address, now when you add new block, use /nodes/resolve api to synchronization the blockchain ,now you can see they use the same blockchain.
I'm a bit wishy washy here still. If I set up two nodes, both running blockchain.py on the same LAN, and perform /transaction/new, /mine and /chain in both directions from both nodes both using Postman, when I register the nodes with each other then resolve, will the shorter chain and its contained blocks and transactions be discarded?