Skip to content
This repository was archived by the owner on Oct 4, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Rolling builds for the master branch may be found at [builds.etcdevteam.com](bui

#### Added
- JSON-RPC: `debug_traceTransaction` method
- JSON-RPC: `eth_chainId` method; returns configured Ethereum EIP-155 chain id for signing protected txs
- P2P: improve peer discovery by allowing "good-will" for peers with unknown HF blocks

## [3.5.86] - 2017-07-19 - db60074
Expand Down
9 changes: 9 additions & 0 deletions eth/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,15 @@ func (s *PublicEthereumAPI) Syncing() (interface{}, error) {
}, nil
}

// ChainId returns the chain-configured value for EIP-155 chain id, used in signing protected txs.
// If EIP-155 is not configured it will return 0.
// Number will be returned as a string in hexadecimal format.
// 61 - Mainnet $((0x3d))
// 62 - Morden $((0x3e))
func (s *PublicEthereumAPI) ChainId() *big.Int {
return s.e.chainConfig.GetChainID()
}

// PublicMinerAPI provides an API to control the miner.
// It offers only methods that operate on data that pose no security risk when it is publicly accessible.
type PublicMinerAPI struct {
Expand Down
5 changes: 5 additions & 0 deletions internal/web3ext/web3ext.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,11 @@ web3._extend({
call: 'eth_submitTransaction',
params: 1,
inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
}),
new web3._extend.Method({
name: 'chainId',
call: 'eth_chainId',
params: 0
})
],
properties:
Expand Down