Signing transactions with more than one tx-in

Hi there,

I am playing around with building different transactions on the testnet to learn.

I have two addresses with ADA and one empty address. I want to send all the Ada from the two addresses to the empty address.

When building the raw transaction (before calculating min fee), I don’t know the output amount of Ada because it is dependent on the min fee. Is it fine to say the output will be the sum of the two wallets to calculate the min fee, and then subtract min fee from output after it is calculated?

When calculating min fee, will the tx-in-count always be the same as witness-count because any address that is input for the transaction should sign the transaction? (or am I thinking about this wrong, because there can be more than one UTxO input from a single address? such that tx-in-count is the number of UTxO inputs and witness-count is the number of different addresses that contribute to the tx inputs?)

When signing the transaction, if you have more than one witness do i have more than one --signing-key-file flag and for each is the signing key of each address that is a witness?


You only need one witness for each unique address in the --tx-ins, and you’d need to provide the signing key for each of those addresses. For example, if the transaction is consuming two UTxOs from different addresses, then both --tx-in-count and --witness-count will be two, and it will need two signing keys; but if both UTxOs are at the same address, then --tx-in-count will be two and --witness-count will be one, and it will need the one signing key. (A single address can have many UTxOs and several of those could be used as input to a transaction.)

And yes, the output is the sum of the two inputs minus the fee.

1 Like