bitpay / bitcore

A full stack for bitcoin and blockchain-based applications
https://bitcore.io/
MIT License
4.81k stars 2.08k forks source link

Incorrect tx value for ETH transactions (missing last 2 decimals) #3585

Open tonik-ru opened 1 year ago

tonik-ru commented 1 year ago

https://api-eth.bitcore.io/api/ETH/mainnet/tx/0x15596e27229957d80e763a5b7340fa6c6b9ce7bea2fccefa3c63c88513ce9d44 value: 373265727105449900

real value: 0.373265727105449914 https://etherscan.io/tx/0x15596e27229957d80e763a5b7340fa6c6b9ce7bea2fccefa3c63c88513ce9d44

actually you are using Number for tx.value, but this doesn't provide required precision! this is a huge bug! last digits may be important. for example we use this to track invoice Id (last 3-4 digits in eth value)

kajoseph commented 1 year ago

Yeah we should have used something like BN.js or BigInt from the beginning. That was before my time, but my guess is it would have been a more effort than desired to ensure consistency between chains and the db. It's been in our backlog for some time to fix it.