1. 1

Enrique asked a quite simple question on the Cardano Developers Telegram channel: Can we make a Cardano smart contract in dollars?

Well, technically we can’t, at least directly. Cardano runs on Ada, not dollars. And doesn’t include paying by bank or credit cards. Further exploration on his question actually delivered something more feasible: Can we make a Cardano smart contract to pay $10 in ADA for some product or service?

http://www.javiercasas.com/articles/plutus-smart-contracts-pay-usd10-in-ada

    1. 2

      What I never understand with smart contracts that require off chain data:

      If it requires an oracle, why not just run it off chain? In this case you’re fully trusting the exchange, so it’s not any more “trustless” than if the buyer’s wallet had an integration with ShapeShift/Changelly/some other instant exchange.

      1. 1

        if the buyer’s wallet had an integration with ShapeShift/Changelly/some other instant exchange

        What if you want to deal with the average exchange ratio? How do you convince these instant exchanges to cooperate to provide the average ratio, considering that they may not want to cooperate? On the other hand, asking each one for an oracle, and having a smart contract that accepts several oracles to compute the average is not that hard.

        1. 1

          What if you want to deal with the average exchange ratio?

          Why? The average isn’t useful (in the context of the article). If I want someone to send me $10 USD, I’d ask the exchange how much $10 USD in Bitcoin is, and ask for that amount. The average would mean that I could get more or less depending on which exchange I have an account with.

      2. 1

        I think the idea is that you trust external parties to provide data (because it can be audited), but you don’t trust external parties to run code. I think it makes sense.

        1. 1

          This is pretty much the takeaway. You can run trusted code on chain, while using trusted data from off chain.

        2. 1

          You can also run the code yourself.

          i.e. User types in their wallet app to request $10 USD. The wallet secretly makes a deal with the user’s exchange and determines that $10 USD will be worth X Coins. The wallet makes a request to the other person for X coins. Using oracles just adds extra cost for not a lot more trust.