-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtransaction.py
More file actions
25 lines (19 loc) · 781 Bytes
/
transaction.py
File metadata and controls
25 lines (19 loc) · 781 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
# External
from collections import OrderedDict
# Internal
from utility.printable import Printable
class Transaction(Printable):
""" A transaction which can be added to a block in the blockchain.
Arguments:
:sender: The sender of the coins.
:recipient: The recipient of the coins.
:signature: The signature of the transaction.
:amount: The amount of coins sent with the transaction (default = 1.0)
"""
def __init__(self, sender, recipient, signature, amount):
self.sender = sender
self.recipient = recipient
self.signature = signature
self.amount = amount
def to_ordered_dict(self):
return OrderedDict([('sender', self.sender), ('recipient', self.recipient), ('amount', self.amount)])