DEV Community

Cover image for What Is Ethereum? The Basics
grin2b for Focused Labs

Posted on • Updated on

What Is Ethereum? The Basics

The Basics

Ethereum is a network of computers which collectively form the Ethereum Virtual Machine (EVM), which updates the state of the Ethereum blockchain. A blockchain is a publicly available and distributed database, which acts as the memory of the EVM. One role of this memory is acting as a ledger, saying who owns how much Ether, the cryptocurrency supported by the Ethereum network. The computers participating in this network are called “nodes” or “miners”, and the computational power they contribute is what keeps the EVM running. For their work, they are rewarded with Ether, hence the term “miners”. The EVM can also run programs called “smart contracts”, which are programs stored on the blockchain and run on the EVM.

Blockchain

A blockchain is a publicly available and distributed database, which is stored and kept up to date by all of the computers which form the EVM. These computers are also known as “miners”. The “blocks” in the blockchain refer to blocks of transactions/state updates, and the “chain” refers to how the current state of the blockchain is the end result of a chain of those blocks. The EVM adds blocks of transactions to the blockchain by attacking a cryptographic algorithm with brute force, using the computers participating in the network. When the transactions are processed, the current state of the blockchain is updated to reflect the changes in those transactions.

Cryptocurrency

A cryptocurrency is a digital asset, whose ownership is kept track of in a blockchain. This is called a distributed ledger, and it designates how much cryptocurrency (in this case, Ether) belongs to each address. Because the blockchain is distributed and publicly available, everyone can see how much cryptocurrency belongs to each address. Owners of that cryptocurrency can send their coins to other addresses, in order to make purchases, send coins to friends, or send coins to exchanges to sell those coins for fiat (USD, EUR, etc.). Owners are able to control the coins they hold by using the private key for their address, a number of 32 random bytes, to generate a transaction on the Ethereum network. For those familiar with cryptographic algorithms, the address can be thought of as a public key, and the private key can be thought of as a private key. (If you lose your private key, the coins in your address are locked away forever!) When transactions are placed on the Ethereum network to be processed, they are confirmed and finalized by miners.

Mining

Mining is how blocks of transactions are added to the blockchain. The computing power lent by nodes on the Ethereum network are used to ensure that transactions placed on the Ethereum network are valid, and once they are validated, they are placed on the blockchain. This validation occurs by having miners run a brute force attack against the combination of the existing blockchain and the data from the new block, to see whether they can guess an 8 byte value which can be verified as coming from the private key. This value is called a “signature”, and it has this name because even though the same private key(s) are used to generate that signature, the signature will be wildly different if the transactions on the block are even slightly different. The public key is used in the algorithm that verifies whether the signature generated by a miner is a valid match, and once the puzzle of finding that signature has been solved, the miner announces to the network that it has validated a block to be added to the blockchain. Other miners can validate this claim extremely quickly, and when a majority of miners come to a consensus, that block is added to the blockchain. The use of the public key in validating transactions is what protects the network from a bad actor placing fraudulent transactions on the blockchain: A bad actor cannot add a fraudulent block of transactions to the blockchain, because they can’t generate a valid signature for a given public key (i.e. address) without the corresponding secret key.[1] The miner which found the solution is rewarded with some Ether to incentivize participation in the network. This Ether is called a “tip”, and is a portion of the “gas”, i.e., a fee paid by the originator of the transaction to compensate the miners for executing that transaction. This type of process is called a “consensus mechanism”, since it is a way by which participants in the network come to a consensus as to which transactions are valid. The particular consensus mechanism described here is called “Proof-of-work”, since the miner is providing a valid signature, i.e., a proof of the work it has performed. There is another consensus mechanism on the Ethereum network called “proof-of-stake”, which is not discussed here.

Smart Contracts, aka DApps

So far, everything that has been described about Ethereum mining is more-or-less the same as Bitcoin, alongside many other cryptocurrencies. What sets Ethereum apart (alongside other networks such as Solana or Polkadot) is its ability to execute smart contracts, aka “decentralized applications” or “DApps”. To quote the Ethereum docs, “A ‘smart contract’ is simply a program that runs on the Ethereum blockchain. It's a collection of code (its functions) and data (its state) that resides at a specific address on the Ethereum blockchain.”[3] Smart contracts are written in languages like Solidity and Vyper, and any given smart contract can execute any other smart contract and so forth.[4] Data used by smart contracts can either be stored on the blockchain, which lets it persist after a given execution of a smart contract; or it can be stored in memory, which is much cheaper, although the data disappear once the execution is completed.[5] Example uses of smart contracts include decentralized finance (“DeFi”), non-fungible tokens (“NFTs”), and literal contracts for legal agreements, such as real estate, marriage, or corporate ownership, since the rules of the contract can be written in code, and signing the contract requires the secure keys of all parties involved.[6]

Takeaway

Ethereum is a network running a virtual computer, called the Ethereum Virtual Machine. To store data in memory, the EVM uses a blockchain, which is a distributed and publicly available database. The native cryptocurrency of Ethereum is called Ether. To add data to the blockchain, this computer uses mining, which is a cryptographic brute force attack to ensure that only valid transactions are added to the blockchain. Ethereum also supports smart contracts, which are computer programs uploaded onto the blockchain, which can be executed in a similar fashion to how transactions are added to the network. These smart contracts can store data on the blockchain, and they can call one another, resulting in potentially complex programs. Smart contracts have many current uses in finance, identifying ownership, and legal agreements.

Discussion (0)