blockchain实现遇到的问题
区块链分叉
v1114 : 基于python socket 创建TCP server,以中心化的形式暂时实现区块链的状态同步
C:\Users\vin0sen>nc 192.168.137.1 9000
Enter a new data:
111
{"index": 1, "timestamp": "2024-11-14 15:28:53.173112", "Data": 111, "prev_hash": "", "Hash": "000000f44cc19a07ed34d1f9f4c5e7cb09706ea610b676e8e3bf4bbbbd425144", "difficulty": 6, "nonce": 973077790}Enter a new data:
{"index": 1, "timestamp": "2024-11-14 15:28:55.305002", "Data": 222, "prev_hash": "", "Hash": "000000c8ba4018617ff4eca18a252b02d16673d72523a35032eaa91b8c3067d5", "difficulty": 6, "nonce": 1139951182}
C:\Users\vin0sen>nc 192.168.137.1 9000
Enter a new data:
222
{"index": 1, "timestamp": "2024-11-14 15:28:53.173112", "Data": 111, "prev_hash": "", "Hash": "000000f44cc19a07ed34d1f9f4c5e7cb09706ea610b676e8e3bf4bbbbd425144", "difficulty": 6, "nonce": 973077790}
{"index": 1, "timestamp": "2024-11-14 15:28:55.305002", "Data": 222, "prev_hash": "", "Hash": "000000c8ba4018617ff4eca18a252b02d16673d72523a35032eaa91b8c3067d5", "difficulty": 6, "nonce": 1139951182}Enter a new data:
replaceChain() ,isValidChain(),
未完待续
- P2P网络下的blockchain实现