Closed wulikai93 closed 4 years ago
@wulikai93 if using the infura rpc url, then you need to include the api key which you can get one from their dashboard https://infura.io/
I'll update the guides to mention this
thanks!
@miguelmota I logged in the infura dashboard and create a project. Then i change the url as following( i use the real project ID rather than the string "MY-PROJECT-ID" in my code):
client, err := ethclient.Dial("https://mainnet.infura.io/v3/MY-PROJECT-ID")
But i also get a return:
2019/12/15 18:03:41 403 Forbidden {"jsonrpc":"2.0","id":2,"error":{"code":-32002,"message":"project ID does not have access to archive state","data":{"see":"https://infura.io/dashboard"}}}
In conclusion, when i don't offer a project ID, it says project ID is required to access archive state
. But when i offer a project ID, it says project ID does not have access to archive state
.
Is thera anything i done uncorrectly?
Looks like Infura changed their pricing model a few months ago:
The options now are to either pay for the api service, looks for an alternative rpc provider, or run your own archival node in order to retrieve historical data.
The cheapest option might be to run your own archival node locally or on something like EC2 or digital ocean.
You could try the cloudflare rpc provider (https://cloudflare-eth.com) but I don't think it supports archival data.
I run the code in this page. The logs are:
It shows that
client.BalanceAt(context.Background(), account, nil)
return the balance, butbalanceAt, err := client.BalanceAt(context.Background(), account, blockNumber)
not.I wonder what's the reason here and how to fix it. Thanks a lot if anyone can help me.