Setup a Multichain Service

Overview

This guide walks you through configuring your AVS components for proper Multichain support, natively supported by the Othentic Stack, by modifying the following components:

  1. Environment Variables

  2. Specifying Target Chain on Task Submission

Prerequisites

For additional reference, see this Github repo for boilerplate code.


Environment Variables

The Othentic CLI natively supports multi-L2 configurations for L2-specific environment variables.

1

Set L2_CHAIN

Specify the names of all L2 chains, separated by commas. You can use standard chain names and specify specific environments as detailed here, or use numerical ChainId s.

.env
L2_CHAIN=<chain1>,<chain2>

Example

L2_CHAIN=amoy,base-sepolia
2

Set L2_RPC

Specify the RPC endpoints for all L2 chains, separated by commas:

L2_RPC=<chain_id_1>@<rpc_endpoint_1>,<chain_id_2>@<rpc_endpoint_2>

Example

L2_RPC=80002@https://rpc-amoy.example.com,84532@https://rpc-base-sepolia.example.com
3

Set ATTESTATION_CENTER_ADDRESS

Specify all the AttestationCenter contracts for all L2 chains, separated by commas:

ATTESTATION_CENTER_ADDRESS=<chain_id_1>@<attestation_center_address_1>,<chain_id_2>@<attestation_center_address_2>

Example

ATTESTATION_CENTER_ADDRESS=80002@0x1C4E893Dcc1eAFbf59f8a75e0AbB49Cd841bCECc,84532@0x022AFc410f1190F9a9642AAB990d0668268327a6
4

Send tasks to the corresponding L2

In your Execution Service implementation, make sure to specify the correct targetChainId parameter in the sendTask RPC request sent to the AVS network.

Example

{
  "jsonrpc": "2.0",
  "method": "sendTask",
  "params": [
    "proof_string",    // <proofOfTask>
    "extra_data",      // <data>
    "1",               // <taskDefinitionId>
    "0xabcd....7890",  // <performerAddress>
    "c35a......62df",  // <signature>
    "bls",             // <signatureType>
    "84532"            // <targetChainId>   <------ Pass target chain ID
  ]
}

Last updated