Skip to content

Commit 1b2a231

Browse files
fix: Made necessary changes in README.md
Signed-off-by: Abhinav Prakash <abhinav.prakash319@gmail.com>
1 parent 93d90b4 commit 1b2a231

File tree

1 file changed

+49
-3
lines changed
  • samples/chaincode/confidential-escrow

1 file changed

+49
-3
lines changed

samples/chaincode/confidential-escrow/README.md

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ cd samples/chaincode/confidential-escrow
108108
# Setup Bob using Option 4.
109109
```
110110

111-
#### 4. In 3rd terminal window - Docker Environment (`Monitor`)
111+
#### 4. In 4th terminal window - Docker Environment (`Monitor`)
112112

113113
```bash
114114
# Enter docker container
@@ -118,7 +118,7 @@ cd samples/chaincode/confidential-escrow
118118
# Interactive menu
119119
./multi_user_dashboard.sh
120120

121-
# Setup Bob using Option 5.
121+
# Setup Monitor using Option 5.
122122
```
123123

124124
#### 5. Run Tests
@@ -127,7 +127,53 @@ cd samples/chaincode/confidential-escrow
127127
# Run all basic tests
128128
./multi_user_dashboard.sh
129129

130-
# Chosing Option 7.
130+
# Chosing Option 7. (One can run it from any terminal)
131+
```
132+
133+
## Escrow Workflow
134+
135+
### Step 1: Create Wallets
136+
137+
Before any escrow operations, both parties must have wallets:
138+
139+
1. **Alice** creates her wallet via Terminal 2 (Option 3 - currently created automatically)
140+
2. **Bob** creates his wallet via Terminal 3 (Option 4 - currently created automatically)
141+
3. **Monitor** (Terminal 4, Option 5) can observe all wallet creations and transactions in real-time
142+
143+
### Step 2: Create Escrow
144+
145+
Once both wallets exist, either party can create an escrow using `createAndLockEscrow`. The buyer locks funds by specifying:
146+
147+
- Buyer/seller public keys
148+
- Amount and asset type
149+
- `parcelId` and `secret` (used for condition verification)
150+
151+
### Step 3: Complete Escrow
152+
153+
Two possible outcomes:
154+
155+
| Operation | Who Calls | When | Result |
156+
| ----------- | --------- | ------------------------------------------- | ------------------------ |
157+
| **Release** | Seller | Condition fulfilled (e.g., goods delivered) | Funds transfer to seller |
158+
| **Refund** | Buyer | Condition not met or cancelled | Funds return to buyer |
159+
160+
### Release vs Refund
161+
162+
- **Release** (`releaseEscrow`): Seller provides correct `secret + parcelId` to prove fulfillment. Funds move from buyer's escrow balance to seller's available balance. Status → `Released`.
163+
164+
- **Refund** (`refundEscrow`): Buyer cancels an active escrow. No secret needed. Funds return to buyer's available balance. Status → `Refunded`.
165+
166+
Both operations only work on `Active` escrows.
167+
168+
## Troubleshooting
169+
170+
**Network already running?**
171+
If your Fabric test-network is already up, comment out the `network.sh down` and `network.sh up` lines in `test.sh` to avoid restarting it:
172+
173+
```bash
174+
# In test.sh, comment these lines:
175+
# run_cmd "./network.sh down" "Bringing down network"
176+
# run_cmd "./network.sh up createChannel -ca" "Starting network"
131177
```
132178

133179
## Contributing

0 commit comments

Comments
 (0)