-
RecapThis is working const json = await fetch(new Request("https://cloudflare-eth.com", {
method: "POST",
body: JSON.stringify({
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 83
}),
headers: {
"Content-Type": "application/json"
}
})).then((resp) => {
return resp.json()
});
console.log(json); This is not import { ethers } from "ethers";
const provider = new ethers.providers.CloudflareProvider();
const latestBlockNumber = await provider.getBlockNumber()
console.log(latestBlockNumber); It throw
The question is...1. Why this said
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The Cloudflare backend has historically been unreliable and responds with non-standard results. It’s a great question why they didn’t support If the former works now, I can change it, but that doesn’t change the fact that the latter should still work, so I still have little faith in them as a backend. :( I would highly recommend using the other backends instead. I won’t rely on Cloudflare. :s |
Beta Was this translation helpful? Give feedback.
The Cloudflare backend has historically been unreliable and responds with non-standard results.
It’s a great question why they didn’t support
blockNumber
, it intermittently seems to, sometimes, butgetBlockByNumber
seemed to always work.If the former works now, I can change it, but that doesn’t change the fact that the latter should still work, so I still have little faith in them as a backend. :(
I would highly recommend using the other backends instead. I won’t rely on Cloudflare. :s