Skip to content

Commit

Permalink
Propose to move EIP-695 to last call status (ethereum#1566)
Browse files Browse the repository at this point in the history
* Propose to move EIP-695 to last call status

* Add a discussion link

* Formatting fix

* Fix @sorpaas handle in author field

* Use EIP155 formatting for `CHAIN_ID`

* Formatting fix for "chain ID"

The document had places where we use lowercase "id" and uppercase "ID". This unify them to use uppercase "ID".

* Update eip-695.md
  • Loading branch information
sorpaas authored and t4n6a1ka committed Jul 2, 2019
1 parent fe7601d commit ae81383
Showing 1 changed file with 23 additions and 24 deletions.
47 changes: 23 additions & 24 deletions EIPS/eip-695.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
eip: 695
title: Create `eth_chainId` method for JSON-RPC
author: Isaac Ardis <[email protected]>, Wei Tang <[email protected]>, Fan Torchz (@tcz001)
author: Isaac Ardis <[email protected]>, Wei Tang (@sorpaas), Fan Torchz (@tcz001)
discussions-to: https://ethereum-magicians.org/t/eip-695-create-eth-chainid-method-for-json-rpc/1845
type: Standards Track
category: Interface
status: Draft
Expand All @@ -10,37 +11,40 @@ requires: 1474
---

## Simple Summary

Include `eth_chainId` method in `eth_`-namespaced JSON-RPC methods.

## Abstract

The `eth_chainId` method should return a single STRING result
for an integer value in hexadecimal format, describing the
currently configured "Chain Id" value used for signing replay-protected transactions,
currently configured `CHAIN_ID` value used for signing replay-protected transactions,
introduced via [EIP-155](./eip-155.md).

## Motivation
Currently although we can use net_version RPC call to get the

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.

## Specification

----
### `eth_chainId`

### eth_chainId

Returns the currently configured chain id, a value used in replay-protected transaction
Returns the currently configured chain ID, a value used in replay-protected transaction
signing as introduced by [EIP-155](./eip-155.md).

##### Parameters
none
#### Parameters

None.

##### Returns
#### Returns

`QUANTITY` - integer of the current chain id. Defaults are mainnet=61, morden=62.
`QUANTITY` - integer of the current chain ID.

#### Example

##### Example
```js
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}'

Expand All @@ -52,33 +56,28 @@ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}
}
```

----

## Rationale

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.

Please note related links:

- [Parity PR](https://github.com/paritytech/parity/pull/6329)
- [Geth Classic PR (merged)](https://github.com/ethereumproject/go-ethereum/pull/336)


## Backwards Compatibility
Not relevant.

## Test Cases
Not currently implemented.
Not relevant.

## Implementation
Would be good to have a test to confirm that expected==got.

- [Parity PR](https://github.com/paritytech/parity/pull/6329)
- [Geth PR](https://github.com/ethereum/go-ethereum/pull/17617)
- [Geth Classic PR](https://github.com/ethereumproject/go-ethereum/pull/336)

## Reference

Return value `QUANTITY` adheres to standard JSON RPC hex value encoding, as documented here: https://github.com/ethereum/wiki/wiki/JSON-RPC#hex-value-encoding.

## Copyright

Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).

0 comments on commit ae81383

Please sign in to comment.