# Set up your oracle service

* You are required to configure your machine to run the Oracle and Backend services. The Oracle service will inform the smart contracts about the current prices of the currency pairs (BTC/USD, RIF/USD, USD/ARS, USD/COP, ~~RIF/BTC~~). <br>
* The following commands will set up your machine and start the services using the already built docker image that resides in your AMI.

1.**Set up your oracle configuration**

For this step you will have to provide the following information to set up your oracle:&#x20;

* Environment: testnet/mainnet
* Oracle Address:&#x20;
* RSK Node url&#x20;
* Coin Pairs
* Oracle Port
* Registry address

```
bash config_oracle/install_requirements.sh &&
python3 config_oracle/setAddress.py -e ./env_oracle
```

**Thorough explanation of the `setAddress` script:**&#x20;

* The first parameter you have to provide is the network where your oracle will be running. You have two options:&#x20;
  * RSK Mainnet network
  * RSK Testnet network
* Once you have chosen the network, a series of default parameters will be automatically set. However, these values could be modified later. For example, the default values for testnet are:&#x20;
  * **CHAIN ID**: 31
  * **PUBLIC RSK NODE URL**: <https://public-node.testnet.rsk.co>
  * **REGISTRY ADDR**: 0xf078375a3dD89dDF4D9dA460352199C6769b5f10
  * **ORACLE PORT**: 5556
* The next step will be to configure your oracle, to do this you could choose between providing an address and a private key or you could generate a new pair.&#x20;
* Finally, you will need to provide the coin pairs your oracle will be listening to. Right now the Money On Chain Oracle system supports  two coin pairs to subscribe to:&#x20;
  * BTCUSD
  * RIFUSD
  * USDARS
  * USDCO~~P~~
  * ~~RIFBTC~~ *(deprecated)*

2.**Start the oracle´s container service**

Once you have filled in your oracle data you should now start your oracle service. The service will be automatically restarted if something happens. The example below exposes the default oracle port, but if you have chosen to set another port in your oracle config file, you should expose the selected port.

* Container log retention policy:&#x20;
  * log driver: json-file
  * max size file: 50Mb (estimated log file size per day)&#x20;
  * max files retention: 15 (two weeks of logs)
  * compress: true

```
docker run -d --restart always --log-driver json-file --log-opt max-size=50M --log-opt max-file=15 --log-opt compress=true -p 5556:5556 --name omoc-node --env-file=/home/ubuntu/env_oracle moneyonchain/omoc_node:latest 
```

If you would not want to config a file to start your oracle, you could pass the options one by one to the oracle container using the -e flag provided by docker. Below we leave an example:&#x20;

```
sudo docker run -d \
--publish 5556:5556 \
--name omoc-node \
--env NODE_URL="http://localhost:8545" \
--env NETWORK_ID=12341234 \
--env ORACLE_ADDR=0x.... \
--env ORACLE_PRIVATE_KEY=0x...\
--env ORACLE_PORT=5556 \
--log-driver json-file \
--log-opt max-size=50M \
--log-opt max-file=15 \
--log-opt compress=true \
moneyonchain/omoc_node:latest
```

* &#x20;4\. **Check logs**&#x20;

To check your oracle logs you could use:&#x20;

```
docker logs omoc-node
```

or you could just get into the container:&#x20;

```
docker exec -it omoc-node /bin/bash
```

#### Get RBTC&#x20;

For the following steps you will need RBTC to pay for transactions in the dapp and to send gas to your oracle. For testnet, you could visit <https://faucet.rsk.co/> and complete the form to get Ethers for your Oracle's address.

Now you can register your oracle and interact with the smart contract using the Dapp.&#x20;


---

# 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://docs.moneyonchain.com/omoc/setup-your-machine-and-run-the-service.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.
