LearnBlockchain as Business: The Smart Contracts are Coming

Ben Deitch
writes on March 29, 2018

It’s 7:30am, and you’re late getting to the airport for a flight. You rush out of bed, grab your suitcase and hail a ride using your smartphone. This may sound like the usual Uber or Lyft transaction, but the car that arrives this time came from a whole new world!

For starters, the car is completely autonomous, a taxi without a driver, but what’s cooler is who owns it. Thanks to smart contracts, the car can be owned by hundreds of people. When a ride is completed and a fare is paid, the smart contract will automatically pay each owner their fair share of the fare’s profit.

In this example, a car can be an income-generating asset and it’s all possible because of a smart contract. You can think of smart contracts as computer programs for the blockchain (an unchangeable, decentralized, cloud-based ledger).

At its most basic, the smart contract for our car example would look something like this:

contract CarSmartContract {
  // funds to make sure the car can afford its own electricity and maintenance
  var operationsFunds = 0f

  // a list of all the owners
  var owners = listOf("jane1984@gmail.com", "rhsmith@yahoo.com", "mikhail28@hotmail.com")

  function receivePayment(money: Float) {
    // whenever a rider sends payment to the car...
    // take 50% to cover expenses...
    val operationsCost = money * 0.5f 

    // add operations cost to existing funds
    operationsFunds += operationsCost

    // calculate the payout for each owner...
    val ownerPayout = (money - operationsCost) / owners.size 

    // and pay the owners
    for (owner in owners) {
      sendMoney(owner, ownerPayout) 

So instead of paying Uber or Lyft at the end of the ride, a passenger will send payment directly to CarSmartContract … which will keep 50% of the money for itself and payout ⅓ of the remaining 50% to each of the three owners — all automatically!

The ability to create programmable bank accounts like this is a huge game-changer. Although we’re already starting to see some interesting applications of smart contracts, we’re still just at the beginning.

One such example is being pursued by Brendan Eich, creator of JavaScript and co-founder of Mozilla. His team aims to address the problem of ads on the internet by paying users for watching ads. With their plan, advertisers will still pay a website to host their ads, but a portion of that payment will be automatically distributed to users when they watch an ad. Instead of ads being an intrusion, they will be a (very small) source of income.

Another exciting use of smart contracts comes to us from the world of computation. From running machine learning algorithms to rendering movies, there’s a ton of work out there for server farms. But what if we could use the idle processing power in our PCs to do the same work? Instead of Pixar using a server farm to render their new movie, the rendering task could be split among thousands of home computers, laptops and maybe even smartphones. Then, once the task is completed, everyone would be paid proportionally based on how much they contributed — you probably leave your computer on when you’re not using it anyway, you might as well get paid for it.

There are hundreds of projects already in development to use smart contracts to do things that are impossible today, and we’ve only scratched the surface. For example, we may soon be able to visit a completely automatic casino. We may find ourselves slightly less irritated when our insurance company automatically compensates us for a delayed flight. Smart contracts are ushering in a whole new way to do business, and I can’t wait!

Start learning to code today.
Free Trial

2 Responses to “Blockchain as Business: The Smart Contracts are Coming”

  1. Manil on May 1, 2018 at 5:16 pm said:

    The blockchain revolution is coming! 🙂

    Likewise, I am very interested in learning more about the blockchain technology; especially in terms of writing smart contracts. Hopefully, Treehouse will consider adding some relevant courses about the subject. Cheers!

  2. Hello Ben, thank you for this article. I’m very interested in learning Solidity and writing smart contracts. Will Treehouse come up with a course on this?

Leave a Reply

You must be logged in to post a comment.

Learning to code can be fun!

Get started today with a free trial and discover why thousands of students are choosing Treehouse to learn about web development, design, and business.

Learn more