The rise of blockchain technology, especially the type used by Ethereum (ETH -1.84%), has caused smart contracts to skyrocket in popularity. For the uninitiated, smart contracts are programmable agreements, or protocols, that self-execute and enforce without the aid of any intermediaries. Other than the fact that they do not require a middleman (like a lawyer), they are not so different from regular contracts. 

Long story short, smart contracts are at the heart of the $200 billion decentralized finance (DeFi) industry. Let's take a look at how they work, and how they can enrich investors' blockchain portfolios.

A series of connected cogs. One is labeled "smart contract" and it is connected to several cogs with digital icons.

Image source: Getty Images.

Smart contracts in action 

It's pretty hard to utilize financial services without smart contracts. Specifically, peer-to-peer cryptocurrency transactions without them is rife with fraud. 

 Let's say a lender, Ellen, wants to earn 4% interest per year on her $10,000 worth of Bitcoin (BTC -0.77%) by lending it out to a borrower named John. To establish trust, both participants would first need to get to know each other better and sign an agreement. Afterward, Ellen sends 0.25 bitcoins to John's wallet address in anticipation that John will send her collateral for the loan. But let's say he never does, simply grabbing Ellen's bitcoins and making a run for it. This is why, for a long time, we could never have peer-to-peer transacctions in financial services. 

But what if Ellen and John used a smart contract? To do this, Ellen would convert her bitcoins into a token that's based on the Ethereum (ER-20) blockchain, called Wrapped Bitcoin (WBTC -0.76%). She can do this either through her wallet, or on most major exchanges. The smart contract guarantees that she will be receiving WBTC from BTC on a 1-to-1 ratio before fees. 

Subsequently, all she has to do is log onto a DeFi platform like Aave, connect her wallet, and deposit WBTC into one of its lending services. And the interest would start rolling in.

This works with very little risk because her WBTC is automatically sent to a lending address governed by a protocol. Likewise, interest is automatically collected and sent to all beneficiary wallet addresses within the protocol. What's more, when borrowers such as John takes out a loan, smart contracts automatically place their collateral in escrow. So, if they default, it would trigger a clause in the smart contract for automatic liquidation and lenders like Ellen would get their money back.

For those who don't like lending money, fear not. One could also deposit their cryptocurrency into dedicated addresses, using smart contracts to validate transactions on a blockchain (this is called staking). For example, one can earn over 6% interest per year gross by staking Cardano's ADA (ADA -2.10%) coins, the third-largest cryptocurrency globally. 

Furthermore, smart contracts power the buying and selling of ownership certificates of digital art, music, videos, and other digital items, also known as non-fungible tokens, or NFTs. Investors can be confident when they deposit their funds into making a bid or buyout on marketplaces like that they are getting the NFTs they are paying for. Programmers write the code for buying and selling NFTs and ensure that they work as intended, similar to online casinos. Like physical art, NFTs have incredible tax benefits when donated to charities.

The next step 

I'd recommend investors either try out decentralized finance services to earn a fixed income or invest in smart contract coins or tokens. The advancement of smart contracts is far from over. Right now, there are innovative networks like Chainlink (LINK -1.94%) that can link smart contract execution to real-world data like price feeds, weather patterns, election results, and economic metrics. Now's truly the golden era of development for smart contracts.