openethereum/rpc/src/v1
Wei Tang d8af9f4e7b Add RPC eth_chainId for querying the current blockchain chain ID (#6329)
* Add RPC eth_chainId for querying the current blockchain chain ID

Currently although we can use `net_version` RPC call to get the
current network ID, there's no RPC for querying the chain ID. This
makes it impossible to determine the current actual blockchain using
the RPC. An ETH/ETC client can accidentally connect to an ETC/ETH RPC
endpoint without knowing it unless it tries to sign a transaction or
it fetch a transaction that is known to have signed with a chain
ID. This has since caused trouble for application developers, such as
MetaMask, to add multi-chain support.

The same RPC endpoint is also about to be merged for ETC's
go-ethereum: https://github.com/ethereumproject/go-ethereum/pull/336

* Add eth_chainId to js's web3 interface

* Add a mocked test for eth_chainId

* Add chainId in js's jsonrpc interfaces

* Change return type for eth_chainId to `Option<u64>`

* Change name eth_chainId to parity_chainId

* Wrong test name and missed var for rpc_parity_chain_id test

* Use U256 to return chainId and fix for master

u64 returns decimal integer, and there seems to be no type called
U64. So here I use U256 to return the hex integer.

* Fix chainID test

Before EIP155 fork number, chainID should be null.

* Change both parity_chainId and transaction::chainId to use U64

This makes it consistent that all chain ids returned are hex string.

* Fix wrong U64 serialization
2017-09-26 14:17:07 +02:00
..
helpers Use host as ws/dapps url if present. 2017-09-21 15:11:15 +02:00
impls Add RPC eth_chainId for querying the current blockchain chain ID (#6329) 2017-09-26 14:17:07 +02:00
tests Add RPC eth_chainId for querying the current blockchain chain ID (#6329) 2017-09-26 14:17:07 +02:00
traits Add RPC eth_chainId for querying the current blockchain chain ID (#6329) 2017-09-26 14:17:07 +02:00
types Add RPC eth_chainId for querying the current blockchain chain ID (#6329) 2017-09-26 14:17:07 +02:00
extractors.rs Don't reexport bigint from util 2017-09-04 16:36:49 +02:00
informant.rs remove re-export of parking_lot in util (#6435) 2017-09-02 20:09:13 +02:00
metadata.rs Cap gas limit for dapp-originating requests. 2017-08-15 10:38:49 +02:00
mod.rs rpc -> weak to arc (#5688) 2017-05-28 08:40:36 -04:00