rpc: implements rpc server