Differences between data returned by Moralis and data on Etherscan

Hello,

I was playing around with Moralis and found that some of the blocks data returned from the SDK was different than what I could find on Etherscan. Some of the affected fields are the block’s difficulty and totalDifficulty, as well as many transactions’ value field. :thinking:

Now, the differences are not massive (like for the examples bellow), but I’m still wondering why those differences are there in the first place? Isn’t on-chain data immutable and the same for everyone?

Thanks for your help!

Here is the code I ran to get the block’s data:

import 'dotenv/config';
import Moralis from 'moralis/node';

const BLOCK_NO = 14892200;

async function run() {
  const serverUrl = process.env.MORALIS_SERVER_URL;
  const appId = process.env.MORALIS_APP_ID;
  const masterKey = process.env.MORALIS_MASTER_KEY;

  await Moralis.start({ serverUrl, appId, masterKey });

  const block = await Moralis.Web3API.native.getBlock({
    chain: 'eth',
    block_number_or_hash: `${BLOCK_NO}`,
  });

  console.log(block);
}

run();

As you may see, the block’s difficulty here is:
14180748056389072
But for the same block, Etherscan has it with a difficulty of:
14180748056389071

Some examples of differing transaction values:
Tx: 0x6edd60040599ad4bc89aead6a218fb20c2c79133e02bfa0f680e820412f9da7e
Moralis: 29055532334486696
Etherscan: 29055532334486698

Tx: 0x369e537743d6cea9f2d070d2c09dc0e55c36a7d5317de8f824543bd88f55adaf
Moralis: 70604403730000030
Etherscan: 70604403730000034

Tx: 0x0b9da91fd97de70cb7f90f234969951c29b4bf0f8579ae9d38e7f1244097b0f8
Moralis: 164124978618861820
Etherscan: 164124978618861830

I will take a look tomorrow. I would not expect to be differences.

it looks like an issue on our side, we will fix it, thanks for reporting

Hi! :wave:

I just rechecked and the discrepancies still seem to be present. :no_mouth:

Where can I get subscribe to get updates on the resolvement of this issue? :pray:

Thank you so much! :raised_hands:

This was not fixed yet. We know what causes it.

1 Like

No worries if it is not fixed yet. :raised_hands:

Thanks for such a quick response! :exploding_head:

I’d be curious to know what’s the cause if you don’t mind. :pray: Love to learn! :blush:

Thanks!

It is related to how JavaScript represents numbers.

1 Like

Uhm! Makes sense! :slightly_smiling_face:

I had issues with that as well when working with events obtained through a direct web3.js subscription. :thought_balloon:

Should I keep an eye on this topic for updates or look for a changelog somewhere else?

I’ll stop bothering you, have a good one!

You can wait for updates here or ask again for updates if it still takes too much time without an update.

1 Like

Hello!

Any update on this thread?

Thanks!

Victor

1 Like

@cryptokid I see that you liked my comment but don’t see your reply, is the issue being fixed or is it still in the backlog?

We are working on it now.

1 Like

Great! Thank you so much! :tada: