Closed PaulRBerg closed 4 years ago
How are you running your deployment script?
Can you paste the output of this here?
curl --data '{"method":"eth_chainId","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" http://localhost:8545
How are you running your deployment script? This is the command:
yarn buidler run scripts/deploy.ts --network localhost
Can you paste the output of this here? Here you go:
{"id":1,"jsonrpc":"2.0","result":"0x539"}
Weird .. 0x539 seems to indeed be 1337, not 1234. Maybe I have another local node running.
Oh, I think you are setting the network id, not the chain id.
Interesting. Are they different? The Ganache CLI only allows me to set a network id.
This thread on StackExchange also indicates that they are the same thing.
Their difference is subtle, but they are not the same thing. For example, ganache uses a random network id by default, and 1337 as chan id.
Here's an article on their difference: https://medium.com/@pedrouid/chainid-vs-networkid-how-do-they-differ-on-ethereum-eec2ed41635b
These standards change so fast. Thanks! I'll close this issue because with "1337" as the chain id, I can deploy my contracts to my local node.
Fwiw, this seems to be a bug with ganache. It erroneously returns 1337 in some cases:
Description
I spin up my local ganache instance like this:
Add the "localhost" network under "networks" in
buidler.config.ts
:And get this error when running my deployment script:
Environment