-
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) · 697 Bytes
/
block.py
File metadata and controls
22 lines (17 loc) · 697 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from time import time
from utility.printable import Printable
class Block(Printable):
def __init__(self, index, previous_hash, transactions, proof, timestamp=None):
"""
Create a block for the blockchain
:param index: The index of the block
:param previous_hash: The hash of the previous block
:param transactions: List of transactions
:param proof: Proof of block solution
:param timestamp: Time of block creation
"""
self.index = index
self.previous_hash = previous_hash
self.timestamp = time() if timestamp is None else timestamp
self.transactions = transactions
self.proof = proof