Skip to content

net_version incorrectly returns chainId #25

@petejkim

Description

@petejkim
web3.version.network
=> 61
web3.currentProvider.send({jsonrpc: '2.0', method:"net_version", params:[],id:1})
=> {id: 1, jsonrpc: "2.0", result: 61}
web3.currentProvider.sendAsync({method:"net_version", params:[],id:1}, (err, x) => console.log(err, x))
=> {id: 1, result: "1"}
$ curl -X POST --data '{"jsonrpc":"2.0","method":"net_version","params":[],"id":1}' https://mewapi.epool.io
{"jsonrpc":"2.0","result":"1","id":1}

In Ethereum Classic, network_id is 1 and chain_id is 61. In all other networks, the network_id and chain_id are the same.

Issues:

  1. network_id must be returned as a string, not a number
  2. Node is returning "1", but ClassicMask returns 61 (unless net_version is invoked directly with sendAsync)
  3. However, if ClassicMask correctly returns 1, dapps may think they are on the non-classic Mainnet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    on_holdThis will be fixed later.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions