Skip to content

Instantly share code, notes, and snippets.

@harshvishu
Created January 8, 2019 12:25
Show Gist options
  • Save harshvishu/e21bdb2992ab213d90b333524df2046e to your computer and use it in GitHub Desktop.
Save harshvishu/e21bdb2992ab213d90b333524df2046e to your computer and use it in GitHub Desktop.
Swit-Blockchain-NewTransaction.swift
/**
Creates a new transaction to go into the next mined Block
- Parameter sender: Address of the Sender
- Parameter recipient: Address of the Recipient
- Parameter amount: Amount
- returns: The index of the Block that will hold this transaction
*/
func newTransaction(sender: String, recipient: String, amount: Int64) -> Int64 {
let transaction = Transaction(sender: sender, recipient: recipient, amount: amount)
self.current_transactions.append(transaction)
return self.last_block.index + 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment