# 3. Core contract

The DeCredit Oracle protocol is mainly composed of three parts: the on-chain smart contract, the on-chain oracle smart contract, and the off-chain external data source API. We call the on-chain workflow the data feedback flow. The DeCredit core oracle smart contract library contains three important smart contracts: ChainToOracle( ), RwaToOracle( ), BackToRwa( ) as follows:\
\
ChainToOracle contract

The on-chain smart contract initiates a data request to the DeCredit Oracle smart contract, and this request contains the encoded information FromChainRequestTo required for the successful run of the loop.

RwaToOracle contract\
The external data source sends data to the DeCredit Oracle smart contract through the completed function construct. This request contains the encoded information FromRwaRequestTo required for the loop to succeed.

BackToRwa contract\
The DeCredit Oracle smart contract feeds data back to the on-chain smart contract.

ChainToOracle( ), RwaToOracle( ), BackToRwa( ) are integrated in the Decredit client. The DeCredit Oracle API will also be provided for integrating oracle functions into your own client contracts.

The operation of the contracts

Oracle contracts are owned by DeCredit oracle node operators, which run alongside off-chain oracle nodes.

The oracle contract has a request function that is used by the node to complete the request once the node gets the operation result. This function returns the result to the Decredit client or API using the return function defined in the original request.

The parameter format for launching the client contract is:

·  Oracle address

·  Operation ID, so oracle knows which tasks to operate

·  Return function to which oracle will send the response

·  Whether it is cross-chain, if crosschain it’s 1, it is cross-chain, otherwise it is not cross-chain. The crosschain parameter defaults to be 0, that is, not cross-chain.

·   Whether it supports rating


---

# 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://decredit.gitbook.io/decredit-white-paper/3.-core-contract.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.
