evm opcode

2024-04-18 12:18
文章标签 opcode evm

本文主要是介绍evm opcode,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

看到有其他博主的转载的操作码的列表,但是还是不够直观。也有可能是直接从solidity的官方网获取过来的,导致描述部分并没有严格的给出参数的划分。一下内容转载至​​​​​​Opcodes for the EVM | ethereum.orgA list of all available opcodes for the Ethereum virtual machine.https://ethereum.org/zh/developers/docs/evm/opcodes

 这部分的内容对调试交易,和深入理解evm 蛮重要的,发布到这里方便以后自己查看

StackNameGasInitial StackResulting StackMem / StorageNotes
00STOP0halt execution
01ADD3a, ba + b(u)int256 addition modulo 2**256
02MUL5a, ba * b(u)int256 multiplication modulo 2**256
03SUB3a, ba - b(u)int256 addition modulo 2**256
04DIV5a, ba // buint256 division
05SDIV5a, ba // bint256 division
06MOD5a, ba % buint256 modulus
07SMOD5a, ba % bint256 modulus
08ADDMOD8a, b, N(a + b) % N(u)int256 addition modulo N
09MULMOD8a, b, N(a * b) % N(u)int256 multiplication modulo N
0AEXPA1a, ba ** buint256 exponentiation modulo 2**256
0BSIGNEXTEND5b, xSIGNEXTEND(x, b)sign extend x from (b+1) bytes to 32 bytes
0C-0Finvalid
10LT3a, ba < buint256 less-than
11GT3a, ba > buint256 greater-than
12SLT3a, ba < bint256 less-than
13SGT3a, ba > bint256 greater-than
14EQ3a, ba == b(u)int256 equality
15ISZERO3aa == 0(u)int256 iszero
16AND3a, ba && bbitwise AND
17OR3a, ba \|\| bbitwise OR
18XOR3a, ba ^ bbitwise XOR
19NOT3a~abitwise NOT
1ABYTE3i, x(x >> (248 - i * 8)) && 0xFFith byte of (u)int256 x, from the left
1BSHL3shift, valval << shiftshift left
1CSHR3shift, valval >> shiftlogical shift right
1DSAR3shift, valval >> shiftarithmetic shift right
1E-1Finvalid
20SHA3A2ost, lenkeccak256(mem[ost:ost+len])keccak256
21-2Finvalid
30ADDRESS2.address(this)address of executing contract
31BALANCEA5addraddr.balancebalance, in wei
32ORIGIN2.tx.originaddress that originated the tx
33CALLER2.msg.senderaddress of msg sender
34CALLVALUE2.msg.valuemsg value, in wei
35CALLDATALOAD3idxmsg.data[idx:idx+32]read word from msg data at index idx
36CALLDATASIZE2.len(msg.data)length of msg data, in bytes
37CALLDATACOPYA3dstOst, ost, len.mem[dstOst:dstOst+len] := msg.data[ost:ost+lencopy msg data
38CODESIZE2.len(this.code)length of executing contract's code, in bytes
39CODECOPYA3dstOst, ost, len.mem[dstOst:dstOst+len] := this.code[ost:ost+len]copy executing contract's bytecode
3AGASPRICE2.tx.gaspricegas price of tx, in wei per unit gas **
3BEXTCODESIZEA5addrlen(addr.code)size of code at addr, in bytes
3CEXTCODECOPYA4addr, dstOst, ost, len.mem[dstOst:dstOst+len] := addr.code[ost:ost+len]copy code from addr
3DRETURNDATASIZE2.sizesize of returned data from last external call, in bytes
3ERETURNDATACOPYA3dstOst, ost, len.mem[dstOst:dstOst+len] := returndata[ost:ost+len]copy returned data from last external call
3FEXTCODEHASHA5addrhashhash = addr.exists ? keccak256(addr.code) : 0
40BLOCKHASH20blockNumblockHash(blockNum)
41COINBASE2.block.coinbaseaddress of miner of current block
42TIMESTAMP2.block.timestamptimestamp of current block
43NUMBER2.block.numbernumber of current block
44DIFFICULTY2.block.difficultydifficulty of current block
45GASLIMIT2.block.gaslimitgas limit of current block
46CHAINID2.chain_idpush current chain id onto stack
47SELFBALANCE5.address(this).balancebalance of executing contract, in wei
48BASEFEE2.block.basefeebase fee of current block
49-4Finvalid
50POP2_anon.remove item from top of stack and discard it
51MLOAD3*ostmem[ost:ost+32]read word from memory at offset ost
52MSTORE3*ost, val.mem[ost:ost+32] := valwrite a word to memory
53MSTORE83*ost, val.mem[ost] := val && 0xFFwrite a single byte to memory
54SLOADA6keystorage[key]read word from storage
55SSTOREA7key, val.storage[key] := valwrite word to storage
56JUMP8dst.$pc := dst mark that pc is only assigned if dst is a valid jumpdest
57JUMPI10dst, condition.$pc := condition ? dst : $pc + 1
58PC2.$pcprogram counter
59MSIZE2.len(mem)size of memory in current execution context, in bytes
5AGAS2.gasRemaining
5BJUMPDEST1mark valid jump destinationa valid jump destination for example a jump destination not inside the push data
5C-5Finvalid
60PUSH13.uint8push 1-byte value onto stack
61PUSH23.uint16push 2-byte value onto stack
62PUSH33.uint24push 3-byte value onto stack
63PUSH43.uint32push 4-byte value onto stack
64PUSH53.uint40push 5-byte value onto stack
65PUSH63.uint48push 6-byte value onto stack
66PUSH73.uint56push 7-byte value onto stack
67PUSH83.uint64push 8-byte value onto stack
68PUSH93.uint72push 9-byte value onto stack
69PUSH103.uint80push 10-byte value onto stack
6APUSH113.uint88push 11-byte value onto stack
6BPUSH123.uint96push 12-byte value onto stack
6CPUSH133.uint104push 13-byte value onto stack
6DPUSH143.uint112push 14-byte value onto stack
6EPUSH153.uint120push 15-byte value onto stack
6FPUSH163.uint128push 16-byte value onto stack
70PUSH173.uint136push 17-byte value onto stack
71PUSH183.uint144push 18-byte value onto stack
72PUSH193.uint152push 19-byte value onto stack
73PUSH203.uint160push 20-byte value onto stack
74PUSH213.uint168push 21-byte value onto stack
75PUSH223.uint176push 22-byte value onto stack
76PUSH233.uint184push 23-byte value onto stack
77PUSH243.uint192push 24-byte value onto stack
78PUSH253.uint200push 25-byte value onto stack
79PUSH263.uint208push 26-byte value onto stack
7APUSH273.uint216push 27-byte value onto stack
7BPUSH283.uint224push 28-byte value onto stack
7CPUSH293.uint232push 29-byte value onto stack
7DPUSH303.uint240push 30-byte value onto stack
7EPUSH313.uint248push 31-byte value onto stack
7FPUSH323.uint256push 32-byte value onto stack
80DUP13aa, aclone 1st value on stack
81DUP23_, aa, _, aclone 2nd value on stack
82DUP33_, _, aa, _, _, aclone 3rd value on stack
83DUP43_, _, _, aa, _, _, _, aclone 4th value on stack
84DUP53..., aa, ..., aclone 5th value on stack
85DUP63..., aa, ..., aclone 6th value on stack
86DUP73..., aa, ..., aclone 7th value on stack
87DUP83..., aa, ..., aclone 8th value on stack
88DUP93..., aa, ..., aclone 9th value on stack
89DUP103..., aa, ..., aclone 10th value on stack
8ADUP113..., aa, ..., aclone 11th value on stack
8BDUP123..., aa, ..., aclone 12th value on stack
8CDUP133..., aa, ..., aclone 13th value on stack
8DDUP143..., aa, ..., aclone 14th value on stack
8EDUP153..., aa, ..., aclone 15th value on stack
8FDUP163..., aa, ..., aclone 16th value on stack
90SWAP13a, bb, a
91SWAP23a, _, bb, _, a
92SWAP33a, _, _, bb, _, _, a
93SWAP43a, _, _, _, bb, _, _, _, a
94SWAP53a, ..., bb, ..., a
95SWAP63a, ..., bb, ..., a
96SWAP73a, ..., bb, ..., a
97SWAP83a, ..., bb, ..., a
98SWAP93a, ..., bb, ..., a
99SWAP103a, ..., bb, ..., a
9ASWAP113a, ..., bb, ..., a
9BSWAP123a, ..., bb, ..., a
9CSWAP133a, ..., bb, ..., a
9DSWAP143a, ..., bb, ..., a
9ESWAP153a, ..., bb, ..., a
9FSWAP163a, ..., bb, ..., a
A0LOG0A8ost, len.LOG0(memory[ost:ost+len])
A1LOG1A8ost, len, topic0.LOG1(memory[ost:ost+len], topic0)
A2LOG2A8ost, len, topic0, topic1.LOG1(memory[ost:ost+len], topic0, topic1)
A3LOG3A8ost, len, topic0, topic1, topic2.LOG1(memory[ost:ost+len], topic0, topic1, topic2)
A4LOG4A8ost, len, topic0, topic1, topic2, topic3.LOG1(memory[ost:ost+len], topic0, topic1, topic2, topic3)
A5-EFinvalid
F0CREATEA9val, ost, lenaddraddr = keccak256(rlp([address(this), this.nonce]))
F1CALLAAgas, addr, val, argOst, argLen, retOst, retLensuccessmem[retOst:retOst+retLen] := returndata
F2CALLCODEAAgas, addr, val, argOst, argLen, retOst, retLensuccessmem[retOst:retOst+retLen] = returndatasame as DELEGATECALL, but does not propagate original msg.sender and msg.value
F3RETURN0*ost, len.return mem[ost:ost+len]
F4DELEGATECALLAAgas, addr, argOst, argLen, retOst, retLensuccessmem[retOst:retOst+retLen] := returndata
F5CREATE2A9val, ost, len, saltaddraddr = keccak256(0xff ++ address(this) ++ salt ++ keccak256(mem[ost:ost+len]))[12:]
F6-F9invalid
FASTATICCALLAAgas, addr, argOst, argLen, retOst, retLensuccessmem[retOst:retOst+retLen] := returndata
FB-FCinvalid
FDREVERT0*ost, len.revert(mem[ost:ost+len])
FEINVALIDAFdesignated invalid opcode - EIP-141
FFSELFDESTRUCTABaddr.destroy contract and sends all funds to addr

这篇关于evm opcode的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/914758

相关文章

【无线通信】误差矢量幅度(EVM)

误差矢量幅度 (Error Vector Magnitude, EVM) 是一种用来评估数字通信系统中调制质量的重要指标。EVM 衡量的是理想信号与实际接收信号之间的差异,通常用来评估调制质量、信号完整性和接收机性能。 EVM的定义 在一个数字通信系统中,理想情况下接收到的信号应该精确地落在特定的理想星座点上(比如 QAM 或 PSK 星座图)。然而,由于各种现实因素,如噪声、失真、非线性效应

Covalent Network(CQT)长期数据设施,支持基于 “blob” 方案、总锁仓价值达 54 亿美元的头部EVM L2

Covalent Network(CQT)是领先的历史数据可用性网络,通过其在 Web3 中超过 225 个区块链上的结构化数据基础设施,为数千名客户和开发人员提供支持。Covalent Network(CQT)正在与未来以太坊的进步需求相匹配,尤其是考虑到以太坊改进提案 4844(EIP-4844)的情况下。凭借强大的基础设施,用户和开发人员可以从不断增长的数据库中获取大量可验证的结构化数据

区块链笔记:EVM的作用,EVM与字节码,EVM与共识验证,EVM的执行结构

EVM的作用 EVM: Ethereum Virtual Machine 以太坊虚拟机在以太坊上如果我们要转账, 部署智能合约, 调用智能合约都是EVM来执行EVM是在以太坊上的作用 是以太坊节点的功能引擎执行以太坊交易事务部署、执行智能合约每一个节点都有独立的EVM 每个节点都有一个自己的EVM每一个节点都会一致的执行同样的事务把智能程序部署这个动作广播到其他的节点其他节点接收到这个事务以后会

TL437x-EVM开发板硬件说明书

Revision History Draft Date Revision No. Description 2018/2/24 V2.1 开发板版本更新。文档格式校订,硬件更新,替换图片。 2016/5/26 V1.1 排版修改。 2015/8/20 V1.0 初始版本。     目 录 前    言 3 1 处理器 4 2 FLASH 4 3 RAM 5 4

TLA7-EVM开发板的EEPROM、电源接口和拔码开关

TLA7-EVM开发板是一款由广州创龙基于Xilinx Artix-7系列FPGA自主研发的核心板+底板方式的开发板,可快速评估FPGA性能。核心板尺寸仅70mm*50mm,底板采用沉金无铅工艺的6层板设计,专业的PCB Layout保证信号完整性的同时,经过严格的质量控制,满足工业环境应用。 SOM-TLA7核心板引出FPGA全部资源信号引脚,二次开发极其容易,客户只需要专注上层应用,大大降低

TLA7-EVM开发板硬件说明(2)

JTAG下载器接口 可以通过JTAG接口(CON2)烧写程序和进行调试。CON2接口包含了完整14pin JTAG标准信号,硬件及引脚定义如下图:   图 7 图 8   LED指示灯 核心板上有,1个是供电指示灯LED0,2个用户指示灯(LED1~LED2),硬件如下图:   图 9   开发板具有1个供电指示灯LED0,4个用户指示灯,它们分别是L

广州创龙TLK7-EVM开发板介绍

开发板简介 Ø 基于Xilinx Kintex-7系列高性价比FPGA处理器; Ø FPGA芯片型号为XC7K325T-2FFG676I,兼容XC7K160T/410T-2FFG676I,NOR FLASH 256Mbit,DDR3 512M/1GByte可选,方便用户二次开发使用; Ø 逻辑单元326K个,DSP Slice 840个,8对高速串行收发器,每通道通信速率高达12.5Gbi

TLK7-EVM是一款基于Xilinx Kintex-7系列FPGA自主研发的核心板+底板方式的开发板

前 言 TLK7-EVM是一款由广州创龙基于Xilinx Kintex-7系列FPGA自主研发的核心板+底板方式的开发板,可快速评估FPGA性能。核心板尺寸仅80mm*58mm,底板采用沉金无铅工艺的6层板设计,专业的PCB Layout保证信号完整性的同时,经过严格的质量控制,满足工业环境应用。 SOM-TLK7核心板引出FPGA丰富的资源信号引脚,二次开发极其容易,客户只需要专注上层应用

TL335x-EVM开发板硬件说明书(2)

串口 开发板上共引出了3个串口,分别为CON4、CON6、CON8,其中CON4为Micro USB调试串口(UART3)、CON6为RS232串口(UART0)、CON8为RS485串口(UART1)。其硬件位置及原理图如下图所示:   表 1 串口名称 开发板位置 串口说明 Micro USB CON4 通过CH340芯片转成Micro USB接口 RS232 CON

TL335x-EVM开发板硬件说明书(1)

处理器 TI Sitara AM335x是一款高性能嵌入式32位工业级Cortex-A8处理器,主频可高达1GHz,运算能力可高达2000DMIPS,搭配DDR3,兼容eMMC和NAND FLASH,拥有多种工业接口资源,以下是AM335x CPU资源框图:   图 1   FLASH FLASH采用512M/1GByte NAND FLASH或4GByte eMMC,硬件位置如