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).

  • 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:

  • Environment: testnet/mainnet

  • Oracle Address:

  • RSK Node url

  • 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:

  • The first parameter you have to provide is the network where your oracle will be running. You have two options:

    • 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:

    • 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.

  • 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:

    • BTCUSD

    • RIFUSD

    • USDARS

    • USDCOP

    • 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:

    • log driver: json-file

    • max size file: 50Mb (estimated log file size per day)

    • 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:

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
  • 4. Check logs

To check your oracle logs you could use:

docker logs omoc-node

or you could just get into the container:

docker exec -it omoc-node /bin/bash

Get RBTC

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.

Last updated