Introducing Pricegeth, Publishing Crypto Price Pairs Every Ethereum Block
Decentralized apps and smart contracts get executed on the Ethereum blockchain. Although accessible when an internet connection is available, Dapps by themselves cannot connect to internet directly and fetch information. This is a problem for the distributed ecosystem.
There are a few different approaches to solving this. One way is a callback method. This is where smart contract A would send a transaction to smart contract B, a data oracle, asking for some information.
The oracle smart contract would have a central server which is listening to the network for these transactions to fetch information. Then the oracle server would send a transaction to smart contract A with the results.
There are some downsides to this method. One being if the server is down or has bugs, there might not be immediate callbacks or it may just never happen.
Another issue is the gas cost of the callback function. If smart contract A needs to do some calculations and change a few variables, it requires enough gas from the callback transaction. This is how services such as Oraclize.it works.
Another possible method is to publish the information to Ethereum blockchain which is accessible to other smart contracts. This is why we’ve created Pricegeth, which is now available on Github.
A few things to note about Pricegeth:
- Pricegeth publishes price pairs (BTCUSD, BTCETH, BTCETC, BTCDOGE) at every ether block time
- Using Pricegeth Library is free and easy to implement (check out example.sol)
- This is a work in progress. The main contract address and function outputs might change in the near future.
- Everything needed to get started is here: https://github.com/VelocityMarket/pricegeth
Thanks to Shayan Eskandari for deploying Pricegeth and helping write this post.
Originally published at blog.velocity.technology on September 1, 2016.