Skip to Content
Mastering Ethereum
book

Mastering Ethereum

by Andreas M. Antonopoulos, Gavin Wood
December 2018
Intermediate to advanced
422 pages
11h 8m
English
O'Reilly Media, Inc.
Content preview from Mastering Ethereum

Appendix C. Ethereum EVM Opcodes and Gas Consumption

This appendix is based on the consolidation work done by the people of https://github.com/trailofbits/evm-opcodes as a reference for Ethereum VM (EVM) opcodes and instruction information licensed under the Apache License 2.0.

Table C-1. EVM opcodes and gas cost
Opcode Name Description Extra info Gas

0x00

STOP

Halts execution

-

0

0x01

ADD

Addition operation

-

3

0x02

MUL

Multiplication operation

-

5

0x03

SUB

Subtraction operation

-

3

0x04

DIV

Integer division operation

-

5

0x05

SDIV

Signed integer division operation (truncated)

-

5

0x06

MOD

Modulo remainder operation

-

5

0x07

SMOD

Signed modulo remainder operation

-

5

0x08

ADDMOD

Modulo addition operation

-

8

0x09

MULMOD

Modulo multiplication operation

-

8

0x0a

EXP

Exponential operation

-

10***

0x0b

SIGNEXTEND

Extend length of two’s complement signed integer

-

5

0x0c - 0x0f

Unused

Unused

-

0x10

LT

Less-than comparison

-

3

0x11

GT

Greater-than comparison

-

3

0x12

SLT

Signed less-than comparison

-

3

0x13

SGT

Signed greater-than comparison

-

3

0x14

EQ

Equality comparison

-

3

0x15

ISZERO

Simple NOT operator

-

3

0x16

AND

Bitwise AND operation

-

3

0x17

OR

Bitwise OR operation

-

3

0x18

XOR

Bitwise XOR operation

-

3

0x19

NOT

Bitwise NOT operation

-

3

0x1a

BYTE

Retrieve single byte from word

-

3

0x1b - 0x1f

Unused

Unused

-

0x20

SHA3

Compute Keccak-256 hash

-

30

0x21 - 0x2f

Unused

Unused

-

0x30

ADDRESS

Get address of currently ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Mastering Blockchain Programming with Solidity

Mastering Blockchain Programming with Solidity

Jitendra Chittoda
Hands-On Smart Contract Development with Solidity and Ethereum

Hands-On Smart Contract Development with Solidity and Ethereum

Kevin Solorio, Randall Kanna, David H. Hoover
Mastering Blockchain

Mastering Blockchain

Lorne Lantz, Daniel Cawrey

Publisher Resources

ISBN: 9781491971932Errata Page