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.
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