nimbus-eth1/nimbus/rpc/common.nim

22 lines
762 B
Nim
Raw Normal View History

2018-06-20 20:27:32 +03:00
# Nimbus
# Copyright (c) 2018 Status Research & Development GmbH
# Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
# at your option.
# This file may not be copied, modified, or distributed except according to
# those terms.
import
strutils,
2019-02-05 20:15:50 +01:00
nimcrypto, eth/common as eth_common, stint, json_rpc/server,
../vm_state, ../db/[db_chain, state_db], ../constants, ../config, hexstrings
2018-06-20 20:27:32 +03:00
proc setupCommonRPC*(server: RpcServer) =
server.rpc("web3_clientVersion") do() -> string:
2019-01-15 17:25:14 +02:00
result = NimbusIdent
2018-06-20 20:27:32 +03:00
server.rpc("web3_sha3") do(data: HexDataStr) -> string:
2019-04-24 15:35:29 +02:00
var rawdata = nimcrypto.fromHex(data.string[2 .. ^1])
2018-06-20 20:27:32 +03:00
result = "0x" & $keccak_256.digest(rawdata)