const ethers = require('ethers');
const NODE_URL = "CHAINSTACK_NODE_URL";
const provider = new ethers.JsonRpcProvider(NODE_URL);
// pathUSD token address
const PATHUSD = "0x20c0000000000000000000000000000000000000";
const getProof = async () => {
// Get proof for storage slot 0 (often totalSupply)
const proof = await provider.send("eth_getProof", [
PATHUSD,
["0x0", "0x1"],
"latest"
]);
console.log(`Account: ${proof.address}`);
console.log(`Balance: ${proof.balance}`);
console.log(`Nonce: ${parseInt(proof.nonce, 16)}`);
console.log(`Code Hash: ${proof.codeHash}`);
console.log(`Storage Hash: ${proof.storageHash}`);
console.log(`\nAccount Proof nodes: ${proof.accountProof.length}`);
for (const sp of proof.storageProof) {
console.log(`\nStorage Key: ${sp.key}`);
console.log(` Value: ${sp.value}`);
console.log(` Proof nodes: ${sp.proof.length}`);
}
};
getProof();