> For the complete documentation index, see [llms.txt](https://www.digitalnations.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.digitalnations.xyz/web3-overview/the-web3-ecosystem/smart-contract-platforms/how-do-smart-contract-platforms-work.md).

# How do Smart Contract Platforms Work?

Smart contract platforms perform three basic functions:&#x20;

* Data Storage:  Store important data such as account balances on a **blockchain**
* Execution:  Run programs via **smart contracts**
* Consensus:  Provide **consensus mining** to secure the network and validate state

<figure><img src="/files/hK8X2MsoLIRZqlY6V5K9" alt=""><figcaption></figcaption></figure>

So if Alice and Bob wanted to use the Ethereum blockchain to trade U.S. dollars for Ethereum tokens, the process would look something like this:&#x20;

1. The Ethereum blockchain stores Alice and Bob’s original account balances (i.e. Alice has 2ETH and Bob has $8,000)
2. Bob would open a trading dapp, such as Uniswap\*, which would read these balances
3. Uniswap’s smart contracts would determine the price of Ethereum, let’s say it’s $4,000, and execute the trade
4. he results of the trade along with the updated balances would be sent to miners to verify
5. Miners would verify this transaction using a Proof-of-Work consensus protocol
6. Miners would then update the Ethereum blockchain with the new balances – (i.e. Alice now has 1 ETH and $4,000 and Bob now has 1 ETH and $4,000)

\*This is actually a vast oversimplification of the process and also not how Uniswap actually works.  That said, I believe it is helpful in getting a general idea of the flow of a smart contract platform.  If you’re interested in learning more about how a decentralized exchange operates, you can check out my paper on DeFi (link).&#x20;

So, at the end of the day, the network is secured by economic incentives and game theory – a miner who acts appropriately could receive hundreds of thousands of dollars in rewards, while one who attempts to cheat the system will almost certainly be left with nothing but a huge electricity bill.

In the next three sections, we'll dive deeper into how blockchains, smart contracts and consesus mining work... :point\_right:
