openethereum/rpc/src/v1/traits
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
..
eth_pubsub.rs Latest headers Pub-Sub (#5655) 2017-05-23 12:26:39 +02:00
eth_signing.rs Signer provenance (#4477) 2017-02-14 22:45:43 +01:00
eth.rs Cap gas limit for dapp-originating requests. 2017-08-15 10:38:49 +02:00
mod.rs Latest headers Pub-Sub (#5655) 2017-05-23 12:26:39 +02:00
net.rs Fix whitespace (#4299) 2017-01-25 18:51:41 +01:00
parity_accounts.rs Trezor Support (#6403) 2017-09-14 19:28:43 +02:00
parity_set.rs Dapp refresh (#5752) 2017-08-09 19:06:40 +02:00
parity_signing.rs Compose transaction RPC. (#5524) 2017-05-02 11:39:48 +02:00
parity.rs Add RPC eth_chainId for querying the current blockchain chain ID (#6329) 2017-09-26 14:17:07 +02:00
personal.rs Added missing methods (#5542) 2017-05-04 17:58:01 +02:00
pubsub.rs Make empty params array optional for parity_subscribe. 2017-06-13 16:29:35 +02:00
rpc.rs Full JSON-RPC docs + sync tests. (#4335) 2017-02-01 10:58:09 +01:00
secretstore.rs Secretstore RPCs + integration (#5439) 2017-05-05 14:57:29 +01:00
signer.rs Domain-locked web tokens. (#5894) 2017-06-22 20:05:40 +02:00
traces.rs Cap gas limit for dapp-originating requests. 2017-08-15 10:38:49 +02:00
web3.rs Fix whitespace (#4299) 2017-01-25 18:51:41 +01:00