Debug a CorDapp
There are several ways you can debug your CorDapp.
Method 1: Use a MockNetwork
You can attach the IntelliJ IDEA debugger to a
MockNetwork
to debug your CorDapp.
- Define your flow tests.
- Set
threadPerNode
tofalse
in yourMockNetwork
. - Set your breakpoints.
- Run the flow tests using the debugger. When the tests hit a breakpoint, execution will pause.
Method 2: Use the node driver
Attach the IntelliJ IDEA debugger to nodes running via the node driver to debug your CorDapp. You can debug the CorDapp:
- While the nodes are in-process
- Using remote debugging
Debug with the nodes in-process
- Define a network using the node driver.
- Check your
DriverParameters
and make sure thatstartNodesInProcess
is set totrue
. - Run the driver using the debugger.
- Set your breakpoints.
- Interact with your nodes. If the execution hits a breakpoint, it will pause.
Debug remotely
Check your
DriverParameters
and make sure thatstartNodesInProcess
is set tofalse
andisDebug
is set totrue
.Run the driver. The remote debug ports for each node are generated automatically and printed to the terminal.
For example:
[INFO ] 11:39:55,471 [driver-pool-thread-0] (DriverDSLImpl.kt:814) internal.DriverDSLImpl.startOutOfProcessNode -
Starting out-of-process Node PartyA, debug port is 5008, jolokia monitoring port is not enabled {}
Attach the debugger to the relevant node’s debug port:
- In IntelliJ IDEA, create a new run/debug configuration of type
Remote
. - Set the run/debug configuration’s
Port
to the debug port. - Start the run/debug configuration in debug mode.
- In IntelliJ IDEA, create a new run/debug configuration of type
Set your breakpoints.
Interact with your node. If the execution hits a breakpoint, it will pause.
Method 3: Enable remote debugging on a node
Was this page helpful?
Thanks for your feedback!
Chat with us
Chat with us on our #docs channel on slack. You can also join a lot of other slack channels there and have access to 1-on-1 communication with members of the R3 team and the online community.
Propose documentation improvements directly
Help us to improve the docs by contributing directly. It's simple - just fork this repository and raise a PR of your own - R3's Technical Writers will review it and apply the relevant suggestions.
We're sorry this page wasn't helpful. Let us know how we can make it better!
Chat with us
Chat with us on our #docs channel on slack. You can also join a lot of other slack channels there and have access to 1-on-1 communication with members of the R3 team and the online community.
Create an issue
Create a new GitHub issue in this repository - submit technical feedback, draw attention to a potential documentation bug, or share ideas for improvement and general feedback.
Propose documentation improvements directly
Help us to improve the docs by contributing directly. It's simple - just fork this repository and raise a PR of your own - R3's Technical Writers will review it and apply the relevant suggestions.