Skip to content

Commit e6fc4b3

Browse files
tfiusclaude
andcommitted
docs: Add buy, respond, and status commands to README
- Document `ade buy` complete buyer flow command - Document `ade respond` bounty response command - Document `ade escrows status` command with example output - Add `--dry-run` flag documentation for create command - Update seller flow to reference new buy command - Add ESCROW_<id>_CONTENT_HASH to keychain docs Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 27a7b9d commit e6fc4b3

1 file changed

Lines changed: 94 additions & 1 deletion

File tree

README.md

Lines changed: 94 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ The `ade create` command handles the complete seller workflow in a single step:
151151
```bash
152152
# One command to encrypt, upload, and create escrow
153153
ade create --file ./data.csv --price 0.1 --yes
154+
155+
# Dry run to validate without spending gas
156+
ade create --file ./data.csv --price 0.1 --dry-run
154157
```
155158

156159
This automatically:
@@ -159,6 +162,12 @@ This automatically:
159162
3. Creates escrow on-chain with key commitment
160163
4. Stores encryption keys in OS keychain
161164

165+
**Options:**
166+
- `--file <path>` - File to encrypt and escrow (required)
167+
- `--price <eth>` - Price in ETH (required)
168+
- `--dry-run` - Validate everything without executing transactions
169+
- `--yes` - Skip confirmation prompts
170+
162171
**Required secrets for `ade create`:**
163172
```bash
164173
ade set SX_KEY # Your private key for transactions
@@ -178,6 +187,55 @@ ade set BEE_STAMP # Postage batch ID (64 hex chars)
178187
}
179188
```
180189

190+
### Complete Buyer Flow
191+
192+
The `ade buy` command handles the complete purchase workflow:
193+
194+
```bash
195+
# Fund escrow, wait for key, download, and decrypt
196+
ade buy 42 --yes
197+
198+
# Specify output file
199+
ade buy 42 --output ./purchased-data.csv --yes
200+
201+
# Custom timeout for key reveal (default: 24 hours)
202+
ade buy 42 --wait-timeout 3600 --yes
203+
```
204+
205+
This automatically:
206+
1. Reads escrow details from chain (price, content hash)
207+
2. Verifies sufficient balance (including gas)
208+
3. Funds the escrow
209+
4. Waits for seller to reveal key
210+
5. Downloads encrypted data from Swarm
211+
6. Verifies content hash matches on-chain
212+
7. Decrypts and saves to file
213+
214+
**Required secrets for `ade buy`:**
215+
```bash
216+
ade set SX_KEY # Your private key for transactions
217+
ade set BEE_API # Bee node URL for downloading
218+
```
219+
220+
### Bounty Response Flow
221+
222+
The `ade respond` command creates an escrow in response to a bounty:
223+
224+
```bash
225+
# Respond to a bounty with a deliverable file
226+
ade respond abc123 --file ./solution.zip --yes
227+
228+
# Include a message for the bounty creator
229+
ade respond abc123 --file ./analysis.csv --message "Here's the data analysis" --yes
230+
```
231+
232+
This automatically:
233+
1. Fetches bounty details (reward amount, requirements)
234+
2. Creates escrow using the bounty reward as price
235+
3. Links the escrow to the bounty via API
236+
237+
**Required secrets:** Same as `ade create`
238+
181239
### Complete Seller Flow
182240

183241
```bash
@@ -191,7 +249,7 @@ ade create --file ./data.pdf --price 0.1 --yes
191249
# Outputs: escrowId, swarmRef, encryptionKey, etc.
192250

193251
# 3. Share escrow ID with buyer
194-
# Buyer funds via: ade escrows fund 42 --yes
252+
# Buyer purchases via: ade buy 42 --yes
195253

196254
# 4. Release key (after buyer funds)
197255
ade escrows commit-key 42 --yes
@@ -202,6 +260,37 @@ ade escrows reveal-key 42 --yes
202260
ade escrows claim 42 --yes
203261
```
204262

263+
### Escrow Status
264+
265+
Check escrow state and local key availability:
266+
267+
```bash
268+
ade escrows status 42
269+
```
270+
271+
**Example output:**
272+
```json
273+
{
274+
"escrowId": 42,
275+
"state": "Funded",
276+
"stateCode": 1,
277+
"hasLocalKeys": true,
278+
"hasSwarmRef": true,
279+
"onChain": {
280+
"seller": "0x...",
281+
"buyer": "0x...",
282+
"contentHash": "0x...",
283+
"amount": "0.1 ETH",
284+
"expiresAt": "2024-01-15T00:00:00.000Z"
285+
},
286+
"local": {
287+
"encryptionKey": "(set)",
288+
"salt": "(set)",
289+
"swarmRef": "abc123..."
290+
}
291+
}
292+
```
293+
205294
### Manual Escrow Commands
206295

207296
For more control, you can use individual escrow commands:
@@ -213,6 +302,9 @@ ade escrows create --content-hash 0x... --price 0.1
213302
# Fund an escrow (as buyer)
214303
ade escrows fund <id>
215304

305+
# Check escrow status
306+
ade escrows status <id>
307+
216308
# Commit key release (as seller, reads keys from keychain)
217309
ade escrows commit-key <id>
218310

@@ -227,6 +319,7 @@ When you create an escrow, keys are automatically stored in keychain:
227319
- `ESCROW_<id>_KEY` - The encryption key
228320
- `ESCROW_<id>_SALT` - The salt for commitment
229321
- `ESCROW_<id>_SWARM` - Swarm reference (for `ade create`)
322+
- `ESCROW_<id>_CONTENT_HASH` - Content hash for verification
230323

231324
### Supported Chains
232325

0 commit comments

Comments
 (0)