ethereumjs/ethereumjs-vm-2-API文档
https://github.com/ethereumjs/ethereumjs-vm/blob/master/docs/index.md
vm.runBlockchain
Processes blocks and adds them to the blockchain
处理区块并将其添加到区块链中
Parameters输入参数
blockchain
Blockchain A blockchain that to process 一个处理的区块链cb
Function the callback function 回调函数
VM
VM Class, new VM(opts)
creates a new VM object
VM类,VM(opts)
将创建一个VM对象,运行起来实现的感觉与ganache相似
Parameters输入参数
opts
Objectopts.stateManager
StateManager aStateManager
instance to use as the state store (Beta API) 用于状态存储的StateManager
实例(还在实验阶段)其实这个就是区块上的state merkle-patricia树,用于存储区块上的所有账户的信息opts.state
Trie a merkle-patricia-tree instance for the state tree (ignored if stateManager is passed) 用于状态树的一个merkle-patricia树(如果上面的stateManager已经传递,这个就可以忽略)opts.blockchain
Blockchain a blockchain object for storing/retrieving blocks (ignored if stateManager is passed) 为了存储/检索区块的区块链对象(如果上面的stateManager已经传递,这个就可以忽略)opts.chain
(String | Number) the chain the VM operates on [default: 'mainnet'] VM操作在那个链上(默认是mainnet链)opts.hardfork
String hardfork rules to be used [default: 'byzantium', supported: 'byzantium', 'constantinople' (will throw on unsupported)] 使用的硬分支规则(默认是byzantium',还支持'byzantium', 'constantinople',如果输入的是不支持的将抛出错误)opts.activatePrecompiles
Boolean create entries in the state tree for the precompiled contracts 为了预编译合约在状态树上创建条目,其实就是在state merkle-patricia树上手动添加一些账户的信息,就跟ganache一样,一开始就有可用的账户opts.allowUnlimitedContractSize
Boolean allows unlimited contract sizes while debugging. By setting this totrue
, the check for contract size limit of 24KB (see EIP-170) is bypassed. (default:false
; ONLY set totrue
during debugging) 当调试时,允许不限制的合约大小。通过将其设置为true,来忽视合约大小设置为24KB的检查(细节看本博客ethereum/EIPs-170 Contract code size limit)。(默认为false,只在调试时设置为true)opts.emitFreeLogs
Boolean Changes the behavior of the LOG opcode, the gas cost of the opcode becomes zero and calling it using STATICCALL won't throw. (default:false
; ONLY set totrue
during debugging) 改变日志操作吗的行为,gas开销的操作码变为0,使用STATICCALL操作码调用它将抛出错误(默认为false,只有在调试时设置为true)
vm.runBlock
Processes the block
running all of the transactions it contains and updating the miner's account
处理区块,运行其中的所有交易并更新矿工账户
Parameters输入参数
opts
cb
runBlock~callback callback 回调函数
runBlock~callback
Callback for runBlock
method
runBlock
的回调
Type: Function
Parameters输入参数
error
Error an error that may have happened ornull 发生的错误或null
results
Objectresults.receipts
Array the receipts from the transactions in the block 区块中来自交易的receiptresults.results
Array 返回结果
vm.runTx
Process a transaction. Run the vm. Transfers eth. Checks balances.
处理交易。运行虚拟机。交易eth。查看余额。
Parameters输入参数
opts
opts.tx
Transaction aTransaction
to run 运行的交易opts.skipNonce
Boolean skips the nonce check 跳过nonce检查opts.skipBalance
Boolean skips the balance check 跳过余额检查opts.block
Block the block to which thetx
belongs, if no block is given a default one is created 交易属于的区块,如果没有,则创建一个默认块
cb
runTx~callback the callback 回调函数
runTx~callback
Callback for runTx
method
runTx
方法的回调
Type: Function
Parameters输入参数
error
Error an error that may have happened ornull
发生的错误或null
results
Objectresults.amountSpent
BN the amount of ether used by this transaction as abignum 被这个交易使用的ether的数量,BN格式
results.gasUsed
BN the amount of gas as abignum
used by the transaction 被这个交易使用的gas,BN格式results.gasRefund
BN the amount of gas as abignum
that was refunded during the transaction (i.e.gasUsed = totalGasConsumed - gasRefund
) 在交易中被退还的gas,BN格式(使用的gas = 总使用的gas - 退还的gas)
vm
VM contains the results from running the code, if any, as described invm.runCode(params, cb) 虚拟机,如果存在,包含通过运行代码得到的结果,就像
vm.runCode(params, cb)
所说
vm.runCode
Runs EVM code
运行以太坊虚拟机代码
Parameters输入参数
opts
Objectopts.account
Account theAccount
that the executing code belongs to. If omitted an empty account will be used 执行的代码属于的账户。如果省略则使用空账户opts.address
Buffer the address of the account that is executing this code. The address should be aBuffer
of bytes. Defaults to0 执行这个代码的账户的地址。地址应该是字节的buffer格式。默认为0
opts.block
Block theBlock
thetx
belongs to. If omitted a blank block will be used 这个交易属于的区块。如果省略则使用一个黑块opts.caller
Buffer the address that ran this code. The address should be aBuffer
of 20bits. Defaults to0 运行这个代码的地址。这个地址应该为20bits的buffer格式,默认为0
opts.code
Buffer the EVM code to run given as aBuffer 以buffer格式给出的用来运行的以太坊虚拟机的代码
opts.data
Buffer the input data 输入的数据opts.gasLimit
Buffer the gas limit for the code 这个代码使用的gas的限制opts.origin
Buffer the address where the call originated from. The address should be aBuffer
of 20bits. Defaults to0 这个调用起源的地址。
这个地址应该为20bits的buffer格式,默认为0
opts.value
Buffer the value in ether that is being sent toopt.address
. Defaults to0 被送给
opt.address
的ether。默认为0
cb
runCode~callback callback 回调函数
runCode~callback
Callback for runCode
method
runCode
方法的回调
Type: Function
Parameters输入参数
error
Error an error that may have happened ornull
发生的错误或null
results
Objectresults.gas
BN the amount of gas left 剩下的gas数量results.gasUsed
BN the amount of gas as abignum
the code used to run 以bignum
格式给出的这个代码用来运行的gas数量results.gasRefund
BN abignum
containing the amount of gas to refund from deleting storage values从删除的存储值中得到包含退还的gas的数量的大数results.selfdestruct
Object anObject
with keys for accounts that have selfdestructed and values for balance transfer recipient accounts 包含自我毁灭的账户密钥和转移接收账户余额的值的对象results.logs
Array anArray
of logs that the contract emitted 合约发出的日志数组results.exception
Number0
if the contract encountered an exception,1
otherwise 如果合约遇到了异常则为0,否则为1results.exceptionError
String aString
describing the exception if there was one 如果有异常则用来描述异常的字符串results.return
Buffer aBuffer
containing the value that was returned by the contract 包含被合约返回的值的buffer
Event: beforeBlock
The beforeBlock
event beforeBlock
事件
Type: Object
Properties属性
block
Block emits the block that is about to be processed 发出关于将要被处理的区块
Event: afterBlock
The afterBlock
event afterBlock
事件
Type: Object
Properties属性
result
Object emits the results of processing a block 发出处理的区块的结果
Event: beforeTx
The beforeTx
event
Type: Object
Properties
tx
Transaction emits the Transaction that is about to be processed 发出将要被处理的交易
Event: afterTx
The afterTx
event
Type: Object
Properties
result
Object result of the transaction 交易的结果
Event: step
The step
event for trace output追踪输出的step
事件
Type: Object
Properties
pc
Number representing the program counter 代表项目的计数opcode
String the next opcode to be ran 下一个运行的操作码gasLeft
BN amount of gasLeft 剩下的gas数量stack
Array anArray
ofBuffers
containing the stack 包含堆栈的Buffers
数组account
Account theAccount
which owns the code running 拥有运行代码的账户address
Buffer the address of theaccount 账户的地址
depth
Number the current number of calls deep the contract is 合约所在的目前的调用深度数memory
Buffer the memory of the VM as abuffer 虚拟机的内存
stateManager
StateManager aStateManager
instance (Beta API) 一个StateManager
实例
ethereumjs/ethereumjs-vm-2-API文档的更多相关文章
- Vuex的API文档
前面的话 本文将详细介绍Vuex的API文档 概述 import Vuex from 'vuex' const store = new Vuex.Store({ ...options }) [构造器选 ...
- geoserver整合swagger2支持自动生成API文档
网上各种博客都有关于swagger2集成到springmvc.springboot框架的说明,但作者在整合到geoserver中确碰到了问题,调试一番最后才解决,遂总结一下. swagger2集成只需 ...
- Java在DOS命令下的运行及其API文档制作过程
该文档主要描述java程序在DOS命令下的运行,以及一些常用的命令 常用DOS命令: d: 回车 盘符切换 dir(directory):列出当前目录下的文件以及文件夹 md (make direct ...
- 在ASP.NET Core Web API上使用Swagger提供API文档
我在开发自己的博客系统(http://daxnet.me)时,给自己的RESTful服务增加了基于Swagger的API文档功能.当设置IISExpress的默认启动路由到Swagger的API文档页 ...
- 利用sphinx为python项目生成API文档
sphinx可以根据python的注释生成可以查找的api文档,简单记录了下步骤 1:安装 pip install -U Sphinx 2:在需要生成文档的.py文件目录下执行sphinx-apido ...
- 如何使 WebAPI 自动生成漂亮又实用在线API文档
1.前言 1.1 SwaggerUI SwaggerUI 是一个简单的Restful API 测试和文档工具.简单.漂亮.易用(官方demo).通过读取JSON 配置显示API. 项目本身仅仅也只依赖 ...
- Android多媒体--MediaCodec 中文API文档
*由于工作需要,需要利用MediaCodec实现Playback及Transcode等功能,故在学习过程中翻译了Google官方的MediaCodec API文档,由于作者水平限制,文中难免有错误和不 ...
- 新手如何查看API文档?
Java API文档为例: 1:知道包名,可以在Overview里直接找到这个包,然后去查这个包下面的类和方法.2:知道类名和方法名,可以在Index.html里直接去找这个类或方法,然后查看.3:如 ...
- Bullet的学习资源(用Doxygen生成API文档)
Bullet 全称 Bullet Physics Library,是著名的开源物理引擎(可用于碰撞检测.刚体模拟.可变形体模拟),这里将bullet的学习资源整理一下,希望能帮助入门者少走弯路. 看下 ...
- [API]使用Blueprint来高雅的编写接口文档 前后端api文档,移动端api文档
网址:http://apiary.io/ 介绍:一款非常强大的前后端交互api设计编辑工具(编辑器采用Markdown类似的描述标记,非常高效),高颜值的api文档,还能生成多种语言的测试代码. 中文 ...
随机推荐
- [编程] C语言循环结构计算π的值
公式: 分析:首先,系数为正数的项的分母是4n-3(n为正数项的项数),为负数的项的分母为4n-1(n为负数项的项数),即分母的变化规律是1.3.5.7...的奇数数列,则第n项的分母为2n-1,第1 ...
- maven私服的搭建
前言: 为什么要有maven私服? 当我们在公司开发时,如果每个程序员都需要连接外网去下载maven的jar包,当同时开发时,就会造成网络资源浪费,因此,maven提出了私服的概念,当公司内部程序员进 ...
- 设置centos7.3的YUM源为国内阿里云源
CentOS系统更换软件安装源 第一步:备份你的原镜像文件,以免出错后可以恢复. mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/Cent ...
- oracle数据库字符集和客户端字符集(2%)是不同的,字符集转化可能会造成不可预期的后果
转载请在文章显眼位置注明出处:https://www.cnblogs.com/sunshine5683/p/10036321.html 今天在plsql连接oracle时候报错提示“数据库字符集和客户 ...
- HDU 1575 Tr A----矩阵相乘题。
Tr A Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submi ...
- nginx+uwsgi部署flask应用后只能在本机访问解决办法,ipv4 和ipv6
我的系统是centos7 nginx监听8888端口 在window下 :telnet 192.168.81.224 8888 发现连接不上, 端口22能连上 关闭224的防火墙就好了 syste ...
- js中的同步与异步的问题
前言 近来,总是忙于拿js写一些案例,因为是小白,并没有什么丰富的经验,对各个知识点把握也不是很全面,写起来真的是...一言难尽,太痛苦了= =.尤其是在写一些轮播的时候,里面需要用到定时器,而一旦用 ...
- 在 Ubuntu上使用 MySQL
MySQL 安装配置 https://help.ubuntu.com/12.04/serverguide/mysql.html MySQL Manual http://dev.mysql.com/do ...
- BZOJ3812: 主旋律
传送门 Sol 考虑容斥 强联通图反过来就是一些缩点后的 \(DAG\) 一个套路就是对出(入)度为 \(0\) 的点进行容斥 设 \(g_S,h_S\) 分别表示选了奇数个 \(0\) 入度和偶数个 ...
- 【VS2012】F5不能自动编译新修改
VS2012正常使用时,如果文件有修改,按F5运行时,会自动对修改的文件进行重新编译.今天遇到的情况却并没有.度娘了下,网上有相同的问题,解决办法是“工具->选项->项目和解决方案-> ...