src/main/Transaction.java
public boolean processTransaction(){
        if (verifiySignature() == false){
            System.out.println("Transaction failed to verify.");
            return false;
        }

        // Get transaction inputs
        for (TransactionInput i : inputs){
            i.UTXO = currentBlockchain.UTXOs.get(i.previousOutId);
        }
        float inputSum = getInputsSum();

        // check if transaction is valid:
		if(inputSum < Blockchain.MIN_TRANSACTION && inputs.size() > 0) {
			System.out.println("Transaction Inputs too small: " + getInputsSum());
			return false;
        }
        
        // Check sufficient funds. Might be redundant with wallet check as well
        if(inputSum < value && coinCreationFlag == false){
            System.out.println("Insufficient funds, Inputs: " + inputSum + ", Value: " + value);
            return false;
        }

        // Don't allow sends of 0
        if(value == 0){
            System.out.println("Cannot send 0.");
            return false;
        }


        float overPay = inputSum - value;
        if(inputSum == 0){
            overPay = 0;
        }
        
        System.out.println("Value: " + value + ", Inputsum: " + inputSum + ", Overpay: " + overPay + ", ID: " + transactionId);
        transactionId = calulateHash();
        outputs.add(new TransactionOutput(this.reciepient, value, transactionId)); // Send value to reciepient
        if(overPay != 0){
            outputs.add(new TransactionOutput( this.sender, overPay, transactionId)); // Send Left over back to sender
        }
        
        // UTXo key cannot be address as it will overwrite previous transactions. Needs to be transaction ID

        // Add outputs to Unspent list
		for(TransactionOutput o : outputs) {
			currentBlockchain.UTXOs.put(o.id , o);
		}
		
		// Remove transaction inputs from UTXO lists as spent:
		for(TransactionInput i : inputs) {
			if(i.UTXO == null) continue; //if Transaction can't be found skip it 
			currentBlockchain.UTXOs.remove(i.UTXO.id);
		}
		
		return true;
        
    }
/* Processes the transaction
     * First verifying that the signature is valid
     * Then gathers all the inputs and performs checks to make sure transaction is valid
     * Then sends funds from the sender to the recipient using UTXOs
     * If there is no exact amount of UTXO to fulfill transaction then the overpay will be returned to the sender
     * Finally it updates the UTXOs
    */
Processes the transaction
First verifying that the signature is valid
Then gathers all the inputs and performs checks to make sure transaction is valid
Then sends funds from the sender to the recipient using UTXOs
If there is no exact amount of UTXO to fulfill transaction then the overpay will be returned to the sender
Finally it updates the UTXOs
Processes the transaction First verifying that the signature is valid Then gathers all the inputs and performs checks to make sure transaction is valid Then sends funds from the sender to the recipient using UTXOs If there is no exact amount of UTXO to fulfill transaction then the overpay will be returned to the sender Finally it updates the UTXOs
public boolean processTransaction(){
        if (verifiySignature() == false){
            System.out.println("Transaction failed to verify.");
            return false;
        }
        for (TransactionInput i : inputs){
            i.UTXO = currentBlockchain.UTXOs.get(i.previousOutId);
        }
        float inputSum = getInputsSum();
		if(inputSum < Blockchain.MIN_TRANSACTION && inputs.size() > 0) {
			System.out.println("Transaction Inputs too small: " + getInputsSum());
			return false;
        }
        if(inputSum < value && coinCreationFlag == false){
            System.out.println("Insufficient funds, Inputs: " + inputSum + ", Value: " + value);
            return false;
        }
        if(value == 0){
            System.out.println("Cannot send 0.");
            return false;
        }
        float overPay = inputSum - value;
        if(inputSum == 0){
            overPay = 0;
        }
        System.out.println("Value: " + value + ", Inputsum: " + inputSum + ", Overpay: " + overPay + ", ID: " + transactionId);
        transactionId = calulateHash();
        outputs.add(new TransactionOutput(this.reciepient, value, transactionId)); 
        if(overPay != 0){
            outputs.add(new TransactionOutput( this.sender, overPay, transactionId)); 
        }
		for(TransactionOutput o : outputs) {
			currentBlockchain.UTXOs.put(o.id , o);
		}
		for(TransactionInput i : inputs) {
			if(i.UTXO == null) continue; 
			currentBlockchain.UTXOs.remove(i.UTXO.id);
		}
		return true;
    }
public boolean processTransaction ( ) { if ( verifiySignature ( ) == false ) { System . out . println ( "Transaction failed to verify." ) ; return false ; } for ( TransactionInput i : inputs ) { i . UTXO = currentBlockchain . UTXOs . get ( i . previousOutId ) ; } float inputSum = getInputsSum ( ) ; if ( inputSum < Blockchain . MIN_TRANSACTION && inputs . size ( ) > 0 ) { System . out . println ( "Transaction Inputs too small: " + getInputsSum ( ) ) ; return false ; } if ( inputSum < value && coinCreationFlag == false ) { System . out . println ( "Insufficient funds, Inputs: " + inputSum + ", Value: " + value ) ; return false ; } if ( value == 0 ) { System . out . println ( "Cannot send 0." ) ; return false ; } float overPay = inputSum - value ; if ( inputSum == 0 ) { overPay = 0 ; } System . out . println ( "Value: " + value + ", Inputsum: " + inputSum + ", Overpay: " + overPay + ", ID: " + transactionId ) ; transactionId = calulateHash ( ) ; outputs . add ( new TransactionOutput ( this . reciepient , value , transactionId ) ) ; if ( overPay != 0 ) { outputs . add ( new TransactionOutput ( this . sender , overPay , transactionId ) ) ; } for ( TransactionOutput o : outputs ) { currentBlockchain . UTXOs . put ( o . id , o ) ; } for ( TransactionInput i : inputs ) { if ( i . UTXO == null ) continue ; currentBlockchain . UTXOs . remove ( i . UTXO . id ) ; } return true ; }
Processes the transaction
 First verifying that the signature is valid
 Then gathers all the inputs and performs checks to make sure transaction is valid
 Then sends funds from the sender to the recipient using UTXOs
 If there is no exact amount of UTXO to fulfill transaction then the overpay will be returned to the sender
 Finally it updates the UTXOs
Processes the transaction First verifying that the signature is valid Then gathers all the inputs and performs checks to make sure transaction is valid Then sends funds from the sender to the recipient using UTXOs If there is no exact amount of UTXO to fulfill transaction then the overpay will be returned to the sender Finally it updates the UTXOs
// Get transaction inputs // check if transaction is valid: // Check sufficient funds. Might be redundant with wallet check as well // Don't allow sends of 0 // Send value to reciepient // Send Left over back to sender // UTXo key cannot be address as it will overwrite previous transactions. Needs to be transaction ID // Add outputs to Unspent list // Remove transaction inputs from UTXO lists as spent: //if Transaction can't be found skip it 