-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblock.py
More file actions
31 lines (25 loc) · 949 Bytes
/
block.py
File metadata and controls
31 lines (25 loc) · 949 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
"""
this is class where we are importing all of the data of the block and just we will
use this class as a constructer.
use case = "Major use"
made: 15/5
no_of updated = 14
last_update: 17/6
"""
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