XinFinOrg / XinFin-Node

Setup XinFin Masternode using Docker
https://xinfin.org/setup-masternode.php
63 stars 54 forks source link

XDC Balance of an Account does not match with Address #152

Open bmalepaty opened 3 weeks ago

bmalepaty commented 3 weeks ago

I checked an Address https://xdcscan.io/address/0xd77875dF9C9dE07a5a701F4431743e3A0e9Fe03a, which has 12 debit transactions that sum up to -6730003000 (Negative due to all debit transactions). But explorer balance shows 14,046,000,699 XDC. Can you please explain this discrepancy. Is it due to genesis balance? If yes, where can we find the list or API of all addresses and their genesis balances.

JukLee0ira commented 3 weeks ago

I checked the address’s balance in the genesis block, and it wasn’t pre-allocated. The issue is with transactions after block 61171073, which may be related to internal transactions.

bmalepaty commented 3 weeks ago

image But this address does not have any internal transactions

JukLee0ira commented 2 weeks ago

During the interaction with the contract 0x802ad609f16ad1b8aeb58d93350246bb8869b75a, a transfer of tokens occurred, which was not recorded by XDCScan. Below is the detailed information of the token transfers:

Block Balance (Before) Decreased Value Balance (After)
50829323 14950000899 100 14950000799
50916245 14950000799 250000000 14700000799
51001168 14700000799 100 14700000699
51174427 14700000699 110000000 14590000699
51359545 14590000699 110000000 14480000699
61171073 14480000699 100 14480000599
61177667 14480000599 49999900 14430000699
61212005 14430000699 50000000 14380000699
62278638 14380000699 20000000 14360000699
62555513 14360000699 20000000 14340000699
62831912 14340000699 20000000 14320000699
63163593 14320000699 20000000 14300000699
63685669 14300000699 20000000 14280000699
66005110 14280000699 100 14280000599
66005506 14280000599 79999900 14200000699
67366134 14200000699 100 14200000599
67369007 14200000599 9999900 14190000699
69522424 14190000699 20999999 14169000700
72539799 14169000700 100 14169000600
72539920 14169000600 122999900 14046000700

The total value of tokens transferred is 230,999,899 XDC, whereas the total amount shown by XDCScan is 673,000,300 XDC.

Before Block 50829323, your balance was 14,950,000,899 XDC. Subtracting the total transferred amount (230,999,899 XDC) and the amount shown on XDCScan (673,000,300 XDC), leaves a balance of 14,046,000,700 XDC. After accounting for the gas fees incurred during these transactions, this matches your current account balance.

I hope this helps. If you need any additional details about the transactions, please let me know!

bmalepaty commented 2 weeks ago

Thanks @JukLee0ira. Is there any Explorer or RPC APIs that give us the above data you shared. We need to validate a bunch of addresses, and APIs if any would help

gzliudan commented 2 weeks ago

You can try SubQuery. Maybe it has such API.

bmalepaty commented 2 weeks ago

Also, you mentioned Balance(Before) blocknumber 50829323 to be 14950000899. How can we get this data? As per explorer this seems to be first debit transaction of the address. The first transaction only causes a negative balance. Can you also provide more details on how you obtained the above information. We have the node syncing, and can retrieve any data from node too.

JukLee0ira commented 2 weeks ago

Actually I wrote a script to query this data, but I'm not sure if it’s suitable for enterprise-level production environments.