# Dynamic Oracles

### What Is Dynamic Oracles?

With Truebit’s Dynamic Oracle, smart contracts can securely trigger external computations or data requests that are handled by Truebit’s off-chain execution and verification layer. The platform ensures that results are returned verifiably and without requiring trust in third parties.

This enables:

* **Off-chain Computation:** Running heavy or external tasks outside the main network while maintaining full on-chain trust.
* **Cryptographic Verification:** Providing mathematical proof of task correctness to ensure every execution is tamper-proof.
* **Seamless Integration:** Enabling fluid interaction with smart contract logic for a cohesive developer experience.

### **Available Execution Types**

* **Dynamic JS Function**: Execute a **single** JavaScript function directly from a smart contract without the need to deploy the function task previously. It will execute the code directly without the need to register in the platform.
* **Truebit API Task**: Run your deployed Truebit API tasks directly from a smart contract and retrieve the result without  encoding (bytes).
* **Truebit API Task with n8n Orchestration**: Trigger an n8n workflow via a Truebit API and receive the result ABI-encoded.

### System Components

1. **User Contract**\
   A custom smart contract developed by the [Task Developer](/overview/how-does-truebit-work.md). It inherits from `tbBaseContract`, calls the `_requestExecution` method, and handles the `callback` with the computed result.&#x20;
2. **WatchTower**\
   A Truebit-developed contract responsible for emitting events when new execution are requested and managing the response callbacks once computation is completed. This contract has all the needed logic required to interact with Truebit.

***

### Technical Prerequisites

Before starting, please clone the examples on the following repository to start working with Truebit:

```bash
git clone https://github.com/TruebitProtocol/truebit-nextgen-examples.git
```

* You will find the following files under the folder *Blockchain:*
  * `/BaseTBContract.sol`
  * `/interfaces/IBaseTBContract.sol`
  * `/interfaces/IWatchTower.sol`&#x20;
  * `/abstract/Types.sol`
  * `/examples/DemoContract.sol` : You can use this contract as a reference for implementing a Dynamic Oracle within your own smart contract.
* A Solidity development environment (`^0.8.0`)
* WatchTower Address: `0xEcd0EeD24Ed6a54d05a07125c4ccb809b3A09868`

### Create Your Contract

Please, review the implementation guides we’ve prepared to help you integrate with the **Dynamic Oracle** feature.

* [**Implement a Dynamic JS Function execution**](/developing-truebit-tasks/dynamic-oracles/dynamic-js-execution.md)
* [**Implement a Truebit API Task execution**](/developing-truebit-tasks/dynamic-oracles/api-task.md)
* [**Implement Truebit API Task with n8n Orchestration execution**](/developing-truebit-tasks/dynamic-oracles/api-task-with-n8n-orchestration.md)


---

# 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://devs.truebit.io/developing-truebit-tasks/dynamic-oracles.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.
