June 30, 2026

How to build a Decentralized Oracle on Ethereum — A Step-by-Step Guide

How to build a Decentralized Oracle on Ethereum — A Step-by-Step Guide

Download Docker Desktop on your Machine and install it.

iexec wallet getRLC --chain kovan
iexec wallet show --chain kovan
Paste your wallet address on the chatbox to receive 3.0 Kovan ETH
iexec wallet show --chain kovan
Your balance should show you 3.0 ETH and 200 nRLC. If not, wait for a minute.
iexec account deposit 200 --chain kovan

In order to run the price-feed application on the iExec’s decentralized cloud, we need to go through the following steps:

  1. Push it on the DockerHub public registry
  2. Deploy it on the iExec’s Platform
mkdir app 
cd app # enter the folder
curl -o ./price-feed.js https://raw.githubusercontent.com/iExecBlockchainComputing/iexec-apps/master/PriceFeed/src/oracle.js
FROM node:11-alpine
COPY price-feed.js /src/price-feed.js
RUN npm i https ethers fs
ENTRYPOINT [“node”, “src/price-feed.js”]
docker build .  #write down your image ID (it appears after the text "successfully built 19acce70289d" <-- that is the image ID)
docker tag <IMAGE_ID> <YOUR_DOCKERHUB_NAME>/price-feed  #ex: docker tag 19acce70289d iexechub/price-feed
docker push <YOUR_DOCKERHUB_NAME>/price-feed  #write down your image digest (it appears after sha256:959eb75b13efb41a8f37495784150574d66175adebd0c6c18216b482c574d109 <-- this is your image digest)
cd ..  #move to upper folder
iexec app init #tell the SDK that you want to create an app
  • name: We name it “PriceFeed”.
  • multiaddr: replace by dockerhub repository name. “registry.hub.docker.com/<YOUR_DOCKERHUB_NAME>/price-feed:latest”.
  • checksum: given by the command docker push. (add 0x before the sha256:)
iexec app deploy --chain kovan  #that is a blockchain transaction
Congrats! Your Price-Feed App is now deployed on the iExec platform.
iexec order init --app
iexec order sign --app
iexec order publish --app # publish your apporder on the marketplace and get an orderHash
iexec order show --app [orderHash]

Let’s clone the repo on your terminal, enter the smart-contract folder, and install JS dependencies:

git clone https://github.com/iExecBlockchainComputing/price-feed-doracle.git smart-contract
cd smart-contract
npm install --unsafe-perm=true --allow-root
cd ..  # move to upper folder
iexec wallet show --show-private-key # copy your private key for next step
cd smart-contract # move back to the smart-contract folder
MNEMONIC=
<YOUR_PRIVATE_KEY> ./node_modules/.bin/truffle migrate --network kovan # Deploy your smart contract to the Blockchain
2 smart-contracts deployed

Now let’s buy a “price-feed” run on iExec by running these commands on your terminal:

cd ..  # move back to parent folder price-feed
iexec orderbook workerpool --category 2 # copy the workerpool order hash
iexec orderbook app <address> # copy the app order hash
iexec order fill --app <APP_ORDER_HASH> --workerpool <WORKERPOOL_ORDER_HASH> --chain kovan  # start the DOracle computation!
iexec deal show <DEAL_ID> --tasks 0 --chain kovan
iexec task show <TASK_ID> --watch --chain kovan

Published at Wed, 10 Jul 2019 09:05:04 +0000

Previous Article

Coinbase Is in Talks to Launch Its Own Insurance Company

Next Article

Facebook Crypto Products Not Coming to World’s Biggest Markets

You might be interested in …