forked from liuyuzhou/python3.7sourcecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathb_b.py
More file actions
40 lines (31 loc) · 797 Bytes
/
Copy pathb_b.py
File metadata and controls
40 lines (31 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
class BlockChain:
def __init__(self):
# 储存交易
self.current_transactions = []
# 储存区块链
self.chain = []
# 储存节点
self.nodes = set()
# 创建创世块
self.new_block(previous_hash='1', proof=100)
def register_node(self, address):
pass
def valid_chain(self, chain):
pass
def resolve_conflicts(self):
pass
def new_block(self, proof, previous_hash):
pass
def new_transaction(self, sender, recipient, amount):
pass
@property
def last_block(self):
pass
@staticmethod
def hash(block):
pass
def proof_of_work(self, last_proof):
pass
@staticmethod
def valid_proof(last_proof, proof):
pass