Skip to content

Commit

Permalink
Create transaction.py
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Aug 6, 2024
1 parent b6cc9e5 commit e5ccaa8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions blockchain/core/transaction.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from typing import List

class Transaction:
def __init__(self, sender: str, receiver: str, amount: float):
self.sender = sender
self.receiver = receiver
self.amount = amount

def __str__(self):
return f"Transaction - Sender: {self.sender}, Receiver: {self.receiver}, Amount: {self.amount}"

class TransactionPool:
def __init__(self):
self.transactions = []

def add_transaction(self, transaction: Transaction):
self.transactions.append(transaction)

def get_transactions(self):
return self.transactions

0 comments on commit e5ccaa8

Please sign in to comment.