Market data on Ethereum

  • by creating an oracle

  • without sidechains

  • as a public good

Basic idea

Making the pricing data accessible on chain to everyone … whenever one person pays for updating the price (public good)

Using only free software and publicly available resources (compile with truffle, data from cmplot public API)

Limiting the costs for the users, and limiting the chain spam by using an optimized storage format (fixed precision float)

Learning JS and discovering ETH

Creating an oracle!!!!

How I built it

The oracle creates a contract with initial contract variables

A free client can monitor the contract variables for free

A paying client can ask to update the contract variables

Upon request, variables are updated from the parsed JSON

Both the free client and the paying client benefit from the update

Challenges I ran into

  • Using a demo made for truffle 4 (took about 1.5 days to reach the 'hello world' stage)

  • Learning JS and ETH (I had never coded with either)

  • async/await, promises

  • callback and events

  • overcame most obstacles but couldn't figure out how to estimate and cover costs

Accomplishments that I'm proud of

It (mostly) works: both clients and the oracle

What I learned

To create an oracle without anything but vim!

Basics of etherum contracts

What's next for the market data oracle

Update the contract only when necessary

Estimate the gas fee instead of hardcoding guesstimations

Get gas price from the main chain

Fix the bug to cover operating costs +10% (step2:??, step3: profit!)

Deploy to the main net

Add more pairs

Built With

Share this project: