-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblock.py
24 lines (19 loc) · 798 Bytes
/
block.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from time import time
from utility.printable import Printable
class Block(Printable):
"""A single block of our blockchain.
Attributes:
:index: The index of this block.
:previous_hash: The hash of the previous block in the blockchain.
:timestamp: The timestamp of the block (automatically generated by
default).
:transactions: A list of transaction which are included in the block.
:proof: The proof of work number that yielded this block.
"""
def __init__(self, index, previous_hash, transactions, proof, time=time()):
self.index = index
self.previous_hash = previous_hash
self.timestamp = time
self.transactions = transactions
self.proof = proof
#self.current_hash = current_hash