Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: kevinlech on October 17, 2020, 09:04:38 AM



Title: How to get fee from incoming transaction?
Post by: kevinlech on October 17, 2020, 09:04:38 AM
Hi!

How to get fee from incoming transaction because incoming object hasn`t this parameter?


Title: Re: How to get fee from incoming transaction?
Post by: joniboini on October 17, 2020, 09:27:18 AM
AFAIK on the protocol level, there is no way to do that (maybe you can explicitly ask your sender to send some additional money for you). You'd probably need to set up an exchange to do that or run a mining rig to get paid from transaction fees. But as an individual receiver, I'm afraid you can't. Why would you charge someone anyway?


Title: Re: How to get fee from incoming transaction?
Post by: Stalker22 on October 17, 2020, 11:53:09 AM
How to get fee from incoming transaction because incoming object hasn`t this parameter?

Short answer: You can't.

Long answer: Explain your use case in a little more detail. Why would you want to do that? Maybe we can offer you an alternative solution.


Title: Re: How to get fee from incoming transaction?
Post by: o_e_l_e_o on October 17, 2020, 01:31:57 PM
I think what OP is asking is how to see the fee of an incoming transaction, so as to get a rough idea of how long it will take to confirm. The answer to that question depends on the client or wallet software you are using, so if you can answer that question then we can give more detailed instructions.

Alternatively, if you know how to find the transaction hash or transaction ID of the incoming transaction, you can paste it in to a block explorer such as https://blockchair.com and look at the field "Fee per vbyte".


Title: Re: How to get fee from incoming transaction?
Post by: sheenshane on October 17, 2020, 02:32:13 PM
It's quite hard to understand an incomplete question of what you've meant for OP. Please explain further more details.
I read this twice and I think OP's transaction didn't arrive at his wallet, IMO.

Once a sender sent Bitcoin (I assume it is Bitcoin) there's no way to get the fee once it is transacted and broadcast to the blockchain network and waiting to be confirmed, if there is a congestion of the network which is a cause of delayed transaction, you can add the fee for a faster transaction but this depend on what wallet you've used. That's why most comment above says, please be specific of your question to have the right answer.

Meanwhile, you can follow what o_e_l_e_o said above to check your transaction status.


Title: Re: How to get fee from incoming transaction?
Post by: Timelord2067 on October 18, 2020, 02:19:07 AM
Is the OP asking about an additional fee to then pass the payment along to the next wallet address?  There's provision to use part of the amount sent to cover TX fees, so it shouldn't be an issue on sending funds you receive.


Title: Re: How to get fee from incoming transaction?
Post by: HCP on October 18, 2020, 08:23:11 PM
How to get fee from incoming transaction because incoming object hasn`t this parameter?
If you're wanting to calculate the fee programmatically, you need to add up the value of all the inputs, and then subtract the value of all the outputs. The amont leftover is what the total fee was.

To calculate the fee rate, you then need to divide this amount by the "size" of the transaction in bytes to get the sats/byte value. Note that if it is a SegWit transaction, then you will need to calculate the "virtual size" (aka "vsize") to get sats/vbyte. Refer: https://bitcoin.stackexchange.com/questions/87275/how-to-calculate-segwit-transaction-fee-in-bytes