Created
May 18, 2020 19:07
-
-
Save bajcmartinez/217eb7f6737e59831d5f9933b300b0c1 to your computer and use it in GitHub Desktop.
From Zero to Blockchain in Python - Part 1 - Create Transaction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_transaction(self, sender, recipient, amount): | |
""" | |
Creates a new transaction to go into the next block | |
:param sender: <str> sender address | |
:param recipient: <str> recipient address | |
:param amount: <float> amount | |
:return: <Transaction> generated transaction | |
""" | |
transaction = Transaction(sender, recipient, amount) | |
if transaction.validate(): | |
self.__current_transactions.append(transaction) | |
return transaction, True | |
return None, False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment