Set transaction inputs as each of the UTXOs from step #24.
For each utxo i in the array transactionUtxos:
Follow this pseudocode:
const rawTransaction= new bitcoin.TransactionBuilder()
for (i = 0 : transactionUtxos.length):
rawTransaction.addInput(transactionUtxos[i].txId, transactionUtxos[i].vout)
This generates the inputs. For the outputs, do the following:
Compute these amounts:
amount - this is the transaction amount sent from the input field
change - this is the change remaining. It is calculated by the sum of the the utxo amounts used in the transaction (transactionUtxos) - (amount + fee).
fee - this amount is fixed to a constant FEE_AMOUNT that we define in the app
Set transaction inputs as each of the UTXOs from step #24.
For each utxo
i
in the array transactionUtxos:Follow this pseudocode:
This generates the inputs. For the outputs, do the following:
Compute these amounts:
amount
- this is the transaction amount sent from the input fieldchange
- this is the change remaining. It is calculated by the sum of the the utxo amounts used in the transaction (transactionUtxos
) - (amount
+fee
).fee
- this amount is fixed to a constantFEE_AMOUNT
that we define in the appRepresent all amounts in satoshi.
Set the receive address to the one entered in the input field, and my address to the users own address.