What Are Smart Contracts in Cryptocurrency?

These blockchain applications support many of the most important crypto projects.

Many or all of the products featured here are from our partners who compensate us. This may influence which products we write about and where and how the product appears on a page. However, this does not influence our evaluations. Our opinions are our own. Here is a list of our partners and here's how we make money.

The investing information provided on this page is for educational purposes only. NerdWallet does not offer advisory or brokerage services, nor does it recommend or advise investors to buy or sell particular stocks, securities or other investments.

MORE LIKE THISCryptocurrency

Smart contracts are important building blocks for products in the cryptocurrency and blockchain space. A smart contract is a way to settle a transaction once a verifiable event, such as a payment, has taken place.

Smart contracts play out in the background of many consumer crypto products, so chances are you’ve used them if you’re doing anything other than buying and holding crypto. Applications of smart contracts include NFTs, decentralized exchanges and stablecoins.

Which cryptocurrencies support smart contracts?

Smart contracts are a feature of second-generation cryptocurrencies — notably Ethereum, which popularized the concept when it was introduced in 2015. Other examples include Cardano, Solana and Polkadot.

Bitcoin and other earlier cryptocurrency blockchains do not generally support complex smart contracts.

Smart contract example

Because smart contracts tend to operate in the background of the end-user experience, it can be helpful to understand them through an example.

Say you want to trade one kind of cryptocurrency for another, and you find someone who will trade. But you don’t know this person, and you want to make sure that when you send them cryptocurrency, they’ll hold up their end of the deal.

You and your counterpart could make a smart contract that ensures the deal won't happen unless you both get paid. It could work something like this:

  1. You send cryptocurrency to an address associated with the smart contract you’ve created.

  2. The contract’s code checks to see whether you’ve sent the agreed-upon amount.

  3. The code then checks to see whether your counterpart has sent the agreed-upon amount.

  4. Once the code verifies that both of you have paid, it releases the proceeds to each of you.

  5. If both parties have not paid within a certain time frame, all crypto that has been contributed goes back to the original owner.

This is a relatively simple example, though. Decentralized exchanges such as Uniswap and PancakeSwap do similar tasks using more complicated smart contracts.

In theory, smart contracts can automate many steps for which you may need a trusted intermediary. Developers and entrepreneurs have been exploring applications across a variety of sectors, including logistics, insurance, finance and gaming.

Limitations of smart contracts

Any smart contract that runs on a blockchain faces one major limitation: It can rely only on information stored in the records of that blockchain. And cryptocurrency blockchains tend to mostly contain information related to the circulation of that specific cryptocurrency and related assets.

For instance, you could write a smart contract that holds digital assets to be paid to a contractor once she finishes the work on your house. But who decides when the work is “finished?”

Without some way to reliably insert mutually verifiable information about the progress of construction, a smart contract wouldn’t be much help in a dispute over whether the project was done to satisfaction. You’d need a third party to give the computer program a green light to release the funds.

To address this issue, blockchain developers have created a concept known as an “oracle,” which feeds external information into a blockchain system.

In the example of the contractor, say this was an HVAC project. Data from a thermostat or sensor may be able to verify that the work has been completed as described.

Learn how to write a smart contract

Any user of a blockchain network that supports smart contracts can write their own.

You’ll have to know some computer coding skills and be comfortable with blockchain technology. If you do it wrong, you could risk losing your crypto by locking it up irretrievably or sending it to the incorrect place.

If you’re interested in how to write smart contracts, some blockchain projects have test networks where you can carry out trial transactions without sending real money. Various cryptocurrencies have courses and guides that offer help; one place to start is Ethereum.org’s “Learn by Coding” section.

And if you want to see how smart contracts work in the wild, you can look at blockchain explorers such as Etherscan — though you’ll need some serious computer chops to understand what you’re seeing.

The more you learn about smart contracts, the better you’ll be able to evaluate the technology you’re using.

The author owned Ethereum, Bitcoin, Cardano, Solana and Chainlink at the time of publication. The editor owned Bitcoin.

Get more smart money moves – straight to your inbox
Sign up and we’ll send you Nerdy articles about the money topics that matter most to you along with other ways to help you get more from your money.