30 cardano-client-lib 0.1.5 代币转账失败

PaymentTransaction paymentTransaction = PaymentTransaction.builder() .sender(senderAccount) .receiver(receiverAddress) .amount(amount) //.unit(CardanoConstants.LOVELACE) .unit("d2175511c5793b09d27b7ddac0f64cc1b9900fe1dca1607ea949f143414458") .build();

转账ADA主币没问题。 转账 d2175511c5793b09d27b7ddac0f64cc1b9900fe1dca1607ea949f143414458 代币报错

[PaymentTransaction(unit=d2175511c5793b09d27b7ddac0f64cc1b9900fe1dca1607ea949f143414458, amount=10000)]

22:37:33.090 [main] DEBUG com.bloxbean.cardano.client.backend.api.helper.TransactionHelperService - { "body" : { "inputs" : [ { "transactionId" : "748326fa5b919c485ddbc93c94f0d9a000e4cbcd52d80dc44f71a38b551b2790", "index" : 1 } ], "outputs" : [ { "address" : "addr1qx55fc4tgaeq20wgpm50a49e223cuvu2xl6zchtn8cqj5s69qe0w49serzs4j8xhxmma2c2mkcchcdcj0hkrf22p55ls6nmp33", "value" : { "coin" : 168090, "multiAssets" : [ { "policyId" : "d2175511c5793b09d27b7ddac0f64cc1b9900fe1dca1607ea949f143", "assets" : [ { "name" : "0x414458", "value" : 10000 } ] } ] } }, { "address" : "addr1q9d03mv8ty0apfxl3w93avamqafgmgnkjn59nd2djjvngmv96j2mprflqpw20jknesga2q6hnhgz6gyaarafjat56e5qwmh2y2", "value" : { "coin" : 2413032, "multiAssets" : [ { "policyId" : "d2175511c5793b09d27b7ddac0f64cc1b9900fe1dca1607ea949f143", "assets" : [ { "name" : "0x414458", "value" : 980000 } ] } ] } } ], "fee" : 170000, "ttl" : 101149747, "mint" : null, "metadataHash" : null, "validityStartInterval" : 0 }, "witnessSet" : null, "metadata" : null } 22:37:33.097 [main] DEBUG com.bloxbean.cardano.client.backend.api.helper.TransactionHelperService - Requests: [PaymentTransaction(unit=d2175511c5793b09d27b7ddac0f64cc1b9900fe1dca1607ea949f143414458, amount=10000)] 22:37:46.997 [main] DEBUG com.bloxbean.cardano.client.backend.api.helper.TransactionHelperService - { "body" : { "inputs" : [ { "transactionId" : "748326fa5b919c485ddbc93c94f0d9a000e4cbcd52d80dc44f71a38b551b2790", "index" : 1 } ], "outputs" : [ { "address" : "addr1qx55fc4tgaeq20wgpm50a49e223cuvu2xl6zchtn8cqj5s69qe0w49serzs4j8xhxmma2c2mkcchcdcj0hkrf22p55ls6nmp33", "value" : { "coin" : 168090, "multiAssets" : [ { "policyId" : "d2175511c5793b09d27b7ddac0f64cc1b9900fe1dca1607ea949f143", "assets" : [ { "name" : "0x414458", "value" : 10000 } ] } ] } }, { "address" : "addr1q9d03mv8ty0apfxl3w93avamqafgmgnkjn59nd2djjvngmv96j2mprflqpw20jknesga2q6hnhgz6gyaarafjat56e5qwmh2y2", "value" : { "coin" : 2411327, "multiAssets" : [ { "policyId" : "d2175511c5793b09d27b7ddac0f64cc1b9900fe1dca1607ea949f143", "assets" : [ { "name" : "0x414458", "value" : 980000 } ] } ] } } ], "fee" : 171705, "ttl" : 101149747, "mint" : null, "metadataHash" : null, "validityStartInterval" : 0 }, "witnessSet" : null, "metadata" : null } 22:37:48.185 [main] ERROR com.bloxbean.cardano.client.backend.api.helper.TransactionHelperService - Trasaction submission failed Transaction Failed: Result{successful=false, response='{"error":"Bad Request","message":"\"transaction submit error ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [UtxowFailure (UtxoFailure (BabbageOutputTooSmallUTxO [((Addr Mainnet (KeyHashObj (KeyHash \\"a944e2ab4772053dc80ee8fed4b952a38e338a37f42c5d733e012a43\\")) (StakeRefBase (KeyHashObj (KeyHash \\"45065eea961918a1591cd736f7d5615bb6317c37127dec34a941a53f\\"))),Value 168090 (fromList [(PolicyID {policyID = ScriptHash \\"d2175511c5793b09d27b7ddac0f64cc1b9900fe1dca1607ea949f143\\"},fromList [(414458,10000)])]),NoDatum,SNothing),Coin 1142150)]))])\"","status_code":400}', code=400, value=TransactionResult(signedTxn=[], transactionId=null)}

请先 登录 后评论

最佳答案 2023-08-26 18:25

I think I've found the root cause. The calculated minimum ADA value for the UTXO is lower than the actual required value. This is why you are encountering the BabbageOutputTooSmallUtxo error.

If you check the MinAdaCalculator.java, you'll see that it relies on a protocol parameter named coinsPerUtxoWord

This field was renamed during the Alonzo era. Furthermore, its value was changed from 34482 to 4310 because the minimum ADA calculation now uses bytes instead of words in the current era (or post-Alonzo).

However, CCL 0.1.5 is not compatible with the current era. It still expects the old value of 34482, but it retrieves 4310 through protocol parameters. So, the calculated minimum ADA is insufficient.

You have two options now:

  1. You can try to override EpochService.getProtocolParameter() to return the expected value, ensuring that the MinAda calculation remains accurate. 2.Consider upgrading the library to version 0.4.3.

Fyi, you can review the protocol parameter update history here. Please scroll down and check the coinPerUtxoSize field. You'll notice how the value changed from the old figure in epoch 364.

请先 登录 后评论

其它 0 个回答

  • 1 关注
  • 0 收藏,794 浏览
  • IT_浩哥 提出于 2023-08-22 22:57

相似问题