Created
September 23, 2017 19:03
-
-
Save dvf/5c20df453fd4e4fd8fadc7522483efdc to your computer and use it in GitHub Desktop.
Step 2.1: Creating a 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
class Blockchain(object): | |
... | |
def new_transaction(self, sender, recipient, amount): | |
""" | |
Creates a new transaction to go into the next mined Block | |
:param sender: <str> Address of the Sender | |
:param recipient: <str> Address of the Recipient | |
:param amount: <int> Amount | |
:return: <int> The index of the Block that will hold this transaction | |
""" | |
self.current_transactions.append({ | |
'sender': sender, | |
'recipient': recipient, | |
'amount': amount, | |
}) | |
return self.last_block['index'] + 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment