Debugging
Last updated
Last updated
At this point, it’s essential to debug the code and ensure all endpoints meet the required specifications. A good approach is to add all relevant endpoints to the Test.hc file for thorough debugging and validation. The file should follow this structure:
By adding these debugging endpoints to the Test.hc file, you can thoroughly test and verify your smart contract’s behavior, ensuring it meets all requirements. To start debugging, click the Debug button in Hyper Code IDE, which will activate the tools needed to validate the contract’s functionality.
After successful execution, you’ll see the Contract State displayed in the IDE’s output window as a JSON string. This includes properties like:
_MyString with a value of “test.”
_MyNumber set to 100.
_StringChanger and _NumChanger showing the wallet addresses of those who made changes.
This JSON output offers clear visibility into your contract’s current state, making it easy to track values and interactions.
After the Contract State, the Contract Output will display the results from various endpoints in your smart contract. This section helps diagnose how endpoints are functioning, allowing you to verify that your contract behaves as expected and provides insights into specific actions within your blockchain application.
After the Contract Output, you’ll find the Execution Performance box, showing how long the contract took to execute. In this case, it reports an execution time of 1,280 microseconds.
At this stage, optimising your code is key. Reducing execution time lowers both gas fees and execution costs, improving your smart contract’s efficiency and cost-effectiveness in blockchain operations.