Update web3_sha3 to use nimcrypto
This commit is contained in:
parent
4d3c721ef4
commit
c8fa9eac7e
|
@ -0,0 +1,8 @@
|
|||
import nimcrypto
|
||||
|
||||
proc k256*(data: string): string =
|
||||
# do not convert, assume string is data
|
||||
var k = sha3_256()
|
||||
k.init
|
||||
k.update(cast[ptr uint8](data[0].unsafeaddr), data.len.uint)
|
||||
result = $finish(k)
|
|
@ -1,25 +1,28 @@
|
|||
import servertypes, json, asyncdispatch, rpcregistration
|
||||
import keccak_tiny
|
||||
import cryptoutils
|
||||
|
||||
proc web3_clientVersion {.rpc.} =
|
||||
return %("Nimbus-RPC-Test")
|
||||
|
||||
proc web3_sha3 {.rpc.} =
|
||||
let
|
||||
data = params.getStr
|
||||
res = $sha3_256(data)
|
||||
return %res
|
||||
var data = params.getStr
|
||||
let kres = k256(data)
|
||||
return %kres
|
||||
|
||||
proc net_version {.rpc.} =
|
||||
discard
|
||||
|
||||
proc net_peerCount {.rpc.} =
|
||||
# TODO: Discovery integration
|
||||
#[ See:
|
||||
https://github.com/ethereum/interfaces/issues/6
|
||||
https://github.com/ethereum/EIPs/issues/611
|
||||
]#
|
||||
discard
|
||||
|
||||
proc net_listening {.rpc.} =
|
||||
return %"true"
|
||||
|
||||
proc net_peerCount {.rpc.} =
|
||||
# TODO: Discovery integration
|
||||
discard
|
||||
|
||||
proc eth_protocolVersion {.rpc.} =
|
||||
discard
|
||||
|
||||
|
|
Loading…
Reference in New Issue