Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculate fee or trx size #141

Open
voxcdr opened this issue Jan 11, 2021 · 7 comments
Open

Calculate fee or trx size #141

voxcdr opened this issue Jan 11, 2021 · 7 comments

Comments

@voxcdr
Copy link

voxcdr commented Jan 11, 2021

#106

I have the same need to calculate the fee amount, or deduct the fee amount from the transfer amount. Otherwise, a bug will appear.

Let's say you have 1 bitcoin on your balance and you need to transfer the entire balance. If you specify 1 bitcoin for the transfer, you will receive an error not enough funds. How to correctly calculate the maximum value for a transfer, taking into account the fee?

@ghost
Copy link

ghost commented Jan 11, 2021

Normally, this is how we do it: https://ofek.dev/bit/guide/transactions.html#transfer-funds

@voxcdr
Copy link
Author

voxcdr commented Jan 12, 2021

looks like kludge

@ofek
Copy link
Owner

ofek commented Jan 12, 2021

It might appear as such to you, but that is the exact high level representation of how a wallet sweep actually works 😉

@voxcdr
Copy link
Author

voxcdr commented Jan 12, 2021

It's not about wallet sweep at all. Don't you find the problem is that it is not possible to calculate the exact fee and include it in the transfer amount? After all, it is also necessary to check the balance for availability. Conventionally, if there is 0.1 bitcoin on the wallet and I need to transfer 0.99997, the transaction will not go through with the "insufficient balance" error.

@ofek
Copy link
Owner

ofek commented Jan 12, 2021

The fee calculation function was fixed in https://github.com/ofek/bit/pull/109/files

@voxcdr
Copy link
Author

voxcdr commented Jan 12, 2021

Can I get more information about func arguments: in_size, n_in, out_size, n_out ?

Repository owner deleted a comment from knofte Jan 1, 2024
Repository owner deleted a comment from naudachu Jan 11, 2024
Repository owner deleted a comment from Stormshadow666 Jan 22, 2024
Repository owner deleted a comment from wsdevprogrammer Feb 21, 2024
Repository owner deleted a comment from Stormshadow666 Feb 24, 2024
@hoangkun68
Copy link

hoangkun68 commented Feb 25, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants