|
|
@@ -67,6 +67,15 @@ func (api *PublicEthereumAPI) Hashrate() hexutil.Uint64 {
|
|
|
return hexutil.Uint64(api.e.Miner().HashRate())
|
|
|
}
|
|
|
|
|
|
+// ChainId is the EIP-155 replay-protection chain id for the current ethereum chain config.
|
|
|
+func (api *PublicEthereumAPI) ChainId() hexutil.Uint64 {
|
|
|
+ chainID := new(big.Int)
|
|
|
+ if config := api.e.chainConfig; config.IsEIP155(api.e.blockchain.CurrentBlock().Number()) {
|
|
|
+ chainID = config.ChainID
|
|
|
+ }
|
|
|
+ return (hexutil.Uint64)(chainID.Uint64())
|
|
|
+}
|
|
|
+
|
|
|
// 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 {
|