Skip to content

Instantly share code, notes, and snippets.

@bajcmartinez
Created May 18, 2020 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bajcmartinez/217eb7f6737e59831d5f9933b300b0c1 to your computer and use it in GitHub Desktop.
Save bajcmartinez/217eb7f6737e59831d5f9933b300b0c1 to your computer and use it in GitHub Desktop.
From Zero to Blockchain in Python - Part 1 - Create Transaction
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