background
Developing Fabric chaincode is cumbersome for developers: it requires deploying nodes, installing chaincode, restarting the network, and other operations. The current plug-in "Hyperledger Fabric Debugger" in VSCode can help us quickly develop smart contracts.
Steps for usage
-
Install the plug-in
Install the Hyperledger Fabric Debugger plug-in in VSCode
-
Open the directory where you want to develop the chain code and create a .vscode/launch.json file with the following content:
{
"configurations": [
{
"name": "Debug Chaincode",
"type": "hlf-go",
"request": "launch",
"isCaas": false
}
]
}
-
Write a contract
-
Create the test.fabric file with the following content:
[
{
"query": "ReadAsset",
"args": ["asset1"]
},
{
"invoke": "CreateAsset",
"args": ["asset1","blue","71","Tom","220"]
}
]
- Turn on debugging, press the F5 button, and click send request in the test.fabric file to debug the chain code.