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:
- Aggregator Service: Provides APIs for client applications
- Node Service: Provides APIs for operator nodes
Aggregator Service API Groups#
The Aggregator Service provides several groups of APIs for different functionalities:
API Group | Description | Key Methods |
---|---|---|
Authentication | Handles user authentication | GetKey |
Smart Wallet | Manages smart account operations | GetNonce , GetWallet , ListWallets |
Task Management | Manages task lifecycle | CreateTask , GetTask , ListTasks , CancelTask , DeleteTask , TriggerTask |
Execution | Manages task executions | ListExecutions , GetExecution , GetExecutionStatus |
Secret Management | Manages user secrets | CreateSecret , UpdateSecret , DeleteSecret , ListSecrets |
Analytics | Provides system metrics | GetWorkflowCount , GetExecutionCount |
Sources:
Node Service API#
The Node Service provides APIs for operator interactions:
Method | Description |
---|---|
SyncMessages | Streams task check messages to operators |
NotifyTriggers | Receives trigger notifications from operators |
Ack | Acknowledges 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 Type | Key Format | Description |
---|---|---|
User Tasks | u:<eoa>:<smart-wallet>:<task-id> | Maps user to task status |
Task Data | t:<task-status>:<task-id> | Stores actual task data |
Wallet Info | w:<eoa>:<smart-wallet-address> | Stores wallet information |
Execution History | history:<task-id>:<execution-id> | Stores execution history |
Trigger Status | trigger:<task-id>:<execution-id> | Stores execution status |
Secrets | secret:<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 Code | Description |
---|---|
UnknowError | Generic unspecified error |
RpcNodeError | Error with the RPC node |
StorageUnavailable | Storage system unavailable |
StorageWriteError | Error writing to storage |
SmartWalletRpcError | Error with smart wallet RPC |
SmartWalletNotFoundError | Smart wallet not found |
TaskDataCorrupted | Task data corrupted |
TaskDataMissingError | Task data missing |
TaskTriggerError | Error 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:
- Provides gRPC interfaces for clients and operators
- Manages authentication and authorization
- Delegates business logic to the Task Engine
- Stores and retrieves data from BadgerDB
- 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