evm指令集手册
evm指令集手册
Opcodes
结果列为"-"表示没有运算结果(不会在栈上产生值),为"*"是特殊情况,其他都表示运算产生唯一值,并放在栈顶.
mem[a...b] 表示内存中a到b(不包含b)个字节
storage[p] 表示从p开始的32个字节
谨记evm虚拟机的word(字)是256位32字节
| 操作码 | 结果 | 注释 |
|---|---|---|
| stop | - | stop execution, identical to return(0,0) |
| add(x, y) | x + y | |
| sub(x, y) | x - y | |
| mul(x, y) | x * y | |
| div(x, y) | x / y | |
| sdiv(x, y) | x / y, for signed numbers in two’s complement | |
| mod(x, y) | x % y | |
| smod(x, y) | x % y, for signed numbers in two’s complement | |
| exp(x, y) | x to the power of y | |
| not(x) | ~x, every bit of x is negated | |
| lt(x, y) | 1 if x < y, 0 otherwise | |
| gt(x, y) | 1 if x > y, 0 otherwise | |
| slt(x, y) | 1 if x < y, 0 otherwise, for signed numbers in two’s complement | |
| sgt(x, y) | 1 if x > y, 0 otherwise, for signed numbers in two’s complement | |
| eq(x, y) | 1 if x == y, 0 otherwise | |
| iszero(x) | 1 if x == 0, 0 otherwise | |
| and(x, y) | bitwise and of x and y | |
| or(x, y) | bitwise or of x and y | |
| xor(x, y) | bitwise xor of x and y | |
| byte(n, x) | nth byte of x, where the most significant byte is the 0th byte | |
| addmod(x, y, m) | (x + y) % m with arbitrary precision arithmetics | |
| mulmod(x, y, m) | (x * y) % m with arbitrary precision arithmetics | |
| signextend(i, x) | sign extend from (i*8+7)th bit counting from least significant | |
| keccak256(p, n) | keccak(mem[p...(p+n))) | |
| sha3(p, n) | keccak(mem[p...(p+n))) | |
| jump(label) | - | jump to label / code position |
| jumpi(label, cond) | - | jump to label if cond is nonzero |
| pc | current position in code | |
| pop(x) | - | remove the element pushed by x |
| dup1 ... dup16 | copy ith stack slot to the top (counting from top) | |
| swap1 ... swap16 | * | swap topmost and ith stack slot below it |
| mload(p) | mem[p..(p+32)) | |
| mstore(p, v) | - | mem[p..(p+32)) := v |
| mstore8(p, v) | - | mem[p] := v & 0xff - only modifies a single byte |
| sload(p) | storage[p] | |
| sstore(p, v) | - | storage[p] := v |
| msize | size of memory, i.e. largest accessed memory index | |
| gas | gas still available to execution | |
| address | address of the current contract / execution context | |
| balance(a) | wei balance at address a | |
| caller | call sender (excluding delegatecall) | |
| callvalue | wei sent together with the current call | |
| calldataload(p) | call data starting from position p (32 bytes) | |
| calldatasize | size of call data in bytes | |
| calldatacopy(t, f, s) | - | copy s bytes from calldata at position f to mem at position t |
| codesize | size of the code of the current contract / execution context | |
| codecopy(t, f, s) | - | copy s bytes from code at position f to mem at position t |
| extcodesize(a) | size of the code at address a | |
| extcodecopy(a, t, f, s) | - | like codecopy(t, f, s) but take code at address a |
| returndatasize | size of the last returndata | |
| returndatacopy(t, f, s) | - | copy s bytes from returndata at position f to mem at position t |
| create(v, p, s) | create new contract with code mem[p..(p+s)) and send v wei and return the new address | |
| create2(v, n, p, s) | create new contract with code mem[p..(p+s)) at address keccak256( . n . keccak256(mem[p..(p+s))) and send v wei and return the new address | |
| call(g, a, v, in, insize, out, outsize) | call contract at address a with input mem[in..(in+insize)) providing g gas and v wei and output area mem[out..(out+outsize)) returning 0 on error (eg. out of gas) and 1 on success | |
| callcode(g, a, v, in, insize, out, outsize) | identical to call but only use the code from a and stay in the context of the current contract otherwise | |
| delegatecall(g, a, in, insize, out, outsize) | identical to callcode but also keep caller and callvalue | |
| staticcall(g, a, in, insize, out, outsize) | identical to call(g, a, 0, in, insize, out, outsize) but do not allow state modifications | |
| return(p, s) | - | end execution, return data mem[p..(p+s)) |
| revert(p, s) | - | end execution, revert state changes, return data mem[p..(p+s)) |
| selfdestruct(a) | - | end execution, destroy current contract and send funds to a |
| invalid | - | end execution with invalid instruction |
| log0(p, s) | - | log without topics and data mem[p..(p+s)) |
| log1(p, s, t1) | - | log with topic t1 and data mem[p..(p+s)) |
| log2(p, s, t1, t2) | - | log with topics t1, t2 and data mem[p..(p+s)) |
| log3(p, s, t1, t2, t3) | - | log with topics t1, t2, t3 and data mem[p..(p+s)) |
| log4(p, s, t1, t2, t3, t4) | - | log with topics t1, t2, t3, t4 and data mem[p..(p+s)) |
| origin | transaction sender | |
| gasprice | gas price of the transaction | |
| blockhash(b) | hash of block nr b - only for last 256 blocks excluding current | |
| coinbase | current mining beneficiary | |
| timestamp | timestamp of the current block in seconds since the epoch | |
| number | current block number | |
| difficulty | difficulty of the current block | |
| gaslimit | block gas limit of the current block |
其中call,callcode,delegatecall,staticcall非常重要,要搞清楚,才能理解evm的执行模型.
evm指令集手册的更多相关文章
- 以太坊系列之十三: evm指令集
evm指令集手册 Opcodes 结果列为"-"表示没有运算结果(不会在栈上产生值),为"*"是特殊情况,其他都表示运算产生唯一值,并放在栈顶. mem[a.. ...
- 备份下ESP8266的AT指令集手册和用例手册中文版,准备为V7做几个ESP8266的例子
指令集手册:https://files.cnblogs.com/files/armfly/4a-esp8266_at_instruction_set_cn.rar 用例手册: https://file ...
- 死磕以太坊源码分析之EVM指令集
死磕以太坊源码分析之EVM指令集 配合以下代码进行阅读:https://github.com/blockchainGuide/ 写文不易,给个小关注,有什么问题可以指出,便于大家交流学习. 以下指令集 ...
- Intel CPU MMX SSE SSE2/3/4指令集手册下载URL
在线查看的网址: https://software.intel.com/sites/landingpage/IntrinsicsGuide/ Intel® 64 and IA-32 Architect ...
- 【原创】Linux环境下的图形系统和AMD R600显卡编程(11)——R600指令集
1 低级着色语言tgsi OpenGL程序使用GLSL语言对可编程图形处理器进行编程,GLSL语言(以下高级着色语言就是指GLSL)是语法类似C的高级语言,在GLSL规范中,GLSL语言被先翻译成教低 ...
- EVM 2.0 预览版,跃见非凡,源于鸿蒙,开启物联网小程序新时代
1. 基于EVUE的物联网小程序 EVM诞生以来,一直致力于让物联网开发变得简单,自鸿蒙OS 1.0 发布后,最引人注目的莫过于华为在应用程序开发框架层面面向应用开发者提供了一种全新的开发方式: 框架 ...
- 浅谈被加壳ELF(即android的so文件)的调试
本文只讨论如何调试被加壳的ELF文件,包括调试中的技巧运用及调试过程中可能遇到的问题的解决方法,不包含如何还原加固的DEX本文将以某加壳程序和某加固为目标. 一.ELF格式简介 ELF全称:Execu ...
- Android安全研究经验谈
安全研究做什么 从攻击角度举例,可以是:对某个模块进行漏洞挖掘的方法,对某个漏洞进行利用的技术,通过逆向工程破解程序.解密数据,对系统或应用进行感染.劫持等破坏安全性的攻击技术等. 而防御上则是:查杀 ...
- 0ctf-pwn_warmup-re_mips4
Warmup(2) 程序很小,读写操作直接通过int 80h系统调用完成.栈溢出漏洞很明显,能溢出20字节.提示由于沙盒的保护只能来读取/home/warmup/flag文件.那么思路就很清楚了,打开 ...
随机推荐
- 一个监控oracle数据库某个字段值变化并发送邮件报警的脚本
talk is cheap,here is the code: #!/bin/sh export ORACLE_HOME=/u01/app/oracle/product//client_1/ expo ...
- 【转】关于大型网站技术演进的思考(十九)--网站静态化处理—web前端优化—上(11)
网站静态化处理这个系列马上就要结束了,今天我要讲讲本系列最后一个重要的主题web前端优化.在开始谈论本主题之前,我想问大家一个问题,网站静态化处理技术到底是应该归属于web服务端的技术范畴还是应该归属 ...
- docker持续集成部署、csphere监控平台【转:http://blog.csdn.net/java_dyq/article/details/51997024】
为什么使用Docker “ 从我个人使用的角度讲的话 部署来的更方便 只要构建过一次环境 推送到镜像仓库 迁移起来也是分分钟的事情 虚拟化让集群的管理和控制部署都更方便 hub.docker.com ...
- UOJ 58 (树上带修改的莫队)
UOJ 58 糖果公园 Problem : 给一棵n个点的树,每个点上有一种颜色,对于一条路径上的点,若 i 颜色第 j 次出现对该路径权值的贡献为 w[i] * c[j], 每次询问一条路径的权值, ...
- hdu 2736 Average distance
传送门 Average distance Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Oth ...
- 蓝桥杯 算法训练 最短路 [ 最短路 bellman ]
传送门 算法训练 最短路 时间限制:1.0s 内存限制:256.0MB 锦囊1 锦囊2 锦囊3 问题描述 给定一个n个顶点,m条边的有向图(其中某些边权可能为负,但保证 ...
- 钱币兑换问题---hdu1284(完全背包)
Problem Description 在一个国家仅有1分,2分,3分硬币,将钱N兑换成硬币有很多种兑法.请你编程序计算出共有多少种兑法. Input 每行只有一个正整数N,N小于32768. ...
- topcoder 650 srm
500 遇到这种构造题 就给跪了 比赛的时候想很多方法 DP,贪心,模拟 发现越写越烦琐.看到别人出这么快,肯定又是奇葩思路. 后来居然想到 2^50的暴力 +剪枝 不过暴力肯定卡你 IDEA: 只要 ...
- Java连接MySQL报错:CommunicationsException: Communications link failure
现象: 报错:Exception in thread "main" com.mysql.cj.jdbc.exceptions.CommunicationsException: Co ...
- Tomcat可以实现Session共享方案
说明:原来Tomcat也是可以实现Session共享的,这样大大减少的硬编码的实现,并且前面用Nginx分流时不用考虑Session的问题,因为是Web容器提供了Session共享的支持. 1.在每个 ...