Skip to content

Commit 52701d5

Browse files
authored
0.4 docs cleanup (WIP) (#199)
* Update blockchain-interactions.mdx * cleanup * Update commands.mdx * Update README.md * Update component.mdx * Update how-it-works.mdx * Update 1-overview.mdx * Update 2-setup.mdx * Update 3-project.mdx * Update 4-component.mdx * Update 5-build.mdx * Update 6-run-service.mdx * Update 7-prediction.mdx * Update overview.mdx * Update triggers.mdx * Update workflows.mdx
1 parent 19ba4f7 commit 52701d5

18 files changed

+199
-238
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ A template for developing WebAssembly AVS applications using Rust and Solidity,
1919

2020
### Docker
2121

22-
If prompted, remove containerd with `sudo apt remove containerd.io`.
22+
If prompted, remove container with `sudo apt remove containerd.io`.
2323

2424
- **MacOS**: `brew install --cask docker`
2525
- **Linux**: `sudo apt -y install docker.io`
@@ -289,7 +289,7 @@ SERVICE_FILE=.docker/service.json source ./script/ipfs-upload.sh
289289
290290
## Start Aggregator
291291
292-
**TESTNET** You can move the aggregator it to its own machine for testnet deployments, it's easiest to run this on the deployer machine first. If moved, ensure you set the env variables correctly (copy pasted from the previous steps on the other machine).
292+
**TESTNET** You can move the aggregator it to its own machine for testnet deployments, it's easiest to run this on the deployer machine first. If moved, ensure you set the env variables correctly (copied and pasted from the previous steps on the other machine).
293293
294294
```bash
295295
bash ./script/create-aggregator.sh 1

docs/handbook/commands.mdx

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,34 @@ docsignore-->
99

1010
## Commands
1111

12+
Use `make help` to see all the commands:
13+
1214
```bash
1315
make help
1416
```
1517

18+
Here are the available makefile commands and their descriptions:
19+
1620
```bash
17-
build building the project
18-
wasi-build building WAVS wasi components | WASI_BUILD_DIR
19-
wasi-exec executing the WAVS wasi component(s) | COMPONENT_FILENAME, COIN_MARKET_CAP_ID
20-
clean cleaning the project files
21-
clean-docker remove unused docker containers
22-
fmt formatting solidity and rust code
23-
test running tests
24-
setup install initial dependencies
25-
start-all-local starting anvil and core services (like IPFS for example)
26-
get-trigger-from-deploy getting the trigger address from the script deploy
27-
get-submit-from-deploy getting the submit address from the script deploy
28-
wavs-cli running wavs-cli in docker
29-
upload-component uploading the WAVS component | COMPONENT_FILENAME, WAVS_ENDPOINT
30-
deploy-service deploying the WAVS component service json | SERVICE_URL, CREDENTIAL, WAVS_ENDPOINT
31-
get-trigger get the trigger id | SERVICE_TRIGGER_ADDR, RPC_URL
32-
show-result showing the result | SERVICE_SUBMISSION_ADDR, TRIGGER_ID, RPC_URL
33-
upload-to-ipfs uploading the a service config to IPFS | SERVICE_FILE, [PINATA_API_KEY]
34-
operator-list listing the AVS operators | ENV_FILE
35-
operator-register listing the AVS operators | ENV_FILE, AVS_PRIVATE_KEY
36-
update-submodules update the git submodules
37-
check-requirements verify system requirements are installed
21+
make build building the project
22+
make wasi-build building WAVS wasi components | WASI_BUILD_DIR
23+
make wasi-exec executing the WAVS wasi component(s) | COMPONENT_FILENAME, COIN_MARKET_CAP_ID
24+
make clean cleaning the project files
25+
make clean-docker remove unused docker containers
26+
make fmt formatting solidity and rust code
27+
make test running tests
28+
make setup install initial dependencies
29+
make start-all-local starting anvil and core services (like IPFS for example)
30+
make get-trigger-from-deploy getting the trigger address from the script deploy
31+
make get-submit-from-deploy getting the submit address from the script deploy
32+
make wavs-cli running wavs-cli in docker
33+
make upload-component uploading the WAVS component | COMPONENT_FILENAME, WAVS_ENDPOINT
34+
make deploy-service deploying the WAVS component service json | SERVICE_URL, CREDENTIAL, WAVS_ENDPOINT
35+
make get-trigger get the trigger id | SERVICE_TRIGGER_ADDR, RPC_URL
36+
make show-result showing the result | SERVICE_SUBMISSION_ADDR, TRIGGER_ID, RPC_URL
37+
make upload-to-ipfs uploading the a service config to IPFS | SERVICE_FILE, [PINATA_API_KEY]
38+
make update-submodules update the git submodules
39+
make check-requirements verify system requirements are installed
3840
```
41+
42+
For more information on commands when using the template, visit the [WAVS tutorial](/tutorial/1-overview).

docs/handbook/components/blockchain-interactions.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Callout } from 'fumadocs-ui/components/callout';
77
import { DocsPage } from 'fumadocs-ui/page';
88
docsignore-->
99

10-
Components can interact with blockchains and smart contracts by using crates like [`wavs-wasi-utils`](https://docs.rs/wavs-wasi-utils/latest/wavs_wasi_utils/). This page provides an overview of the dependencies and configuration needed to interact with Ethereum and other EVM-compatible chains. For more information on other helpful crates, see the [Utilities and crates](./utilities) page.
10+
Components can interact with blockchains and smart contracts by using crates like [`wavs-wasi-utils`](https://docs.rs/wavs-wasi-utils/latest/wavs_wasi_utils/). This page provides an overview of the dependencies and configuration needed to interact with Ethereum and other EVM-compatible chains.
1111

1212
### `wavs-wasi-utils` crate
1313

@@ -198,7 +198,7 @@ pub fn query_nft_ownership(address: Address, nft_contract: Address) -> Result<bo
198198
}
199199
```
200200

201-
For another approach using the `alloy-contract` crate, visit the example in the [Utilities and crates](./utilities#alloy-contract-crate) page.
201+
You can also use the `alloy-contract` crate to interact with smart contracts. See the [alloy-contract docs](https://crates.io/crates/alloy-contract) page for more information.
202202

203203
See the [wavs-wasi-utils documentation](https://docs.rs/wavs-wasi-utils/latest/wavs_wasi_utils/) and the [Alloy documentation](https://docs.rs/alloy/latest/alloy/) for more detailed information.
204204

@@ -211,6 +211,7 @@ The Alloy ecosystem provides a comprehensive set of crates for Ethereum developm
211211
- [`alloy-provider`](https://docs.rs/alloy-provider/latest/alloy_provider/): Ethereum node interaction (RPC, WebSocket, batching)
212212
- [`alloy-network`](https://docs.rs/alloy-network/latest/alloy_network/): Network types and chain-specific functionality
213213
- [`alloy-sol-types`](https://docs.rs/alloy-sol-types/latest/alloy_sol_types/): ABI handling and type generation
214+
- [`alloy-contract`](https://docs.rs/alloy-contract/latest/alloy_contract/): Contract interaction utilities
214215

215216
### Utility crates
216217

docs/handbook/components/component.mdx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ mod solidity { // Define the Solidity types for the incoming trigger event using
7070

7171
The component decodes the incoming event trigger data using the `decode_event_log_data!` macro from the [`wavs-wasi-utils` crate](https://docs.rs/wavs-wasi-utils/latest/wavs_wasi_utils/macro.decode_event_log_data.html).
7272

73-
The `sol!` macro from `alloy-sol-macro` is usedto define Solidity types in Rust. This macro reads a Solidity interface file and generates corresponding Rust types and encoding/decoding functions. For more information, visit the [Utilities and crates page](./utilities#sol-macro).
73+
The `sol!` macro from `alloy-sol-macro` is usedto define Solidity types in Rust. This macro reads a Solidity interface file and generates corresponding Rust types and encoding/decoding functions. For more information, visit the [Blockchain interactions page](./blockchain-interactions#sol-macro).
7474

7575
### Component logic
7676

@@ -190,3 +190,14 @@ A component is defined in the [workflow](../workflows) object of the [service.js
190190
```
191191

192192
For more information on component configuration variables and keys, visit the [variables](./variables) page.
193+
194+
## Registry
195+
196+
WAVS uses a registry to store the WASM components. A service like [wa.dev](https://wa.dev) is recommended for proper distribution in production. A similar registry environment is emulated locally in docker compose for rapid development without an API key:
197+
198+
- Build your component
199+
- Compile the component
200+
- Upload the component to the registry
201+
- Set the registry in your service using the wavs-cli command in the `build_service.sh` script:
202+
203+
`wavs-cli workflow component --id ${WORKFLOW_ID} set-source-registry --domain ${REGISTRY} --package ${PKG_NAMESPACE}:${PKG_NAME} --version ${PKG_VERSION}`

docs/handbook/components/variables.mdx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ import { Callout } from 'fumadocs-ui/components/callout';
77
import { DocsPage } from 'fumadocs-ui/page';
88
docsignore-->
99

10-
## Environment variables
11-
1210
Components can be configured with two types of variables:
1311

14-
### Public variables
12+
## Public variables
1513

1614
These variables can be used for non-sensitive information that can be viewed publicly. These variables are set in the `config` field of a service manifest. All config values are stored as strings, even for numbers.
1715

@@ -34,7 +32,7 @@ To add public variables:
3432
let value = host::config_var("api_endpoint");
3533
```
3634

37-
### Environment keys
35+
## Environment keys
3836

3937
Environment keys are private and can be used for sensitive data like API keys. These variables are set by operators in their environment and are not viewable by anyone. These variables must be prefixed with `WAVS_ENV_`. Each operator must set these variables in their environment before deploying the service. WAVS validates that all environment variables are set before allowing the service to run.
4038

@@ -56,7 +54,13 @@ Variables can also be set in your `~/.bashrc`, `~/.zshrc`, or `~/.profile` files
5654
WAVS_ENV_MY_API_KEY=your_secret_key_here
5755
```
5856

59-
3. Add the environment key to the `env_keys` array in the service manifest:
57+
3. Access the environment key from a component:
58+
59+
```rust
60+
let api_key = std::env::var("WAVS_ENV_MY_API_KEY")?;
61+
```
62+
63+
4. Before deploying a service, add the environment key to the `env_keys` array in the service manifest:
6064

6165
```json
6266
"component": {
@@ -66,12 +70,6 @@ WAVS_ENV_MY_API_KEY=your_secret_key_here
6670
}
6771
```
6872

69-
4. Access the environment key from a component:
70-
71-
```rust
72-
let api_key = std::env::var("WAVS_ENV_MY_API_KEY")?;
73-
```
74-
7573
## Local Execution
7674

7775
When running components locally (raw), use the `--config` flag to set values in a KEY=VALUE format, comma-separated: `--config a=1,b=2`.

docs/handbook/overview.mdx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,14 @@ This handbook provides an overview of the different parts that make up a WAVS AV
3333
- [Submission and Aggregator](./submission) - Discover how results are submitted to the blockchain through the aggregator service and submission contracts.
3434

3535
## Components
36-
- [Component Overview](./components/component) - Learn about the structure and lifecycle of WAVS components, including how to handle triggers and process data.
36+
- [Component overview](./components/component) - Learn about the structure and lifecycle of WAVS components, including how to handle triggers and process data.
3737
- [Variables](./components/variables) - Understand how to configure components with public and private variables.
38-
- [Utilities and Crates](./components/utilities) - Explore the available utilities and crates for building WAVS components.
39-
- [Blockchain Interactions](./components/blockchain-interactions) - Discover how to interact with blockchains and smart contracts from your components.
40-
- [Network Requests](./components/network-requests) - Learn how to make HTTP requests to external APIs from your components.
38+
- [Blockchain interactions](./components/blockchain-interactions) - Discover how to interact with blockchains and smart contracts from your components.
39+
- [Network requests](./components/network-requests) - Learn how to make HTTP requests to external APIs from your components.
4140

4241

4342
## Development
4443
- [Template](./template) - Get started with the WAVS template, including its structure, configuration files, and how to customize it for your service.
45-
- [Makefile Commands](./commands) - Reference for the available makefile commands to build, deploy, and manage your service.
44+
- [Makefile commands](./commands) - Reference for the available makefile commands to build, deploy, and manage your service.
4645

4746
Each section provides detailed information and examples to help you understand and build your WAVS service. Start with the Service section to understand the basic concepts, then explore the other sections based on your needs.

docs/handbook/service.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ docsignore-->
99

1010
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.
1111

12-
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.
12+
The service manifest defines the configuration and different parts of a WAVS service, including information about the service, [workflows](/handbook/workflows), [components](/handbook/components/component), [submission](/handbook/submission), [service manager contract](#service-manager), and more.
1313

1414
## Generate Manifest
1515

16-
Easily create this JSON file using the `wavs-cli service` command. The template provides a script to generate a 1 component service with ease, [build_service.sh](https://github.com/Lay3rLabs/wavs-foundry-template/blob/main/script/build_service.sh).
16+
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](https://github.com/Lay3rLabs/wavs-foundry-template/blob/main/script/build_service.sh).
1717

1818
## Example Manifest
1919

docs/handbook/submission.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ contract SimpleSubmit is ITypes, IWavsServiceHandler {
8989

9090
## Aggregator
9191

92-
{/* todo: link to design page. */}
93-
The aggregator is used to collect and validate responses from multiple operators before submitting them to the blockchain. It acts as an intermediary that receives signed responses from operators, validates each operator's signature, aggregates signatures when enough operators have responded, and submits the aggregated data to the submission contract. The aggregator supports exact match aggregation, meaning that consensus is reached if a threshold amount of submitted responses from operators are identical.
92+
The aggregator is used to collect and validate responses from multiple operators before submitting them to the blockchain. It acts as an intermediary that receives signed responses from operators, validates each operator's signature, aggregates signatures when enough operators have responded, and submits the aggregated data to the submission contract. The aggregator supports exact match aggregation, meaning that consensus is reached if a threshold amount of submitted responses from operators are identical. Visit the [design considerations page](/design) for more information on aggregation and service design.
9493

9594
WAVS currently uses ECDSA signatures for aggregation, but will also support BLS signatures in the future.
9695

docs/handbook/triggers.mdx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ A trigger prompts a WAVS service to run. Operators listen for the trigger event
1414

1515
### Trigger lifecycle
1616

17-
1. A service is deployed with a service.json manifest which contains information on the service and workflow logic (components, triggers, submission logic).
17+
1. A service is deployed with a service.json manifest which contains information on the service and [workflow](/handbook/workflows) logic (components, triggers, [submission](/handbook/submission) logic).
1818

1919
2. Operators maintain lookup maps to track and verify triggers. For EVM and Cosmos events, they map chain names, contract addresses, and event identifiers to trigger IDs. Block interval triggers are tracked by chain name with countdown timers, while cron triggers are managed in a priority queue ordered by execution time.
2020

@@ -62,7 +62,7 @@ pub enum TriggerData {
6262

6363
## Trigger configuration
6464

65-
Triggers define when and how the component should be executed. Each workflow needs a trigger to be set. They are set in the `trigger` field of the `service.json` file.
65+
Triggers define when and how the component should be executed. Each workflow needs a trigger to be set. They are set in the `trigger` field of the [`service.json` file](/handbook/service).
6666

6767
### EVM event trigger
6868

@@ -73,7 +73,7 @@ This trigger listens for specific events emitted by contracts on EVM-compatible
7373
"trigger": {
7474
"evm_contract_event": {
7575
"address": "0x00000000219ab540356cbb839cbe05303d7705fa", // Contract address to monitor
76-
"chain_name": "ethereum-mainnet", // Chain to monitor
76+
"chain_name": "ethereum", // Chain to monitor
7777
"event_hash": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" // Event hash (32 bytes)
7878
}
7979
}
@@ -83,18 +83,17 @@ This trigger listens for specific events emitted by contracts on EVM-compatible
8383
Your evm chain information must be set in `wavs.toml` under the `[default.chains.evm.<chain_name>]` section:
8484

8585
```toml wavs.toml
86-
# Local / Testnet
87-
[default.chains.evm.local]
88-
chain_id = "31337"
89-
ws_endpoint = "ws://localhost:8545"
90-
http_endpoint = "http://localhost:8545"
91-
poll_interval_ms = 7000
86+
# Mainnet
87+
[default.chains.evm.ethereum]
88+
chain_id = "1"
89+
ws_endpoint = "wss://eth.drpc.org"
90+
http_endpoint = "https://eth.drpc.org"
9291
```
9392

9493
You'll need to set your EVM chain credential in your `.env` file to establish a connection for monitoring the EVM chain:
9594

9695
```env .env
97-
WAVS_CLI_EVM_CREDENTIAL="0x5ce146f435835b1762ed602088740d201b68fd94bf808f97fd04588f1a63c9ab"
96+
WAVS_CLI_EVM_CREDENTIAL="0x5ze146f435835b1762ed602088740d201b68fd94bf808f97fd04588f1a63c9ab"
9897
```
9998

10099
### Cosmos event trigger

docs/handbook/workflows.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ A WAVS service is a collection of one or more workflows that define the differen
1212
Each workflow consists of three parts:
1313

1414
- [**Trigger**](./triggers): Defines what event initiates the workflow
15-
- [**Component**](./component): The WASM component that processes the event
15+
- [**Component**](./components/component): The WASM component that processes the event
1616
- [**Submit**](./submission): Specifies where to send the results
1717

1818
## Workflow Structure

0 commit comments

Comments
 (0)