Service manifest and manager
A service is a collection of smart contracts, operators, and offchain components that make up a WAVS AVS. The different parts of a service are defined in a service manifest or service.json
file. This file can be stored on IPFS or an HTTP/HTTPS server, and its URL is set on the service manager contract during deployment, allowing the system to fetch the service definition when needed.
The service manifest defines the configuration and different parts of a WAVS service, including information about the service, workflows, components, submission, service manager contract, and more.
Generate Manifest
You can create the service.json file using the wavs-cli service
command. The template provides a script to generate a single-component service with ease, build_service.sh.
Example Manifest
{// Basic service information"id": "example-service-123","name": "Example WAVS Service",// Workflows define the different execution paths in your service"workflows": {// Each workflow has a unique ID"default": {// Trigger defines what initiates the workflow"trigger": {// This example uses an EVM contract event trigger"evm_contract_event": {"chain_name": "ethereum","address": "0x1234567890123456789012345678901234567890","event_hash": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890"}},// Component defines the WASI component to execute"component": {"source": {"Registry": {"registry": {// (SHA-256) hash that identifies a specific version of a WASI component's code in WAVS"digest": "882b992af8f78e0aaceaf9609c7ba2ce80a22c521789c94ae1960c43a98295f5",// The domain the warg WASI component is hosted on"domain": "localhost:8090",// The version of this component"version": "0.1.0",// The package name of the component on the domain registry"package": "example:evmrustoracle"}}},// Permissions define what the component can access"permissions": {// HTTP host permissions"allowed_http_hosts": "all" // Options: "all", ["host1", "host2"], or "none"// File system permissions"file_system": true},// Resource limits"fuel_limit": 1000000, // Optional: Maximum compute units"time_limit_seconds": 30, // Optional: Maximum execution time// Component-specific configuration"config": {"endpoint": "https://api.example.com","timeout": "30s"},// Environment variables to be passed to the component"env_keys": ["WAVS_ENV_API_KEY","WAVS_ENV_SECRET"]},// Submit defines where the results are sent"submit": {// The aggregator configuration"aggregator": {"url": "http://127.0.0.1:8001"}},"aggregators": [{"evm": {// The identifier for the chain the submission contract (set in wavs.toml)"chain_name": "ethereum",// The address of the submission contract with the service handler interface"address": "0xfedcba9876543210fedcba9876543210fedcba98",// The maximum amount of gas for submission"max_gas": 1000000 // Optional}}]} //other workflows can be added here},// Service status"status": "active", // Options: "active" or "inactive"// Service manager configuration"manager": {"evm": {"chain_name": "ethereum",// The address of the service manager contract"address": "0xabcdef1234567890abcdef1234567890abcdef12"}}}
Upload
This file should be uploaded to IPFS, or some other hosted service that all operators can access. The template launches a local IPFS for testing. Use a service like Pinata for production services.
# Upload to local or remote IPFS (smart routes based on .env deploy configuration)SERVICE_FILE=${SERVICE_FILE} make upload-to-ipfs# smart grabs the IPFS gateway and fetches the content that was uploadedexport IPFS_GATEWAY=$(sh script/get-ipfs-gateway.sh)curl "${IPFS_GATEWAY}${ipfs_cid}"# Then the admin of the contracts can set itcast send ${WAVS_SERVICE_MANAGER_ADDRESS} 'setServiceURI(string)' "${SERVICE_URI}" -r ${RPC_URL} --private-key ${DEPLOYER_PK}
For more information on the different parts of a service manifest, see the following sections:
Service manager
The service manager contract defines the set of registered operators for a service. Only operators registered in this contract are considered valid signers for result submissions in a service. Each registered operator is assigned a weight. These weights count toward a threshold for their submission power.
The service manager also maintains a service URI that points to the service manifest, connecting the operators to the service.
Signatures are created by operators using their private keys to sign an envelope containing the data, and these signatures are collected by the aggregator which then submits them to the service manager contract for validation. The service manager contract validates that the signatures are from registered operators, checks that their total weight meets the threshold, and ensures the operators are properly sorted before allowing the data to be processed by the service handler contract.