In Bitcoin and its altcoin copies, every transaction requires a fee.
Bitcoin miners propose their mining price based on supply and demand for processing Bitcoin transactions, measured in units of satoshi per byte (sat/b).
Thus Bitcoin transaction fee is calculated by the size of transaction (in byte) and the mining price which can be customized by advanced users.
Basic Bitcoin transactions with 1 input and 2 outputs are typically of 250 bytes of data.
So if the medium mining price is 27,500 sat/kb, your transaction fee can be set to 0.00007 BTC.
Source: https://support.blockchain.com
To create a Bitcoin transaction manually, you are about to set the transaction fee you are willing to pay.
To get proposed mining price, you should use some third-party service known as API or proxy.
We suggest the following API gateway:
BTC Endpoint: https://api.blockcypher.com/v1/btc/main
LTC Endpoint: https://api.blockcypher.com/v1/ltc/main
DASH Endpoint: https://api.blockcypher.com/v1/dash/main
DOGE Endpoint: https://api.blockcypher.com/v1/doge/main
The result looks like:
The above mining price of 40,035 sat/kb produces the transaction fee of 0.0001 BTC.