Yes, this is actually what the raw transaction API is for.
The ordinary send RPCs (
sendmany) do everything at once:
- Construct outputs based on the addresses/amounts you want to send.
- Do coin selection to find inputs to satisfy the amounts, determine the fee, and add change if necessary.
- Sign the inputs with the keys in your wallet.
- Broadcast the transaction to the network.
Since the fee depends on the size of the transaction, which depends on the coin selection, you cannot "intervene" in the middle of these RPCs.
The raw transaction API lets you do all these steps independently:
- Constructing outputs based on addresses/amount using
- Do coin selection to find inputs, determine the fee, and add change using
- Sign the inputs using
- Broadcast the transaction using
If you need to know the actual fee before broadcasting, you can use
signrawtransaction to construct a fully valid transaction without broadcasting. You can then inspect it, and decide to broadcast it using
sendrawtransaction or not.