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
Copy file name to clipboardExpand all lines: README.md
+36-3Lines changed: 36 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -264,6 +264,8 @@ This feature allows hot reload of chaincode code and speeds up the development a
264
264
Fablo will run peers in dev mode when `global.peerDevMode` is set to `true`.
265
265
Note: in this case TLS has to be disabled, otherwise config validation fails.
266
266
267
+
#### For Node.js Chaincode:
268
+
267
269
The simplest way of trying Fablo with dev mode is as follows:
268
270
269
271
1. Execute `fablo init node dev`.
@@ -278,7 +280,7 @@ The simplest way of trying Fablo with dev mode is as follows:
278
280
```
279
281
Now, when you update the chaincode source code, it will be automatically refreshed on Hyperledger Fabric Network.
280
282
281
-
Our sample chaincode definition contains some scripts forrunning chaincodeindev mode:
283
+
The relevant scripts in`package.json` look like:
282
284
283
285
```json
284
286
"scripts": {
@@ -288,13 +290,44 @@ Our sample chaincode definition contains some scripts for running chaincode in d
288
290
...
289
291
},
290
292
```
291
-
292
-
Worth considering:
293
+
**Worth considering for Node.js chaincode:**
293
294
* If you want chaincode to be running on multiple peers, you need to start it multiple times, specifying different `--peer.address`
294
295
* In case of errors ensure you have the same `--chaincode-id-name` as `CC_PACKAGE_ID`in Fablo output.
295
296
296
297
Feel free to update this scripts to adjust it to your chaincode definition.
297
298
299
+
300
+
#### For Java Chaincode:
301
+
302
+
To run Java chaincode in dev mode:
303
+
304
+
1. Make sure your Fablo config has `global.peerDevMode` set to `true` and TLS disabled.
305
+
306
+
2. Start the network with `fablo up`.
307
+
308
+
3. Build and run the Java chaincode locally. As a sample you may use the chaincode from the Fablo source code from the `samples/chaincodes/java-chaincode` directory. Ensure a proper relative path is provided in Fablo config.
309
+
```bash
310
+
cd samples/chaincodes/java-chaincode
311
+
./run-dev.sh
312
+
```
313
+
314
+
The `run-dev.sh` script will:
315
+
- Build the chaincode using Gradle's shadowJar task
316
+
- Automatically detect the peer's IP address from the Docker container
317
+
- Start the chaincode with debug logging enabled
318
+
- Connect to the peer at port 7051
319
+
320
+
For local development and review:
321
+
- The chaincode will run with the name `simple-asset:1.0`
322
+
- Debug level logging is enabled via `CORE_CHAINCODE_LOGLEVEL=debug`
323
+
- You can modify the Java code and rebuild/restart to see changes
324
+
- The peer connection is automatically configured using the Docker container's IP
325
+
326
+
**Worth considering for Java chaincode:**
327
+
- If you want the chaincode running on multiple peers, start multiple instances with different `CORE_PEER_ADDRESS` values
328
+
- Ensure `CORE_CHAINCODE_ID_NAME` matches the chaincode name and version in your Fablo config (for instance `chaincode1:0.0.1`)
329
+
- The Java chaincode uses Gradle's ShadowJar plugin to package all dependencies into a single JAR file
0 commit comments