IntersectMBO / cardano-node

The core component that is used to participate in a Cardano decentralised blockchain.
https://cardano.org
Apache License 2.0
3.06k stars 720 forks source link

[BUG] calculate-min-fee for Unwitnessed Tx BabbageEra #4945

Closed soltanoff closed 3 weeks ago

soltanoff commented 1 year ago

Internal/External External .

Area cardano-cli

Summary Do you know what I need to do to calculate the commission for Unwitnessed Tx BabbageEra type of transaction body?

Or what should I do to change the type of transaction body?

Why do I only have these types on the mainnet? (TxUnsignedByron, TxUnsignedShelley, TxBodyAllegra, TxBodyMary, TxBodyAlonzo, TxBodyBabbage)

In general, a strange situation, because in the testnet this type of transaction body works and I can calculate the commission and sign it in the future.

On the mainnet, I have the following problem:

Command failed: transaction calculate-min-fee 
Error: Failed to decode neither the cli's serialisation format nor the ledger's CDDL serialisation format. 
       TextEnvelope error: /dev/stdin: 
       TextEnvelope type error: 
       Expected one of: TxUnsignedByron, TxUnsignedShelley, TxBodyAllegra, TxBodyMary, TxBodyAlonzo, TxBodyBabbage 
       Actual: Unwitnessed Tx BabbageEra
       TextEnvelopeCddl error: /dev/stdin: Could not JSON decode TextEnvelopeCddl file at: /dev/stdin Error: Error in $: not enough input

How I do it on the testnet:

cardano-cli transaction calculate-min-fee \
  --testnet-magic 1 \
  --protocol-params-file <(echo '<this is a protocol params>') \
  --tx-body-file /dev/stdin <<< '{"type": "Unwitnessed Tx BabbageEra", "description": "Ledger Cddl Format", "cborHex": "<hex>"}' \
  --tx-in-count 1 \
  --tx-out-count 2 \
  --witness-count 1
175269 Lovelace

System info:

Kriator7 commented 1 year ago

It sounds like you're working with the Cardano blockchain, and specifically, trying to calculate the commission for a transaction with an Unwitnessed Tx BabbageEra type of transaction body.To calculate the commission for a transaction, you need to know the size of the transaction in bytes, as well as the current fee per byte on the network. The formula for calculating the minimum fee is:minimum fee = fee per byte * transaction sizeYou can use the Cardano CLI command transaction calculate-min-fee to calculate the minimum fee for a transaction. For example:cardano-cli transaction calculate-min-fee --tx-body-file tx.raw --tx-in-count 1 --tx-out-count 1 --mainnet --witness-count 0 --protocol-params-file protocol.json--protocol-params-file protocol.jsonThis command will calculate the minimum fee for a transaction with one input and one output, and no witnesses, using the protocol parameters specified in the protocol.json file.To change the type of transaction body, you may need to use a different command or version of the Cardano CLI. It's possible that the Unwitnessed Tx BabbageEra type of transaction body is not supported on the mainnet yet, or that there is a bug in the current version of the CLI. You may want to check the Cardano documentation or forums to see if there are any known issues or workarounds.As for why you only have certain types of transaction bodies on the mainnet, it could be due to the current state of the Cardano network and the development of new features. Different eras and features may be rolled out gradually, and may not be available on all nodes or wallets at the same time. This is why it's important to keep up to date with the latest releases and changes in the Cardano ecosystem.I hope this helps. CheersJames RupeCEO CardanoMint.comSPO Maximum Mint (Ticker AMINT)Co-CarPool Blockchain EducationOn Mar 6, 2023, at 11:52 AM, Ilya @.***> wrote: Internal/External External . Area cardano-cli Summary Do you know what I need to do to calculate the commission for Unwitnessed Tx BabbageEra type of transaction body? Or what should I do to change the type of transaction body? Why do I only have these types on the mainnet? (TxUnsignedByron, TxUnsignedShelley, TxBodyAllegra, TxBodyMary, TxBodyAlonzo, TxBodyBabbage) In general, a strange situation, because in the testnet this type of transaction body works and I can calculate the commission and sign it in the future. On the mainnet, I have the following problem: Command failed: transaction calculate-min-fee Error: Failed to decode neither the cli's serialisation format nor the ledger's CDDL serialisation format. TextEnvelope error: /dev/stdin: TextEnvelope type error: Expected one of: TxUnsignedByron, TxUnsignedShelley, TxBodyAllegra, TxBodyMary, TxBodyAlonzo, TxBodyBabbage Actual: Unwitnessed Tx BabbageEra TextEnvelopeCddl error: /dev/stdin: Could not JSON decode TextEnvelopeCddl file at: /dev/stdin Error: Error in $: not enough input

