12.8 Bitcoins and Blockchains
221
and electric power needed to mine bitcoins is subject to criticism, in particular, when
considering the many unsuccesfully competiting miners. The resulting carbon footprint of the bitcoin network is rather large, mainly due to the proof-of-work scheme
used in the competitive mining process.
Modern blockchain-based networks address some of the criticism and additionally
provide more features than the bitcoin network. Ethereum is one of these modern
networks.
12.9 Ethereum and Smart Contracts
The Ethereum cryptocurrency [15, 16] maintains its own blockchain as a database.
The infrastructure with nodes to maintain and store the blockchain, miners to attach
new blocks to the blockchain, and clients that initiate transactions, is similar to
that of Bitcoin. However, apart from only recording transactions in the underlying
currency, called ether, the Ethereum blockchain stores program code and data. The
data can be changed under the control of the code or through regular transactions, but
only after recording the changes on the blockchain through the mining process. The
code stored on the blockchain can never be changed retroactively, which makes it
particularly trustworthy. One can, for example, use it to automatically transfer funds,
provided that certain conditions, which are laid out in the program code, are fulfilled.
Such a coded set of rules is commonly referred to as a smart contract. It is publicly
accessible, anyone can see the rules, yet nobody can change them.
Like Bitcoin, Ethereum uses the secp256k1 elliptic curve to sign the transactions,
but uses the modern Keccak256 hashing function to calculate hashes. We point out
that Keccak256 has some minor differences compared to the SHA-3 hash, which
contains modifications by US government organizations [16]. Moreover, the proofof-work algorithm is based on ethash [15], which requires substantial memory and
bandwidth. The distinguishing feature of Ethereum is the Ethereum virtual machine
(EVM). It provides a runtime environment for the smart contracts, which are stored
in an intermediate byte-code format. In this way the code runs on the EVM, independent of the hardware of a computer. This is analogous to the way that the JAVA
®
runtime environment allows the execution of compiled JAVA programs. The instructions supported by the EVM are Turing complete; any algorithm that can be encoded
in computer instructions can also be coded for the EVM. This includes, for example, infinite loops. They are, however, prevented by requiring the caller of the smart
contract, either a human-controlled wallet or another contract, to pay for the execution with gas, which is directly convertible to ether. Every instruction, such as
adding two numbers and every access to memory costs some gas. Thus, an infinite
loop would come to a halt, because it runs out of gas. An out-of-gas event reverts
all actions of the contract, while the miner keeps all initially allocated gas. Under
normal circumstances, once a contract is triggered, a miner runs the contract without
problems, updates the blockchain, and receives the used gas as reward.
Précédent

- 229/292

Suivant