Hosted operator API (BLS based)

Overview

The AltLayer-hosted operator comes with APIs. With the APIs, AVS only needs to design and implement its business logic. The API will handle the signature signing and submission to the aggregator.

To interact with the API, there are two options

  1. Interact with the managed operator

  2. Interact with the managed operator proxy

The rationale of operator proxy

While direct interaction with the operator provides the most significant degree of flexibility, it is often necessary to construct the parameters, which can be low-level.

Let's use the following example to illustrate it

    function confirmMessage(
        Params1 p1,
        ...
        ParamsN pN,
        NonSignerStakesAndSignature memory nonSignerStakesAndSignature
    ) external whenNotPaused onlyConfirmer {
    ...
    }

The operator API has a parameter called params_raw. This is the abi-encoded bytes of p1....pN. It can be complex to construct the encoded bytes.

The managed operator proxy abstracted away the complexity. It supports any AVS using the task manager convention. When using the operator proxy API, there is no need to compute param_raw. The AVS builder can focus on providing the actual payload. As such, the API is much simpler and easier to use.

Getting the operator and/or operator proxy endpoint and credentials

Go to the operator section and click on the menu button for "Hosted Operator Service".

Click on the "Credentials" link to display the endpoints, username and password. The username and password are required as the operator and operator proxy API have basic access authentication enabled.

Operator API

Request header

  • Content-Type: application/json

  • Authorization: Basic <base64 encoded of admin:password>

Request body

{
  "id": "1",
  "jsonrpc": "2.0",
  "method": "operator_createSigTask",
  "params": [
    {
      "avs_name": "op",
      "method": "tt",
      "params_raw": "0x00",
      "reference_block_number": 1000,
      "quorum_numbers": [
        0
      ],
      "quorum_threshold_percentages": [
        66
      ],
      "sig_hash": "0x0000000000000000000000000000000000000000000000000000000000000000"
    }
  ]
}
  • method: operator_createSigTask. This is the API method and should not be changed

  • params.avs_name: name of the AVS

  • params.method: the smart contract method that handled the contract call from the aggregator e.g respondToTask

  • params.param_raw: the abi-encoded call data. It can be all calldata or a subset of the calldata

  • params.reference_block_number: reference block number for quorum_numbers and quorum_threshold_percentages

  • params.quorum_numbers : quorum number in which operators have signed for

  • params.quorum_threshold_percentages : quorum threshold for the particular quorum number

  • params.sig_hash : the signed hash of param_raw

Sample curl request

Remember to update

  1. basic auth credentials

  2. avs name

  3. method

  4. params

  5. operator endpoint

curl --noproxy '*' \
  -H "Content-Type: application/json" \
  --header 'Authorization: Basic <base64 encoded admin:password>' 
  -d '{
    "id": "1",
    "jsonrpc": "2.0",
    "method": "operator_createSigTask",
    "params": [
      {
        "avs_name": "op",
        "method": "tt",
        "params_raw": "0x00",
        "reference_block_number": 1000,
        "quorum_numbers": [0],
        "quorum_threshold_percentages": [66],
        "sig_hash": "0x0000000000000000000000000000000000000000000000000000000000000000"
      }
    ]
  }' \
  https://your-avs-operator.alt.technology

Operator Proxy API

Request header

  • Content-Type: application/json

  • Authorization: Basic <base64 encoded of admin:password>

Request body

{
    "id": 2,
    "jsonrpc": "2.0",
    "method": "operator_createSigTaskResponse",
    "params": [
        {
            "method": "respondToRequest",
            "task_created_block": 3003011,
            "message": "0x00",
            "task_index": 100,
            "resp_message": "0x0000"
        }
    ]
}
  • method: operator_createSigTaskResponse. This is the API method and should not be changed

  • params.method: the smart contract method that handled the contract call from the aggregator, e.g respondToTask

  • params.task_created_block: the block number in which the task is created

  • params.message: the task message found inside the Task struct

  • params.task_index: the task index in the smart contract

  • params.resp_message: the response message for the task

Sample curl request

Remember to update

  1. basic auth credentials

  2. params

  3. operator proxy endpoint

curl --noproxy '*' -H "Content-Type: application/json" --header 'Authorization: Basic <base64 encoded admin:password>' \
-d '{
    "id": 2,
    "jsonrpc": "2.0",
    "method": "operator_createSigTaskResponse",
    "params": [
        {
            "method": "respondToRequest",
            "task_created_block": 3003011,
            "message": "0x00",
            "task_index": 100,
            "resp_message": "0x0000"
        }
    ]
}' \
https://your-avs.alt.technology

Sample success response

{
    "jsonrpc": "2.0",
    "id": 2,
    "result": {
        "task_index": 1,
        "tx_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "sig_hash": "0x0000000000000000000000000000000000000000000000000000000000000000"
    }
}

Last updated