-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblock.py
More file actions
22 lines (17 loc) · 752 Bytes
/
block.py
File metadata and controls
22 lines (17 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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