Skip to content

Commit bd5bb31

Browse files
authored
[doc] update readme&developer_guide&operator_guide doc (#543)
1 parent bfa3f63 commit bd5bb31

File tree

3 files changed

+97
-118
lines changed

3 files changed

+97
-118
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,10 @@ The diagram represents the main components of the software and how they interact
2727

2828
## Running
2929

30-
For users who just want to give it a try, please refer to [Quick Start →](./docs/QUICK_START.md), which will guide you through how to interact with existing projects deployed on staging.
30+
For users who just want to give it a try, please refer to [Quick Start →](./docs/QUICK_START.md), which will guide you through how to interact with existing projects deployed on testnet.
3131

3232
Developers looking to build circuits and deploy W3bstream projects should consult the [DEVELOPER_GUIDE →](./docs/DEVELOPER_GUIDE.md)
3333

34-
Developers who want to run a Sprout node could refer to the [OPERATOR_GUIDE →](./docs/OPERATOR_GUIDE.md)
35-
3634
## Sandbox
3735
The DePIN Sandbox is an initial deployment of Layer 1 contracts that facilitate the deployment od DePIN Projects on IoTeX using W3bstream
3836

docs/DEVELOPER_GUIDE.md

Lines changed: 49 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,19 @@ Dapps looking to utilize W3bstream capabilities should:
88

99
1. [Create a W3bstream project](#create-a-w3bstream-project)
1010
2. [Test the project](#test-your-w3bstream-project)
11-
3. [Register it on the IoTeX blockchain](#register-your-project)
11+
3. [Register it on the IoTeX blockchain](#registering-your-project)
12+
13+
### Prerequisites
14+
15+
- ioctl: The command-line interface for interacting with the IoTeX blockchain.
16+
17+
```bash
18+
git clone https://github.com/iotexproject/iotex-core.git
19+
cd iotex-core
20+
make ioctl && mv bin/ioctl __YOUR_SYSTEM_PATH__
21+
```
22+
23+
[More on the IoTeX ioctl client →](https://docs.iotex.io/the-iotex-stack/wallets/command-line-client)
1224

1325
### Create a W3bstream Project
1426

@@ -51,7 +63,7 @@ Create the blockchain verifier (Solidity)
5163

5264
target/release/halo2-circuit solidity -f path/filename.sol
5365

54-
#### Create a ZK Circuit Using zkWASM
66+
#### Create a W3bstream Project Using zkWASM
5567

5668
For more details on zkWASM circuits see the [zkWASM README](./examples/zkwasm-circuit/README.md).
5769

@@ -81,7 +93,7 @@ Generate the W3bstream project:
8193
ioctl ws code convert -t "zkwasm" -i "zkwasm_demo.wasm" -o "path/ID"`
8294
```
8395

84-
#### Using RISC0
96+
#### Create a W3bstream Project Using RISC0
8597

8698
More details and options for `Risc0 circuit` are given in [its README](./examples/risc0-circuit/README.md).
8799

@@ -120,66 +132,62 @@ ioctl ws project config -s "postgres://test_user:test_passwd@localhost:5432/test
120132
121133
The values of `image_id` and `elf` are variable names, and will be found in the `methods.rs` file.
122134
123-
#### Manager your project to IPFS
135+
### Test Your W3bstream Project
136+
137+
Once you have generated a W3bstream project file that includes a custom prover for your dApp, you might want to test it.
138+
139+
Please refer to the [OPERATOR GUIDE](./OPERATOR_GUIDE.md) for instructions on how to:
140+
141+
1. Run a W3bstream node locally.
142+
2. Copy the W3bstream project file into the node's project directory (default location is ./test/project).
143+
3. Run the node and send your test messages.
144+
145+
### Registering Your Project
146+
147+
To allow W3bstream node operators to download your project and compute ZK proofs for your dApp, you must register your W3bstream project on the IoTeX blockchain:
124148
125-
##### Set w3bstream sequencer endpoint and contract addresses
149+
#### Acquire a Project ID
126150
127151
```bash
128-
# set local w3bstream sequencer as w3bstream endpoint
129-
ioctl config set wsEndpoint 'localhost:9000'
130-
# set the default project register and project store contract address
131-
ioctl config set wsProjectStoreContract 0x6AfCB0EB71B7246A68Bb9c0bFbe5cD7c11c4839f
132-
ioctl config set wsProjectRegisterContract 0x4888bfbf39Dc83C19cbBcb307ccE8F7F93b72E38
152+
ioctl ioid register "your project name"
133153
```
134154
135-
##### Register and Upload project
155+
#### Register Project
136156
137157
```bash
138-
# register a new project to w3bstream
139-
# note: this need you had mint a project NFT in ioID, see more: https://github.com/machinefi/ioID-contracts
140158
ioctl ws project register --id "your project id"
141-
# use the project config generated above and update project config
142-
ioctl ws project update --id "your project id" --path "path/to/project_config" --hash "project config hash(optional)"
143-
# you can retrieve project info by follow command
144-
ioctl ws project query --id "your project id"
145159
```
146160
147-
##### Set or get attributes of your project
161+
#### Use the Project File Generated above and Update Project Config
148162
149163
```bash
150-
# get attributes
151-
ioctl ws project attributes get --id "your project id" --key "your key name"
152-
# set attributes
153-
ioctl ws project attributes set --id "your project id" --key "your key name" --val "your key val"
164+
ioctl ws project update --id "your project id" --path "path/to/project_file"
154165
```
155166
156-
##### Control project status
167+
#### Start the Project
157168
158169
```bash
159-
# pause project
160-
ioctl ws project pause --id 'your project id'
161-
# resume project
162-
ioctl ws project resume --id 'your project id'
170+
ioctl ws project resume --id "your project id"
163171
```
164172
165-
### Testing your project
166-
167-
Once you have generated a W3bstream project file that includes a custom prover for your dApp, you might want to test it.
173+
#### Retrieve Project Info
168174
169-
Please refer to the [OPERATOR GUIDE](./OPERATOR_GUIDE.md) for instructions on how to:
175+
```bash
176+
ioctl ws project query --id "your project id"
177+
```
170178
171-
1. Run a W3bstream node locally.
172-
2. Copy the W3bstream project file into the node's project directory (default location is ./test/project).
173-
3. Run the node and send your test messages.
179+
#### Set Required Prover Amount of the Project
174180
175-
### Registering your project
181+
The default prover amount will process the project's tasks is one. And we can customize it by
176182
177-
To allow W3bstream node operators to download your project and compute ZK proofs for your dApp, you must register your W3bstream project on the IoTeX blockchain:
183+
```bash
184+
ioctl ws project attributes set --id "your project id" --key "RequiredProverAmount" --val "your expected amount"
185+
```
178186
179-
[Register your project here → This is still WIP](WIP)
187+
#### Stop the Project
180188
181-
The projects registration contract address on IoTeX is:
189+
If you want to stop the project's task process, can use this cmd
182190
183-
- Mainnet: `To be determined`
184-
- Testnet: `To be determined`
185-
- ABI: `To be determined`
191+
```bash
192+
ioctl ws project pause --id "your project id"
193+
```

docs/OPERATOR_GUIDE.md

Lines changed: 47 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# IoTeX W3bstream Sprout Node Operator Guide
22

3-
W3bstream is a permissionless, decentralized protocol within the IoTeX Network, where node operators contribute computing power to support verifiable computations for blockchain applications. These applications rely on insights from real-world data to trigger their token economies. Anyone can become a W3bstream Node Operator in the IoTeX Network, choosing which dApps to support in processing data and generating ZK (Zero Knowledge) Proofs. This guide covers how to operate a W3bstream node, register it in the IoTeX Network, join specific projects, and claim rewards.
3+
W3bstream is a permissionless, decentralized protocol within the IoTeX Network, where node operators contribute computing power to support verifiable computations for blockchain applications. These applications rely on insights from real-world data to trigger their token economies. Anyone can become a W3bstream Node Operator in the IoTeX Network, choosing which dApps to support in processing data and generating ZK (Zero Knowledge) Proofs.
44

55
## Run a W3bstream Node
66

@@ -62,6 +62,11 @@ export BONSAI_KEY=${your bonsai key}
6262

6363
Refer to the W3bstream project documentation for the dApp you are joining to determine if Risc Zero proofs are required.
6464

65+
### Manage the project file
66+
67+
You can move your project file to a directory, and mount it to W3bstream node container. The environment variable used to indicate a directory is **PROJECT_FILE_DIRECTORY**
68+
The default project directory is **./test/project**
69+
6570
### Manage the node
6671

6772
To start W3bstream, run the following command in the directory containing `docker-compose.yaml`:
@@ -82,72 +87,24 @@ To shut down the W3bstream instance:
8287
docker-compose down
8388
```
8489

85-
#### Set contract addresses
86-
87-
```bash
88-
# set the default prover register and prover store contract address
89-
ioctl config set wsFleetManagementContract 0xDBA78C8eCaeE2DB9DDE0c4168f7E8626d4Ff0010
90-
ioctl config set wsProverStoreContract 0xAD480a9c1B9fA8dD118c26Ac26880727160D0448
91-
```
92-
93-
### Prover Manager
94-
95-
#### Register and query prover
96-
97-
```bash
98-
# register a new prover and this command will retrieve the prover id
99-
ioctl ws prover register
100-
# query prover info with prover id
101-
ioctl ws prover query --id "prover id"
102-
# update prover with node type and prover id
103-
ioctl ws prover update --id "prover id" --node-type "node type"
104-
```
105-
106-
#### Control prover status
107-
108-
```bash
109-
# pause or resume prover with the follow commands
110-
ioctl ws prover pause --id 'prover id'
111-
ioctl ws prover resume --id 'prover id'
112-
```
113-
114-
#### Transfer prover operator
115-
116-
```bash
117-
# transfer prover operator with prover id and new owner address
118-
ioctl ws prover transfer --id 'prover id' --operator 'operator wallet address'
119-
```
120-
121-
### Interacting with the node
122-
123-
set the ioctl's wsEndpoint configuration option to your node endpoint:
124-
125-
```bash
126-
ioctl config set wsEndpoint localhost:9000
127-
```
128-
129-
[More on the IoTeX ioctl client →](https://docs.iotex.io/the-iotex-stack/wallets/command-line-client)
130-
131-
Test W3bstream projects are already registered into project contract.
132-
13390
#### Sending messages to the node
13491

135-
Send a message to a RISC0-based test project (ID 1):
92+
Send a message to a RISC0-based test project (ID 10000):
13693

13794
```bash
138-
ioctl ws message send --project-id 1 --project-version "0.1" --data "{\"private_input\":\"14\", \"public_input\":\"3,34\", \"receipt_type\":\"Snark\"}"
95+
curl -X POST -H "Content-Type: application/json" -d '{"projectID": 10000,"projectVersion": "0.1","data": "{\"private_input\":\"14\", \"public_input\":\"3,34\", \"receipt_type\":\"Snark\"}"}' http://localhost:9000/message
13996
```
14097

141-
Send a message to the Halo2-based test project (ID 2):
98+
Send a message to the Halo2-based test project (ID 10001):
14299

143100
```bash
144-
ioctl ws message send --project-id 2 --project-version "0.1" --data "{\"private_a\": 3, \"private_b\": 4}"
101+
curl -X POST -H "Content-Type: application/json" -d '{"projectID": 10001,"projectVersion": "0.1","data": "{\"private_a\": 3, \"private_b\": 4}"}' http://localhost:9000/message
145102
```
146103

147-
Send a message to a zkWasm-based test project (ID 3):
104+
Send a message to a zkWasm-based test project (ID 10002):
148105

149106
```bash
150-
ioctl ws message send --project-id 3 --project-version "0.1" --data "{\"private_input\": [1, 1] , \"public_input\": [] }"
107+
curl -X POST -H "Content-Type: application/json" -d '{"projectID": 10002,"projectVersion": "0.1","data": "{\"private_input\": [1, 1] , \"public_input\": [] }"}' http://localhost:9000/message
151108
```
152109

153110
#### Query the status of a proof request
@@ -156,37 +113,53 @@ After sending a message, you'll receive a message ID as a response from the node
156113

157114
```json
158115
{
159-
"messageID": "4abbc43a-798f-49e8-bc05-b6baeafec630"
116+
"messageID": "8785a42c-9d6c-4780-910c-de0147aea243"
160117
}
161118
```
162119

163120
you can quesry the history of the proof request with:
164121

165122
```bash
166-
ioctl ws message query --message-id "4abbc43a-798f-49e8-bc05-b6baeafec630"
123+
curl http://localhost:9000/message/8785a42c-9d6c-4780-910c-de0147aea243 | jq -r '.'
167124
```
168125

169126
example result:
170127

171128
```json
172129
{
173-
"messageID": "4abbc43a-798f-49e8-bc05-b6baeafec630",
174-
"states": [{
175-
"state": "received",
176-
"time": "2023-12-06T16:11:03.498785+08:00",
177-
"comment": ""
178-
},
179-
{
180-
"state": "fetched",
181-
"time": "2023-12-06T16:11:04.663608+08:00",
182-
"comment": ""
183-
},
184-
{
185-
"state": "proving",
186-
"time": "2023-12-06T16:11:04.664008+08:00",
187-
"comment": ""
188-
}
189-
]
130+
"messageID": "8785a42c-9d6c-4780-910c-de0147aea243",
131+
"states": [
132+
{
133+
"state": "received",
134+
"time": "2024-06-10T09:30:05.790151Z",
135+
"comment": "",
136+
"result": ""
137+
},
138+
{
139+
"state": "packed",
140+
"time": "2024-06-10T09:30:05.793218Z",
141+
"comment": "",
142+
"result": ""
143+
},
144+
{
145+
"state": "dispatched",
146+
"time": "2024-06-10T09:30:10.87987Z",
147+
"comment": "",
148+
"result": ""
149+
},
150+
{
151+
"state": "proved",
152+
"time": "2024-06-10T09:30:11.193027Z",
153+
"comment": "",
154+
"result": "proof result"
155+
},
156+
{
157+
"state": "outputted",
158+
"time": "2024-06-10T09:30:11.20942Z",
159+
"comment": "output type: stdout",
160+
"result": ""
161+
}
162+
]
190163
}
191164
```
192165

0 commit comments

Comments
 (0)