Skip to content
Ethereum Oracle with Apache Camel and Web3J
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
contracts
migrations
src
.gitignore
LICENSE
README.md
client.js
oracle.js
oracle.png
pom.xml
truffle-config.js
truffle.js

README.md

Camel-Ethereum-Oracle

Ethereum Oracle with Apache Camel and Web3j

Oracle

Deploy Oracle.sol contract

Compile the contract.

truffle compile

Start a local Ganache instance first. Then deploy the contract.

truffle migrate --reset

Start Camel oracle route

And leave it to listen for CallbackGetBTCCap events to update btc price with a random value.

mvn spring-boot:run

Run Camel client to check btc price

On a separate terminal check the current btc value in the contract (will be 0)

mvn test -Dtest=CamelOracleRouteTest#getBTCCap

Trigger CallbackGetBTCCap event

CallbackGetBTCCap event will be picket by the Camel route running above. Then the route will update the btc price with a random value.

mvn test -Dtest=CamelOracleRouteTest#updateBTCCap

Then check btc price again to see it set in the contract with random value:

mvn test -Dtest=CamelOracleRouteTest#getBTCCap

Rather than using the oracle, you can also set the btc price directly to 100:

mvn test -Dtest=CamelOracleRouteTest#setBTCCap    

You can also run Javascript based oracle and client for the same scenario

The complete Javascript based example are from here

node oracle.js

On a separate terminal

node client.js
You can’t perform that action at this time.