Is it possible to get the current price of Ethereum to Dai within a smart contract? Can this be done without a transaction, using a read operation by the nodes on some kind of existing decentralized exchange or the dai contract itself?

2 Answers 2


You can use MakerDAO's ETHUSD feeds to get price of ETH in USD. This should be extremely close (<1% difference usually) to ETHDAI in the short term, and average to much closer in the long term (<0.1% usually).

Alternatively, you can use the ratio of ETH to DAI in the Uniswap ETH/DAI exchange to estimate the price, which is located here


You can query the latest price via HTTP/RestAPI, for that you need to implement oracalize service's. Its very easy to write and a lot of services are available, you can use an existing service. Obviously, it will cost gas and mostly this calls asynchronous. 2Way is to integrate DEX is a good idea, but most of DEX may not update timely. Some of DEX(Decentralized Exchanges) will not provide this method is in the smart contract. For more details please refer to idex.market api.

These api's values are changing exchange to exchange before integrating anything from other than decentralized you compromised your security. That means your giving one way to an attacker to enter into the system very easily. So I'll say be careful while integrating with the 3rd party services like oracalize or REST API's or any lib.

I am not advising to use idex.network or oracalize or any other services, this is intended for knowledge purpose only.

  • 1
    Bro your answer is outdated and not about MakerDAO and Dai. Read up on that project if you haven't already, it's like a decentralized oracle Commented Feb 10, 2019 at 18:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.