class Web3Sha3 implements JsonRpcMethod {

  @Override
  public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
    if (requestContext.getRequest().getParamLength() != 1) {
      // Do we want custom messages for each different type of invalid params?
      return new JsonRpcErrorResponse(
          requestContext.getRequest().getId(), JsonRpcError.INVALID_PARAMS);
    }

    final String data = requestContext.getRequiredParameter(0, String.class);

    if (!data.isEmpty() && !data.startsWith("0x")) {
      return new JsonRpcErrorResponse(
          requestContext.getRequest().getId(), JsonRpcError.INVALID_PARAMS);
    }

    try {
      final Bytes byteData = Bytes.fromHexString(data);
      return new JsonRpcSuccessResponse(
          requestContext.getRequest().getId(), Hash.keccak256(byteData).toString());
    } catch (final IllegalArgumentException err) {
      return new JsonRpcErrorResponse(
          requestContext.getRequest().getId(), JsonRpcError.INVALID_PARAMS);
    }
  }

  public  Web3Sha3();

}