|
| 1 | +# 🔍 Hyperledger Fabric Debugger - Usage Guide |
| 2 | + |
| 3 | +Welcome to the usage guide for the **Hyperledger Fabric Debugger** VSCode extension. This tool is designed to help developers debug chaincode, interact with local Fabric networks, and manage wallets directly from VSCode. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## Table of Contents |
| 8 | +- [Installation](#installation) |
| 9 | +- [Launching the Extension](#launching-the-extension) |
| 10 | +- [Using the Extension Features](#using-the-extension-features) |
| 11 | +- [Running the Debugger](#running-the-debugger) |
| 12 | +- [Example Flow](#example-flow) |
| 13 | +- [Troubleshooting](#troubleshooting) |
| 14 | +- [Questions or Feedback?](#questions-or-feedback) |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +## ⚙️ Installation |
| 19 | + |
| 20 | +Before using the debugger, ensure the extension is installed using the `vsce` tool. |
| 21 | + |
| 22 | +```bash |
| 23 | +npx vsce package |
| 24 | +code --install-extension Hyperledger-Fabric-Debugger.vsix |
| 25 | +``` |
| 26 | + |
| 27 | +## 🚀 Launching the Extension |
| 28 | +Open VSCode and navigate to the Run & Debug tab on the sidebar. |
| 29 | + |
| 30 | +Click the "Run Extension" button. |
| 31 | + |
| 32 | + |
| 33 | +This will open the Extension Development Host, where the debugger's custom UI will appear. |
| 34 | + |
| 35 | + |
| 36 | +## 🧩 Using the Extension Features |
| 37 | +Once the extension UI is open, you’ll see the main dashboard with the following actions: |
| 38 | + |
| 39 | +- **Upload Network Configuration** (e.g., connection profile) |
| 40 | + |
| 41 | + |
| 42 | +- **Upload Wallet** |
| 43 | + |
| 44 | + |
| 45 | +- **Start Local Network** (e.g., using fabric-samples) |
| 46 | + |
| 47 | +- **Query Blocks** |
| 48 | + |
| 49 | + |
| 50 | +## 🐛 Running the Debugger |
| 51 | +To start debugging your chaincode: |
| 52 | + |
| 53 | +1. Click **Run & Debug**. |
| 54 | + |
| 55 | +2. Select the configuration: **Debug Hyperledger Fabric**. |
| 56 | + |
| 57 | + |
| 58 | +3. A file prompt will appear — select your `chaincode.go` file. |
| 59 | + |
| 60 | + |
| 61 | +4. The debugger will attach using **Delve**. |
| 62 | + |
| 63 | +5. Set breakpoints in your code. |
| 64 | + |
| 65 | + |
| 66 | +You’ll see the standard VSCode debug interface: |
| 67 | + |
| 68 | +Variables |
| 69 | + |
| 70 | + |
| 71 | +Watch expressions |
| 72 | +Call stack |
| 73 | +Breakpoints panel |
| 74 | + |
| 75 | + |
| 76 | +**Debug Console output from Delve** |
| 77 | + |
| 78 | + |
| 79 | +6. Use a Fabric client to invoke chaincode. |
| 80 | + |
| 81 | +## ✅ Example Flow |
| 82 | +- Upload network config & wallet. |
| 83 | +- Upload your `chaincode.go` file. |
| 84 | +- Add breakpoints. |
| 85 | +- Use a Fabric client to invoke transactions. |
| 86 | +- Observe how the debugger halts at breakpoints, shows local variables, and logs chaincode behavior in real time. |
| 87 | + |
| 88 | +## 🧼 Troubleshooting |
| 89 | +If you encounter errors like Delve DAP server not found: |
| 90 | + |
| 91 | +- Ensure `dlv` is installed on your machine: |
| 92 | +```bash |
| 93 | + go install github.com/go-delve/delve/cmd/dlv@latest |
| 94 | + |
| 95 | + ``` |
| 96 | + |
| 97 | +Restart the extension host and re-select the debug config. |
| 98 | + |
| 99 | +## 🙋 Questions or Feedback? |
| 100 | + |
| 101 | +Found a bug? Have a suggestion? |
| 102 | +Please open an issue or pull request on our [GitHub repository](https://github.com/your-org/your-repo). |
0 commit comments