RPC Server

The RPC Server is a core component of the EigenLayer-AVS Aggregator service that provides remote procedure call (RPC) interfaces for client applications and operators.

The RPC Server is a core component of the EigenLayer-AVS Aggregator service that provides remote procedure call (RPC) interfaces for client applications and operators. It serves as the primary communication gateway for the system, exposing gRPC endpoints that enable task management, smart wallet operations, operator coordination, and secret management.

Overview#

The RPC Server is implemented as a gRPC server that handles requests from external clients and operators. It authenticates incoming requests, routes them to the appropriate internal components (primarily the Task Engine), and returns the results.

Role in System Architecture#

Sources:

RPC Server Component Structure#

The RPC Server comprises several key components that work together to handle client requests:

Sources:

Server Initialization and Startup#

The RPC Server is initialized and started by the Aggregator service. It sets up the gRPC server, registers the service implementations, and starts listening for requests.

Sources:

API Structure#

The RPC Server exposes two main service interfaces:

  1. Aggregator Service: Provides APIs for client applications
  2. Node Service: Provides APIs for operator nodes

Aggregator Service API Groups#

The Aggregator Service provides several groups of APIs for different functionalities:

API GroupDescriptionKey Methods
AuthenticationHandles user authenticationGetKey
Smart WalletManages smart account operationsGetNonce, GetWallet, ListWallets
Task ManagementManages task lifecycleCreateTask, GetTask, ListTasks, CancelTask, DeleteTask, TriggerTask
ExecutionManages task executionsListExecutions, GetExecution, GetExecutionStatus
Secret ManagementManages user secretsCreateSecret, UpdateSecret, DeleteSecret, ListSecrets
AnalyticsProvides system metricsGetWorkflowCount, GetExecutionCount

Sources:

Node Service API#

The Node Service provides APIs for operator interactions:

MethodDescription
SyncMessagesStreams task check messages to operators
NotifyTriggersReceives trigger notifications from operators
AckAcknowledges messages from operators

Sources:

Authentication Flow#

The RPC Server uses an authentication mechanism based on Ethereum addresses. Most API methods require authentication:

Almost all RPC methods in the server begin with authentication verification, as can be seen in methods like GetWallet, CreateTask, etc.

Sources:

Task Management APIs#

The RPC Server provides comprehensive APIs for managing tasks throughout their lifecycle:

Task Creation and Retrieval#

The Task Management APIs allow clients to:

  • Create new tasks with various trigger conditions
  • Retrieve individual tasks or list tasks
  • Modify task state (cancel, delete)
  • Manually trigger tasks

Sources:

Smart Wallet APIs#

The RPC Server provides APIs for managing smart wallets (account abstraction):

Sources:

Operator Communication#

The RPC Server provides special APIs for interacting with operators in the network:

This bidirectional communication enables:

  • Streaming task check messages to operators
  • Receiving notifications about triggered conditions
  • Acknowledging message receipt

Sources:

Secret Management#

The RPC Server provides APIs for managing secrets that can be used in tasks:

These APIs allow for:

  • Creating and updating secrets
  • Deleting secrets
  • Listing available secrets
  • Scoping secrets to specific workflows

Sources:

Storage Keys and Persistence#

The RPC Server uses BadgerDB as its storage backend, with a well-defined key schema for different entities:

Entity TypeKey FormatDescription
User Tasksu:<eoa>:<smart-wallet>:<task-id>Maps user to task status
Task Datat:<task-status>:<task-id>Stores actual task data
Wallet Infow:<eoa>:<smart-wallet-address>Stores wallet information
Execution Historyhistory:<task-id>:<execution-id>Stores execution history
Trigger Statustrigger:<task-id>:<execution-id>Stores execution status
Secretssecret:<org_id>:<eoa>:<workflow_id>:<name>Stores secret values

Sources:

Error Handling#

The RPC Server uses standard gRPC error codes along with custom error codes defined in the protocol:

Error CodeDescription
UnknowErrorGeneric unspecified error
RpcNodeErrorError with the RPC node
StorageUnavailableStorage system unavailable
StorageWriteErrorError writing to storage
SmartWalletRpcErrorError with smart wallet RPC
SmartWalletNotFoundErrorSmart wallet not found
TaskDataCorruptedTask data corrupted
TaskDataMissingErrorTask data missing
TaskTriggerErrorError triggering task

Errors are returned to clients as gRPC status errors with appropriate codes and messages.

Sources:

Summary#

The RPC Server is a critical component of the EigenLayer-AVS system that:

  1. Provides gRPC interfaces for clients and operators
  2. Manages authentication and authorization
  3. Delegates business logic to the Task Engine
  4. Stores and retrieves data from BadgerDB
  5. Handles communication with operators

It serves as the primary entry point for all external interactions with the system, providing a comprehensive API for task automation, smart wallet management, and operator coordination.

Feature this wiki to auto refresh weekly

Try DeepWiki on your private codebase with Devin