-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
transfer calculate fee Bug #16
Comments
Sorry, I am a Chinese developer, my English is not good, with the help of translation sentences, I hope you can help answer |
Are you doing a simple ADA transfer transaction ? Is there any native token in the utxo ? If it's just a ADA transfer, 0.176 ADA txn fee looks normal. 0.328 ADA is definitely more for only ADA transaction. You may want to reproduce the same on testnet. |
{ min_fee_a:44, |
{ Above is the transaction of error, doubt and poundage calculation |
It looks like mismatch in total input and total output amount. Not sure but may be due to min ada amount requirement in utxo (due to native tokens). You may want to add few ADA to the account (2 or 3 ADA enough) and try the transaction again. It could be a bug due to some edge case. Is it possible to provide the utxo inputs used in this transaction ? Please change the txn hash or address in the utxo and paste here. Keep the amount including native tokens as it is. It will help me to debug the issue. |
----------------------------------- [{"tx_hash":"f3c464be15a5e29a1a6d322c5cd040c87075d1cfc89d4b397568d14c0ba53cd9","tx_index":1,"output_index":1,"amount":[{"unit":"lovelace","quantity":"1452846"},{"unit":"07309ed26f7636932617826b6991c7b6d8a7fa8fea66c5b9f020e6874d59546f6b656e","quantity":"56"}],"block":"10974607187afacfeed5e3eaf4342e06bad0f26de438319eca18fa93f6a1541e","data_hash":null},{"tx_hash":"d60669420bc15d3f359b74f5177cd4035325c22f7a67cf96d466472acf145ecb","tx_index":0,"output_index":0,"amount":[{"unit":"lovelace","quantity":"10000000"}],"block":"eee6cd082d297f85406cff49f83aa3ebd1083dae3c8997ec03f4a17f49297bf6","data_hash":null}]inputsTransactionInput{transactionId=d60669420bc15d3f359b74f5177cd4035325c22f7a67cf96d466472acf145ecb, index=0}
|
"when it exceeds 10ADA, there is an error when it involves multiple accounts" So multiple senders and receivers ? It could be a bug. |
Meanwhile, as a workaround, you may want to manually construct transaction (without TransactionHelper). Alternatively, you can also provide your own UtxoSelectionStrategy if you still want to use higher level api like TransactionHelper |
Hello, I still haven't solved this problem. Could you fix the bug when I transferred ADA |
Hi @LB6264 , I just started looking into the utxos sample you sent earlier. Also, the output (TransactionOutput) is missing the native token (unit: 07309ed26f7636932617826b6991c7b6d8a7fa8fea66c5b9f020e6874d59546f6b656e). Can you please also attach your code sample where you are creating and posting the transaction ? But in your 1st sample, the error message was different "ValueNotConservedUTxO". Also, what do you mean by when multiple accounts involved ? Same mnemonic and multiple addresses at different indexes for the sender ? BTW, by default the client-lib works with sender address at index 0 and only utxos specific to that address. It doesn't automatically scan all address at different indexes for the mnemonic. To use an address at different index, you have to use this constructor
|
This problem is easily replicated, for example: I have 10 Adas in the balance, and I want to transfer all 10 Adas. Cardano-client-lib is used, but I cannot get the expected result. suspend fun signerTransaction(
// LogCat.d("-----------------${result}")
|
@LB6264 Thanks. Will check today. |
@satran004 i am facing similar issue. Address:- addr_test1qrark97feve329u6n0w7xr73e5mu8llvs8nl83cu3x8k4peseqdyq0sxh5x6u50dsqkn8jzuymn2v64ztqr7g0auvpps697cqa Using the same sample code provided in the cardano-client-examples to mint asset. I am not able to mint it. It throws ValueNotConservedUTxO
UTXO's
|
@LB6264, Thanks for the account details. I tried it. So, when you are sending out 11 ADA, there is not enough ADA for the change output which goes back to sender. So for example, in this case, there are two transaction outputs :-
Also, the input utxo has a native token, so the minimum amount needed in change address (#2) is around 1.4 ADA (protocol requirement). But as only 0.494 ADA available it fails. So any transfer above ~10.2 will fail. But I think, there is also an issue in lib.
Currently, we have to keep minimum ~1.x ADA in sender acc. You can not make the sender account empty using client-lib. You can check this address addr_test1qz3s0c370u8zzqn302nppuxl840gm6qdmjwqnxmqxme657ze964mar2m3r5jjv4qrsf62yduqns0tsw0hvzwar07qasqeamp0c Let me think how we can fix this. But as I had mentioned earlier, you can programmatically build Transaction using TransactionInput/Ouput lower level apis if you want better control. You don't need to go through higher level apis like TransactionHelper. |
@prediator please check the above comment if it applies to your issue. Also, it looks like you have 3 tokens in that address. The min ada requirement increases with additional native tokens in utxo. |
@satran004 Thank you for your patient solution. I have tried to use programmatically build Transaction using TransactionInput/Ouput lower level apis, but there will be problems when calculating edge conditions and bringing native tokens. I hope you can fix this problem as soon as possible in lib. |
Thanks for the detail explanation. Is there any way from the lib to get the exact minada required for a native tokens minting, so that we can prompt user to add sufficient ADA to the wallet. |
…iteria doesn't match. Fee calculation should be successful even if there is not enough utxos.
@LB6264 I have done a partial fix for now. You need to build the project locally to try out the fix. Fee calculation should not throw any error now. Also, if there is no native tokens available at sender address, you should be able to transfer all ADA from sender address to receiver. But for that you need to calculate the transfer amount in your application. First calculate the fee and then amount = balance - fee. Set the calculated amount in the PaymentTransaction.amount(). Please refer to the below code snippet. Note: - But, if you are sending out partial ADA amount, make sure the remaining amount at sender address is greater than minimum ADA amount (~1.4 ADA) after transfer. But if you have one or more native tokens at the sender address, you first need to transfer out all native tokens and then only you can send out all remaining ADA. I will check if these two steps could be simplified. Let me know if you find any issue. I will continue with more testing.
|
@prediator You can check MinAdaCalculator class. But you need to create TransactionOutput object manually. Check the test cases for usage : |
hello
My balance is 3.328735 ADA
Same input parameter: 3 ADA
Yoroi Wallet costs 0.328735 ADA
Val fee = feeCalculationService. CalculateFee (paymentTransaction detailsParams, null) to calculate the charge is: 0.176017 ADA
Is there a bug in calculating the handling fee
The end result is total transfer failure
The text was updated successfully, but these errors were encountered: