> For the complete documentation index, see [llms.txt](https://docs.trac.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.trac.network/documentation/developers/gasless-net-r1/features.md).

# Features

Please read the code comments in the files below. Examples are taken from our [Example Contract ](https://github.com/Trac-Systems/trac-contract-example/)Github repo.

```javascript
// import the Feature superclass from the trac-peer package
import {Feature} from 'trac-peer';

export class Timer extends Feature {

    /**
    * Setup your Feature
    *
    * Instances of Features are passed to Peer instances.
    * See the Deployment section for more details.
    */
    constructor(peer, options = {}) {
        super(peer, options);
        this.update_interval = options.update_interval !== undefined &&
                                false === isNaN(parseInt(options.update_interval)) &&
                                parseInt(options.update_interval) > 0 ? parseInt(options.update_interval) : 60_000;
    }

    /**
    * start() is supposed to trigger the actual Feature execution.
    *
    * In the case of timers, an infinite event loop reads the latest
    * time every 10th second and appends it into the contract.
    *
    + The contract will then read this value as showcased in the previous
    * section.
    *
    * Appends from Features don't go through transactions but straight into
    * the contract.
    */
    async start(options = {}) {
        while(true){
            await this.append('currentTime', Date.now());
            await this.sleep(this.update_interval);
        }
    }

    // stop helps to shutdown and may be triggered by a custom Feature-handler
    async stop(options = {}) { }
}

export default Timer;
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.trac.network/documentation/developers/gasless-net-r1/features.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
