# Debugging

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:

```javascript
CRC_Contract._constructor();

 CRC_Contract.__HelloWorld();
 CRC_Contract.ChangeNumber(100);
 CRC_Contract.ChangeString("Test"); 
 CRC_Contract.__GetNumberInfo();
 CRC_Contract.__GetStringInfo(); 
```

By adding these debugging endpoints to the <mark style="color:yellow;">Test.hc</mark> file, you can thoroughly test and verify your smart contract’s behavior, ensuring it meets all requirements. To start debugging, click the <mark style="color:yellow;">Debug</mark> button in Hyper Code IDE, which will activate the tools needed to validate the contract’s functionality.

<figure><img src="/files/9I7QpwK43iMZbCdEkIan" alt=""><figcaption><p>The debugging button</p></figcaption></figure>

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.

<figure><img src="/files/eWd52k17OIbJdeOs4ila" alt=""><figcaption></figcaption></figure>

After the <mark style="color:yellow;">Contract State</mark>, the <mark style="color:yellow;">Contract Output</mark> 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.

<figure><img src="/files/Y6bJF9HfZumW0yNzsCSC" alt=""><figcaption></figcaption></figure>

After the <mark style="color:yellow;">Contract Output</mark>, you’ll find the <mark style="color:yellow;">Execution Performance</mark> box, showing how long the contract took to execute. In this case, it reports an execution time of 1,280 microseconds.

<figure><img src="/files/9SYmHDMOiCI90wYxnFvt" alt=""><figcaption></figcaption></figure>

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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://circular-protocol.gitbook.io/hyper-code-ide-guide/lesson-2-smart-contracts/interactive-blocks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
