@Override
  public PluginRpcResponse call(final String methodName, final Object[] params) {
    checkNotNull(
        inProcessRpcMethods,
        "Service not initialized yet, this method must be called after plugin 'beforeExternalServices' call completes");

    LOG.atTrace()
        .setMessage("Calling method:{} with params:{}")
        .addArgument(methodName)
        .addArgument(() -> Arrays.toString(params))
        .log();

    final var method = inProcessRpcMethods.get(methodName);

    if (method == null) {
      throw new NoSuchElementException("Unknown or not enabled method: " + methodName);
    }

    final var requestContext =
        new JsonRpcRequestContext(new JsonRpcRequest("2.0", methodName, params));
    final var response = method.response(requestContext);
    return new PluginRpcResponse() {
      @Override
      public Object getResult() {
        return switch (response.getType()) {
          case NONE, UNAUTHORIZED -> null;
          case SUCCESS -> ((JsonRpcSuccessResponse) response).getResult();
          case ERROR -> ((JsonRpcErrorResponse) response).getError();
        };
      }

      @Override
      public RpcResponseType getType() {
        return response.getType();
      }
    };
  }
Init the service

@param inProcessRpcMethods set of RPC methods that can be called
app/src/main/java/org/hyperledger/besu/services/RpcEndpointServiceImpl.java