How I do it on the testnet: cardano-cli transaction calculate-min-fee \ --testnet-magic 1 \ --protocol-params-file <(echo '') \ --tx-body-file /dev/stdin <<< '{"type": "Unwitnessed Tx BabbageEra", "description": "Ledger Cddl Format", "cborHex": ""}' \ --tx-in-count 1 \ --tx-out-count 2 \ --witness-count 1 175269 Lovelace System info:

OS Name: Ubuntu OS Version: 20.04 Node version (output of cardano-node --version) cardano-node --version cardano-node 1.35.5 - linux-x86_64 - ghc-8.10 git rev 8762a10efe3f9f97939e3cb05edaf04250456702

CLI version (output of cardano-cli --version) cardano-cli --version cardano-cli 1.35.5 - linux-x86_64 - ghc-8.10 git rev 8762a10efe3f9f97939e3cb05edaf04250456702

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

soltanoff commented 1 year ago

You can use the Cardano CLI command transaction calculate-min-fee to calculate the minimum fee for a transaction.

Yes, I use the command but there are problems on the mainnet as described above.

To change the type of transaction body, you may need to use a different command or version of the Cardano CLI. It's possible that the Unwitnessed Tx BabbageEra type of transaction body is not supported on the mainnet yet, or that there is a bug in the current version of the CLI.

If there were no difficulties in finding information, then I would not ask about it. Unfortunately, I haven't found a solution to my problem yet.

It would be great to see an example of creating a transaction body with other available types.

soltanoff commented 1 year ago

@CarlosLopezDeLara, @Jimbo4350 Hi! Can you help me with these mistakes from the description?

soltanoff commented 1 year ago

@andrejpodzimek, hi! Did you solve the same problem?

soltanoff commented 1 year ago

The testnet expected one of:

But the mainnet only:

soltanoff commented 1 year ago

@Jimbo4350, @CarlosLopezDeLara

Through trial and error, it turned out that the problem was in the operating system of the cardano image. The pipes are broken on Debian-based, so we've moved to Ubuntu-based images on all environments.

BUT you have to investigate and fix it for Debian-based image.

Kriator7 commented 1 year ago

Oh great find! I hope things work now. Cheers!James RupeStake Pool OperatorMaximum Mint (Ticker AMINT)CardanoMint.comOn Mar 9, 2023, at 5:52 AM, Ilia @.***> wrote: @Jimbo4350, @CarlosLopezDeLara Through trial and error, it turned out that the problem was in the operating system of the cardano image. The pipes are broken on Debian-based, so we've moved to Ubuntu-based images on all environments. BUT you have to investigate and fix it for Debian-based image.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 120 days.

soltanoff commented 1 year ago

Up

CarlosLopezDeLara commented 1 year ago

@Jimbo4350, @CarlosLopezDeLara

Through trial and error, it turned out that the problem was in the operating system of the cardano image. The pipes are broken on Debian-based, so we've moved to Ubuntu-based images on all environments.

BUT you have to investigate and fix it for Debian-based image.

I'll take a look.

soltanoff commented 1 year ago

@CarlosLopezDeLara, thanks!

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 120 days.

andrejpodzimek commented 1 year ago

@andrejpodzimek, hi! Did you solve the same problem?

No, I did not. I’m looking into ways to retire my pool now, which is sort of hard without the ability to make transactions.

soltanoff commented 1 year ago

In any case, as long as an Ubuntu-like image exists, I recommend using it before patching.

soltanoff commented 1 month ago

Hi, this bug is still present in non-Ubuntu images. :)

I'll keep everyone updated.

carbolymer commented 1 month ago

@soltanoff thanks for the bump. We've moved cardano-cli out of cardano-node repo to: https://github.com/IntersectMBO/cardano-cli May I ask you to open a new issue there? It will be easier to track it there.

soltanoff commented 3 weeks ago

@carbolymer, hi! Sure, thank you!

soltanoff commented 3 weeks ago

Moved to https://github.com/IntersectMBO/cardano-cli/issues/939