-
Notifications
You must be signed in to change notification settings - Fork 126
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
when a transaction has 2 inputs the fees are miscalculated, and uses 1 ADA as fee #668
Comments
Hi @caetanix ! Unfortunately I don't know which CSL version you use. Could you tell me which one do you use ? Also could you isolate a code example to reproduce it on our side, you can create a fake address and fake utxos. And CBOR of your tx would be very helpful. |
Hello, i'm using last version, "@emurgo/cardano-serialization-lib-nodejs": "11.5.0", I have an account with 8k ADA, and when i use this same code, to sent it works good, generates 2 outputs. Here is the hash: CBOR: So, i have done another test... Here is the hash: CBOR: The transaction uses 2 inputs (of previous 4x1 ADA), but only 1 output... 1 ADA + 1 ADA of FEE But maybe the problem is relatated to the use 2 inputs of 1 ADA ? and because uses 1 ADA to sent.... and the second input is also 1 ADA, and if the fee is only 168977, the input will keep only 831023 and is less than minimum_coins, so the blockchain uses all the remain fee ? I test with balance of 4 ADA, i have sent 2 ADA, so the transaction uses 3 inputs of 1 ADA, and 1 output only.... 2 ADA of output and 1 ADA of fee Here is the hash: CBOR full code:
` |
Let me add some explanations: |
Hi again, yes its related with ADA amounts, so everything its OK! |
I use this library and blockfrost to submit the transaction, but i detect when an address have 2 inputs of 1 ADA, and after send 1 ADA to another address, the fee of this transaction is 1 ADA.
I have created an example here:
https://preview.beta.explorer.cardano.org/en/address/addr_test1qqu0cf4zt3mklfdjyzada4cxddspkdyd7e5k9rsrg07et6j4agylhzua083ngsellerp0t5s7up3swfslg5heqwn7v5q8vrpjq
2 inputs of 1 ADA
1 output of 2 ADA (1 ADA sent + 1 ADA fee)
this is my code...
const bip39 = require('bip39');
const Blockfrost = require('@blockfrost/blockfrost-js');
const CardanoWasm = require('@emurgo/cardano-serialization-lib-nodejs');
exports.transaction = async (req, res) => {
};
const deriveAddressPrvKey = (bipPrvKey, mainnet) => {
const networkId = mainnet
? CardanoWasm.NetworkInfo.mainnet().network_id()
: CardanoWasm.NetworkInfo.testnet_preview().network_id();
const accountIndex = 0;
const addressIndex = 0;
};
const harden = (num) => {
return 0x80000000 + num;
};
const mnemonicToPrivateKey = (mnemonic) => {
const entropy = bip39.mnemonicToEntropy(mnemonic);
};
const composeTransaction = (address, outputAddress, outputAmount, utxos, params) => {
};
const signTransaction = (txBody, signKey) => {
const txHash = CardanoWasm.hash_transaction(txBody);
const witnesses = CardanoWasm.TransactionWitnessSet.new();
const vkeyWitnesses = CardanoWasm.Vkeywitnesses.new();
};
The text was updated successfully, but these errors were encountered: