Virtual machine
A virtual machine, often called a VM, is software that simulates a computer or provides an environment for running code. In crypto, this kind of environment executes smart contracts according to a set of rules.
What is a virtual machine?
There are two main types. A system VM is a virtual computer with its own operating system. Multiple virtual computers like this can share the same physical computer.
A process VM isn’t a complete computer. It’s mainly a specific environment where code runs. The rules of that environment determine what the code can and can’t do.
In crypto, a VM usually works like this second type. For example, the Ethereum Virtual Machine, or EVM, executes smart contracts. A smart contract is code that automatically performs a task defined in advance.
An example of a virtual machine
Someone sends a transaction to a smart contract to send tokens. The EVM then executes the contract’s code.
The VM checks the conditions in the code. If everything checks out, the contract can update the stored balances. The transaction uses gas to perform these calculations.
Why are virtual machines important in crypto?
A blockchain VM ensures that different nodes, or computers in the network, execute the same code in the same way. That means the same input should always produce the same result.
That’s why you may come across terms like VM or EVM in discussions about Ethereum, smart contracts, or other programmable blockchains. It means the network can execute code, so it can do more than just send crypto.
A VM and consensus have different roles. The VM determines what a transaction does technically. Consensus ensures that the network agrees on which transactions and results are accepted. Computation and storage in blockchain VMs are also limited and can incur costs.