I have a bitcoin core running on testnet, so for suppose I have a wallet balance of 1BTC and I have to send it to an addressx, so how can I know the amount of transaction fee so that I can subtract it from the sending amount.
bitcoin-cli sendtoaddress x 1
This will return an error stating that
error code: -4
Error: This transaction requires a transaction fee of at least 0.00000488
How can I know it beforehand the fee required for a transaction?