-
Notifications
You must be signed in to change notification settings - Fork 14
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
Explorer transaction inputs and outputs don't sum up to the same number #584
Comments
DescriptionA tx can be submitted in multiple blocks, but eventually only one will be in the main chain. If we get the output_ref from the problematic input in the tx reported in this issue. We can see that a tx is used in two blocks one is in the main chain, the other is an uncle block We see that amounts are different, the one in main chain is correct value but the uncle block one is the wrong value returned by the explorer-backend. uncle block in FE and in backend main chain block in FE and backend We can also check the input from the tx
What's wrong?I was surprise that the output with key The Output key is derived using the Transaction Id and index. So if the transaction id is different, we'll have a different output key. The TransactionId is derived from the unsigned tx. If anything is different in the unsigned tx, the txId will be different. So if the amount of an output is different, it will produce a different txId as well as a different output key. In our cases here, the contract's inputs aren't defined in the So we can totally have a contract output with a different amount but the same output's key. Which mean outputs in DB are correct. But why inputs are wrong? Currently when updating the inputs with the corresponding output, we were assuming that for a given output key, every info: This is correct for every fixed output, but not necessarily for generated output as seen previously. Current impact?Thx to ChatGPT, we can run this query to find contract outputs that have mismatching amount: SELECT
o1.address,
o1.key,
o1.tx_hash,
o1.amount AS amount_main_chain_false,
o2.amount AS amount_main_chain_true,
o1.block_hash AS block_hash_main_chain_false,
o2.block_hash AS block_hash_main_chain_true
FROM
outputs o1
JOIN
outputs o2
ON
o1.address = o2.address
AND o1.key = o2.key
AND o1.tx_hash = o2.tx_hash
AND o1.main_chain = FALSE
AND o2.main_chain = TRUE
AND o1.amount <> o2.amount
AND o1.block_hash <> o2.block_hash
AND o1.fixed_output = FALSE
AND o2.fixed_output = FALSE On my machine, on the ~ Nice catch on this case. How to fix:We could fix the |
Copied from alephium/alephium-frontend#1014
https://explorer.alephium.org/transactions/5dd003e4b7f93c06e4c05c0600dcd1a4a8294bfcc648d0c0dc0bc8bd15a4c229
the output exceeds the input by a lot, it looks like the input being displayed for the contract address is wrong and that's what is causing the issue.
It’s a display issue. The full node data is correct:
curl -X 'GET'
'https://node.mainnet.alephium.org/transactions/rich-details/5dd003e4b7f93c06e4c05c0600dcd1a4a8294bfcc648d0c0dc0bc8bd15a4c229'
-H 'accept: application/json'
The text was updated successfully, but these errors were encountered: