You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This example uses a single process to simulate the tutorial roles below:
6
+
7
+
* Client (CLI)
8
+
* FSC Node (initiator flow)
9
+
* Endorser (responder flow)
10
+
* Fabric-X (ordering + finality)
11
+
12
+
### Flow diagram
13
+
14
+
```text
15
+
Client (CLI)
16
+
|
17
+
v
18
+
FSC Node (initiator flow)
19
+
|-- ReadAsset(id)
20
+
|-- validate transfer
21
+
|-- prepare transaction
22
+
|-- collect endorsement
23
+
|-- submit transaction
24
+
|-- verify state
25
+
v
26
+
Endorser (responder flow)
27
+
|
28
+
v
29
+
Fabric-X (ordering + finality)
30
+
```
31
+
32
+
## API
33
+
34
+
The example follows the same asset-transfer shape as Fabric chaincode:
35
+
36
+
*`ReadAsset(id string)`
37
+
*`TransferAsset(id, newOwner string)`
38
+
39
+
`ReadAsset` reads the current asset state. `TransferAsset` drives the FSC flow, submits the transaction, and verifies the updated state after finality.
40
+
41
+
These functions mirror the Fabric asset-transfer chaincode, but are implemented using FSC views instead of on-ledger chaincode execution.
42
+
43
+
## Execution
44
+
45
+
Run the example with:
46
+
47
+
```bash
48
+
go run ./cmd/token-transfer --asset-id a1 --new-owner bob
49
+
```
50
+
51
+
## Example output
52
+
53
+
```text
54
+
reading asset
55
+
validating transfer
56
+
preparing transaction (phase: pre-submission)
57
+
endorsing transaction
58
+
submitting transaction (phase: post-submission)
59
+
verifying state
60
+
success: asset a1 now owned by bob
61
+
```
62
+
63
+
Each line corresponds to a stage in the FSC transaction lifecycle.
64
+
65
+
## Notes
66
+
67
+
* The roles are simulated in a single process.
68
+
* In this example, client and endorser roles are simulated within a single process for simplicity, but the flow structure matches how FSC nodes would interact in a real network.
69
+
* The example stays tutorial-style and intentionally small.
70
+
* The code mirrors the chaincode asset-transfer API without extra abstractions.
71
+
72
+
## Future Work
73
+
74
+
This example currently simulates all roles in a single process for simplicity.
75
+
76
+
The next step is to extend this into a real multi-node FSC + Fabric-X setup where:
77
+
78
+
* separate FSC nodes act as clients and endorsers
79
+
* communication happens over networked views
80
+
* ordering and finality are handled by a real Fabric-X deployment
0 commit comments