|
| 1 | +# Hyperlane Agent Commands Guide |
| 2 | + |
| 3 | +This guide documents all HTTP endpoints exposed by Hyperlane relayer and validator agents on their metrics server (default port 9090). |
| 4 | + |
| 5 | +## Table of Contents |
| 6 | +- [Common Endpoints](#common-endpoints) |
| 7 | +- [Relayer Endpoints](#relayer-endpoints) |
| 8 | +- [Validator Endpoints](#validator-endpoints) |
| 9 | + |
| 10 | +## Common Endpoints |
| 11 | + |
| 12 | +### Metrics |
| 13 | +- **Endpoint**: `GET /metrics` |
| 14 | +- **Description**: Returns Prometheus metrics in OpenMetrics format |
| 15 | +- **Example**: |
| 16 | + ```bash |
| 17 | + curl http://localhost:9090/metrics |
| 18 | + ``` |
| 19 | + |
| 20 | +## Relayer Endpoints |
| 21 | + |
| 22 | +### 1. Message Retry |
| 23 | +- **Endpoint**: `POST /message_retry` |
| 24 | +- **Description**: Retry messages based on matching criteria |
| 25 | +- **Parameters**: JSON array of matching criteria |
| 26 | + - `messageid`: Specific message ID to retry |
| 27 | + - `origindomain`: Filter by origin domain ID |
| 28 | + - `destinationdomain`: Filter by destination domain ID |
| 29 | + - `senderaddress`: Filter by sender address |
| 30 | + - `recipientaddress`: Filter by recipient address |
| 31 | +- **Example**: |
| 32 | + ```bash |
| 33 | + # Retry by message ID |
| 34 | + curl http://localhost:9090/message_retry -X POST \ |
| 35 | + -H "Content-Type: application/json" \ |
| 36 | + -d '[{"messageid": "0x842010253b156c22709f098e3a99b5af4048f0f5cab0e0db493fd864f5b05f94"}]' |
| 37 | + |
| 38 | + # Retry by destination domain |
| 39 | + curl http://localhost:9090/message_retry -X POST \ |
| 40 | + -H "Content-Type: application/json" \ |
| 41 | + -d '[{"destinationdomain": 42161}]' |
| 42 | + |
| 43 | + # Retry by multiple criteria |
| 44 | + curl http://localhost:9090/message_retry -X POST \ |
| 45 | + -H "Content-Type: application/json" \ |
| 46 | + -d '[{"origindomain": 1}, {"destinationdomain": 42161}]' |
| 47 | + ``` |
| 48 | + |
| 49 | +### 2. List Operations |
| 50 | +- **Endpoint**: `GET /list_operations` |
| 51 | +- **Description**: List pending operations for a specific destination domain |
| 52 | +- **Query Parameters**: |
| 53 | + - `destination_domain`: Domain ID (required) |
| 54 | +- **Example**: |
| 55 | + ```bash |
| 56 | + curl "http://localhost:9090/list_operations?destination_domain=42161" |
| 57 | + ``` |
| 58 | + |
| 59 | +### 3. List Messages |
| 60 | +- **Endpoint**: `GET /messages` |
| 61 | +- **Description**: Retrieve messages by nonce range |
| 62 | +- **Query Parameters**: |
| 63 | + - `domain_id`: Domain ID (required) |
| 64 | + - `nonce_start`: Starting nonce (required) |
| 65 | + - `nonce_end`: Ending nonce (required) |
| 66 | +- **Example**: |
| 67 | + ```bash |
| 68 | + curl "http://localhost:9090/messages?domain_id=1&nonce_start=100&nonce_end=120" |
| 69 | + ``` |
| 70 | + |
| 71 | +### 4. Insert Messages |
| 72 | +- **Endpoint**: `POST /messages` |
| 73 | +- **Description**: Insert messages into the database |
| 74 | +- **Parameters**: JSON body with message data |
| 75 | + |
| 76 | +### 5. List Merkle Tree Insertions |
| 77 | +- **Endpoint**: `GET /merkle_tree_insertions` |
| 78 | +- **Description**: List merkle tree insertions |
| 79 | +- **Query Parameters**: Varies by implementation |
| 80 | + |
| 81 | +### 6. Insert Merkle Tree Insertions |
| 82 | +- **Endpoint**: `POST /merkle_tree_insertions` |
| 83 | +- **Description**: Insert merkle tree data |
| 84 | +- **Parameters**: JSON body with insertion data |
| 85 | + |
| 86 | +### 7. Add IGP Rule |
| 87 | +- **Endpoint**: `POST /igp_rules` |
| 88 | +- **Description**: Add a new interchain gas payment enforcement rule |
| 89 | +- **Parameters**: JSON body with: |
| 90 | + - `policy`: Gas payment enforcement policy |
| 91 | + - `"None"`: No enforcement |
| 92 | + - `{"Minimum": {"payment": "0x64"}}`: Minimum payment requirement |
| 93 | + - `matching_list`: Array of matching criteria |
| 94 | +- **Example**: |
| 95 | + ```bash |
| 96 | + curl http://localhost:9090/igp_rules -X POST \ |
| 97 | + -H "Content-Type: application/json" \ |
| 98 | + -d '{ |
| 99 | + "policy": { |
| 100 | + "Minimum": { |
| 101 | + "payment": "0x64" |
| 102 | + } |
| 103 | + }, |
| 104 | + "matching_list": [ |
| 105 | + { |
| 106 | + "origindomain": 100 |
| 107 | + } |
| 108 | + ] |
| 109 | + }' |
| 110 | + ``` |
| 111 | + |
| 112 | +### 8. List IGP Rules |
| 113 | +- **Endpoint**: `GET /igp_rules` |
| 114 | +- **Description**: List all configured IGP rules |
| 115 | +- **Example**: |
| 116 | + ```bash |
| 117 | + curl http://localhost:9090/igp_rules |
| 118 | + ``` |
| 119 | + |
| 120 | +### 9. Remove IGP Rule |
| 121 | +- **Endpoint**: `DELETE /igp_rules/{index}` |
| 122 | +- **Description**: Remove an IGP rule by index |
| 123 | +- **Parameters**: |
| 124 | + - `index`: Rule index in path |
| 125 | +- **Example**: |
| 126 | + ```bash |
| 127 | + curl -X DELETE http://localhost:9090/igp_rules/0 |
| 128 | + ``` |
| 129 | + |
| 130 | +### 10. Environment Variables (Optional) |
| 131 | +- **Endpoint**: `GET/POST /environment_variable` |
| 132 | +- **Description**: Get or set environment variables |
| 133 | +- **Note**: Only enabled when `HYPERLANE_RELAYER_ENVIRONMENT_VARIABLE_ENDPOINT_ENABLED=true` |
| 134 | +- **Parameters**: JSON body with: |
| 135 | + - `name`: Variable name |
| 136 | + - `value`: Variable value (optional, omit to unset) |
| 137 | +- **Example**: |
| 138 | + ```bash |
| 139 | + # Get environment variable |
| 140 | + curl http://localhost:9090/environment_variable \ |
| 141 | + -H "Content-Type: application/json" \ |
| 142 | + -d '{"name": "MY_VAR"}' |
| 143 | + |
| 144 | + # Set environment variable |
| 145 | + curl http://localhost:9090/environment_variable -X POST \ |
| 146 | + -H "Content-Type: application/json" \ |
| 147 | + -d '{"name": "MY_VAR", "value": "my_value"}' |
| 148 | + |
| 149 | + # Unset environment variable |
| 150 | + curl http://localhost:9090/environment_variable -X POST \ |
| 151 | + -H "Content-Type: application/json" \ |
| 152 | + -d '{"name": "MY_VAR"}' |
| 153 | + ``` |
| 154 | + |
| 155 | +## Validator Endpoints |
| 156 | + |
| 157 | +### 1. EigenLayer Node Info |
| 158 | +- **Endpoint**: `GET /eigen/node` |
| 159 | +- **Description**: Returns node information |
| 160 | +- **Response**: |
| 161 | + ```json |
| 162 | + { |
| 163 | + "node_name": "Hyperlane Validator", |
| 164 | + "spec_version": "0.1.0", |
| 165 | + "node_version": "0.1.0" |
| 166 | + } |
| 167 | + ``` |
| 168 | +- **Example**: |
| 169 | + ```bash |
| 170 | + curl http://localhost:9090/eigen/node |
| 171 | + ``` |
| 172 | + |
| 173 | +### 2. EigenLayer Node Health |
| 174 | +- **Endpoint**: `GET /eigen/node/health` |
| 175 | +- **Description**: Returns node health status |
| 176 | +- **Response Codes**: |
| 177 | + - `200`: Healthy (checkpoint delta ≤ 1) |
| 178 | + - `206`: Partially healthy (checkpoint delta ≤ 10) |
| 179 | + - `503`: Unhealthy (checkpoint delta > 10) |
| 180 | +- **Example**: |
| 181 | + ```bash |
| 182 | + curl http://localhost:9090/eigen/node/health |
| 183 | + ``` |
| 184 | + |
| 185 | +### 3. EigenLayer Node Services |
| 186 | +- **Endpoint**: `GET /eigen/node/services` |
| 187 | +- **Description**: List validator services |
| 188 | +- **Response**: |
| 189 | + ```json |
| 190 | + [ |
| 191 | + { |
| 192 | + "id": "hyperlane-validator-indexer", |
| 193 | + "name": "indexer", |
| 194 | + "description": "indexes the messages from the origin chain mailbox", |
| 195 | + "status": "Up" |
| 196 | + }, |
| 197 | + { |
| 198 | + "id": "hyperlane-validator-submitter", |
| 199 | + "name": "submitter", |
| 200 | + "description": "signs messages indexed from the indexer", |
| 201 | + "status": "Up" |
| 202 | + } |
| 203 | + ] |
| 204 | + ``` |
| 205 | +- **Example**: |
| 206 | + ```bash |
| 207 | + curl http://localhost:9090/eigen/node/services |
| 208 | + ``` |
| 209 | + |
| 210 | +### 4. EigenLayer Service Health |
| 211 | +- **Endpoint**: `GET /eigen/node/services/{service_id}/health` |
| 212 | +- **Description**: Check health of a specific service |
| 213 | +- **Parameters**: |
| 214 | + - `service_id`: Service identifier in path |
| 215 | +- **Response Codes**: |
| 216 | + - `200`: Service healthy |
| 217 | + - `503`: Service unhealthy |
| 218 | +- **Example**: |
| 219 | + ```bash |
| 220 | + curl http://localhost:9090/eigen/node/services/hyperlane-validator-indexer/health |
| 221 | + ``` |
| 222 | + |
| 223 | +## Usage Notes |
| 224 | + |
| 225 | +1. **Default Port**: Both relayer and validator agents expose their HTTP server on port 9090 by default. This can be configured via agent settings. |
| 226 | + |
| 227 | +2. **Authentication**: These endpoints are not authenticated by default. Ensure proper network security if exposing to public networks. |
| 228 | + |
| 229 | +3. **Response Format**: Most endpoints return JSON responses. Check the `Content-Type` header in responses. |
| 230 | + |
| 231 | +4. **Error Handling**: Failed requests typically return appropriate HTTP status codes: |
| 232 | + - `400`: Bad Request (invalid parameters) |
| 233 | + - `404`: Not Found (resource doesn't exist) |
| 234 | + - `500`: Internal Server Error |
| 235 | + |
| 236 | +5. **Matching Lists**: When using matching lists in endpoints like `/message_retry` or `/igp_rules`, you can combine multiple criteria. All specified criteria must match for the rule to apply. |
| 237 | + |
| 238 | +## Common Use Cases |
| 239 | + |
| 240 | +### Retry Failed Messages |
| 241 | +```bash |
| 242 | +# Retry all messages to a specific destination |
| 243 | +curl http://localhost:9090/message_retry -X POST \ |
| 244 | + -H "Content-Type: application/json" \ |
| 245 | + -d '[{"destinationdomain": 137}]' |
| 246 | +``` |
| 247 | + |
| 248 | +### Monitor Validator Health |
| 249 | +```bash |
| 250 | +# Check if validator is healthy |
| 251 | +curl -s -o /dev/null -w "%{http_code}" http://localhost:9090/eigen/node/health |
| 252 | +``` |
| 253 | + |
| 254 | +### Debug Pending Operations |
| 255 | +```bash |
| 256 | +# View all pending operations for Arbitrum |
| 257 | +curl "http://localhost:9090/list_operations?destination_domain=42161" | jq |
| 258 | +``` |
| 259 | + |
| 260 | +### Configure Gas Payment Rules |
| 261 | +```bash |
| 262 | +# Require minimum gas payment for messages from Ethereum |
| 263 | +curl http://localhost:9090/igp_rules -X POST \ |
| 264 | + -H "Content-Type: application/json" \ |
| 265 | + -d '{ |
| 266 | + "policy": { |
| 267 | + "Minimum": { |
| 268 | + "payment": "0x3B9ACA00" |
| 269 | + } |
| 270 | + }, |
| 271 | + "matching_list": [ |
| 272 | + { |
| 273 | + "origindomain": 1 |
| 274 | + } |
| 275 | + ] |
| 276 | + }' |
| 277 | +``` |
0 commit comments