Transition to Web3 - Course 4 | How Smart Contracts Work
But, wait! How can the miners run the code?
Actually, virtual machines run the code. All nodes install a virtual machine that helps them run smart contracts. Think of the virtual machine as a distributed computer that everyone has access to—its role is to run the code.
💅 Fun fact: These virtual machines are called different names by different blockchains. For example, Ethereum network calls them “Ethereum Virtual Machines” (EVMs) while Solana calls them "Expected Execution Environments" (EEEs).