1.运行文件

var Buffer = require('safe-buffer').Buffer // use for Node.js <4.5.0
var VM = require('./index.js') // create a new VM instance
var vm = new VM({chain : 'rinkeby'})//设置连接的为Rinkeby链
console.log(vm);

2.分析返回的vm对象:

VM {
opts: { chain: 'rinkeby' },
_common:
Common {
_chainParams:
{ name: 'rinkeby',
chainId: ,
networkId: ,
comment: 'PoA test network',
url: 'https://www.rinkeby.io',
genesis:
{ hash:
'0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177',
timestamp: '0x58ee40ba',
gasLimit: ,
difficulty: ,
nonce: '0x0000000000000000',
extraData:
'0x52657370656374206d7920617574686f7269746168207e452e436172746d616e42eb768f2244c8811c63729a21a3569731535f067ffc57839b00206d1ad20c69a1981b489f772031b279182d99e65703f0076e4812653aab85fca0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
stateRoot:
'0x53580584816f617295ea26c0e17641e0120cab2f0a8ffb53a866fd53aa8e8c2d' },
hardforks:
[ { name: 'chainstart', block: , consensus: 'poa', finality: null },
{ name: 'homestead', block: , consensus: 'poa', finality: null },
{ name: 'dao', block: null, consensus: 'poa', finality: null },
{ name: 'tangerineWhistle',
block: ,
consensus: 'poa',
finality: null },
{ name: 'spuriousDragon',
block: ,
consensus: 'poa',
finality: null },
{ name: 'byzantium',
block: ,
consensus: 'poa',
finality: null },
{ name: 'constantinople',
block: null,
consensus: 'poa',
finality: null },
{ name: 'hybridCasper',
block: null,
consensus: 'poa',
finality: 'pos' } ],
bootstrapNodes:
[ { ip: '52.169.42.101',
port: ,
id:
'a24ac7c5484ef4ed0c5eb2d36620ba4e4aa13b8c84684e1b4aab0cebea2ae45cb4d375b77eab56516d34bfbd3c1a833fc51296ff084b770b94fb9028c4d25ccf',
location: 'IE',
comment: '' },
{ ip: '52.3.158.184',
port: ,
id:
'343149e4feefa15d882d9fe4ac7d88f885bd05ebb735e547f12e12080a9fa07c8014ca6fd7f373123488102fe5e34111f8509cf0b7de3f5b44339c9f25e87cb8',
location: '',
comment: 'INFURA' } ] },
_hardfork: 'byzantium',
_supportedHardforks: [ 'byzantium', 'constantinople' ] },
stateManager:
StateManager {
_common:
Common {
_chainParams:
{ name: 'rinkeby',
chainId: ,
networkId: ,
comment: 'PoA test network',
url: 'https://www.rinkeby.io',
genesis:
{ hash:
'0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177',
timestamp: '0x58ee40ba',
gasLimit: ,
difficulty: ,
nonce: '0x0000000000000000',
extraData:
'0x52657370656374206d7920617574686f7269746168207e452e436172746d616e42eb768f2244c8811c63729a21a3569731535f067ffc57839b00206d1ad20c69a1981b489f772031b279182d99e65703f0076e4812653aab85fca0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
stateRoot:
'0x53580584816f617295ea26c0e17641e0120cab2f0a8ffb53a866fd53aa8e8c2d' },
hardforks://从这里可以看出到哪个区块使用的是哪个硬分叉的类型
[ { name: 'chainstart', block: , consensus: 'poa', finality: null },//第0个,即初始区块使用的是chainstart
{ name: 'homestead', block: , consensus: 'poa', finality: null },//第一个区块使用的是homestead
{ name: 'dao', block: null, consensus: 'poa', finality: null },//没有使用这种硬分叉类型
{ name: 'tangerineWhistle',//第二个区块使用的是tangerineWhistle
block: ,
consensus: 'poa',
finality: null },
{ name: 'spuriousDragon',//从三个区块到第1035300使用的是spuriousDragon
block: ,
consensus: 'poa',
finality: null },
{ name: 'byzantium',//从第1035301个区块到后面使用的都是该硬分叉,现在同步到的区块应该都是第1035301个区块之后的区块了,所以应该满足的都是byzantium硬分叉
block: ,
consensus: 'poa',
finality: null },
{ name: 'constantinople',//没有使用这种硬分叉类型
block: null,
consensus: 'poa',
finality: null },
{ name: 'hybridCasper',//没有使用这种硬分叉类型
block: null,
consensus: 'poa',
finality: 'pos' } ],
bootstrapNodes://该区块链是通过连接该bootstrapNodes节点对应的区块链得到的,它会同步该节点上至今的所有区块,然后就能够在该Rinkeby区块链上进行操作了
[ { ip: '52.169.42.101',
port: ,
id:
'a24ac7c5484ef4ed0c5eb2d36620ba4e4aa13b8c84684e1b4aab0cebea2ae45cb4d375b77eab56516d34bfbd3c1a833fc51296ff084b770b94fb9028c4d25ccf',
location: 'IE',
comment: '' },
{ ip: '52.3.158.184',
port: ,
id:
'343149e4feefa15d882d9fe4ac7d88f885bd05ebb735e547f12e12080a9fa07c8014ca6fd7f373123488102fe5e34111f8509cf0b7de3f5b44339c9f25e87cb8',
location: '',
comment: 'INFURA' } ] },
_hardfork: 'byzantium',
_supportedHardforks: [ 'byzantium', 'constantinople' ] },//设置的只支持的硬分叉
_trie:
SecureTrie {
EMPTY_TRIE_ROOT:
<Buffer e8 1f 1b cc a6 ff e6 c0 f8 6e 5b e0 1b 6c ad c0 2f b5 e3 b4 >,
sem:
{ capacity: ,
current: ,
............................. buffer: true,
type: 'ucs-2' },
utf16le:
{ encode: [Function: encode],
decode: [Function: decode],
buffer: true,
type: 'utf16le' },
'utf-16le':
{ encode: [Function: encode],
decode: [Function: decode],
buffer: true,
type: 'utf-16le' } } },
_status: 'opening',
location: '',
db:
DeferredLevelDOWN {
location: '',
status: 'new',
_db: undefined,
_operations: [],
_iterators: [] } } ],
_root:
<Buffer e8 1f 1b cc a6 ff e6 c0 f8 6e 5b e0 1b 6c ad c0 2f b5 e3 b4 >,
_scratch: null,
_checkpoints: [],
checkpoint: [Function: checkpoint],
commit: [Function: commit],
revert: [Function: revert],
_enterCpMode: [Function: _enterCpMode],
_exitCpMode: [Function: _exitCpMode],
createScratchReadStream: [Function: createScratchReadStream],
copy: [Function: bound copy],
get: [Function: bound get],
put: [Function: bound put],
del: [Function: bound del] } },
_touched: Set {},
_touchedStack: [],
_checkpointCount: },
blockchain:
{ fake: true,
getBlock: [Function: getBlock],
delBlock: [Function: delBlock],
iterator: [Function: iterator] },
allowUnlimitedContractSize: false,
emitFreeLogs: false,
_precompiled:
{ '': [Function],
'': [Function],
'': [Function],
'': [Function],
'': [Function],
'': [Function],
'': [Function],
'': [Function] },
_events: [Object: null prototype] {},
_eventsCount: ,
_maxListeners: undefined }

从上面得知url: 'https://www.rinkeby.io',到该网站一查看:

1)其提供的连接该Rinkeby链的方法为:

https://www.rinkeby.io/#geth

geth --datadir=$HOME/.rinkeby init rinkeby.json

geth --networkid= --datadir=$HOME/.rinkeby --cache= --syncmode=full --ethstats='yournode:Respect my authoritah!@stats.rinkeby.io' --bootnodes=enode://a24ac7c5484ef4ed0c5eb2d36620ba4e4aa13b8c84684e1b4aab0cebea2ae45cb4d375b77eab56516d34bfbd3c1a833fc51296ff084b770b94fb9028c4d25ccf@52.169.42.101:30303

和vm返回对象中的bootstrapNodes值是相同的

2)从其提供的rinkeby.json-构造初始区块的文件得到:

{"config":{"chainId":,"homesteadBlock":,"eip150Block":,"eip150Hash":"0x0000000000000000000000000000000000000000000000000000000000000000","eip155Block":,"eip158Block":,"byzantiumBlock":,"clique":{"period":,"epoch":}},"nonce":"0x0","timestamp":"0x58ee40ba","extraData":"0x52657370656374206d7920617574686f7269746168207e452e436172746d616e42eb768f2244c8811c63729a21a3569731535f067ffc57839b00206d1ad20c69a1981b489f772031b279182d99e65703f0076e4812653aab85fca0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","gasLimit":"0x47b760","difficulty":"0x1","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","coinbase":"0x0000000000000000000000000000000000000000",.....

其的各个部署信息extraData、timestamp、gasLimit、difficulty等值都是相同的,说明vm上的区块链的初始区块和这个Rinkeby链的初始区块相同

从其byzantiumBlock、homesteadBlock值中设置的硬分叉位置也与vm上的区块链的硬分叉配置相同

综上所述,说明设置的区块链连接的就是这个Rinkeby链,所以在该vm上交易或构建合约实际上就是运行在这个Rinkeby测试网络上

ethereumjs/ethereumjs-vm-5-vm对象的更多相关文章

  1. vm.dirty_ratio & vm.dirty_background_ratio

    https://lonesysadmin.net/2013/12/22/better-linux-disk-caching-performance-vm-dirty_ratio/ Better Lin ...

  2. Better Linux Disk Caching & Performance with vm.dirty_ratio & vm.dirty_background_ratio

    In previous posts on vm.swappiness and using RAM disks we talked about how the memory on a Linux gue ...

  3. Java虚拟机性能监测工具Visual VM与OQL对象查询语言

    1.Visual VM多合一工具 Visual VM是一个功能强大的多合一故障诊断和性能监控的可视化工具,它集成了多种性能统计工具的功能,使用 Visual VM 可以代替jstat.jmap.jha ...

  4. [VM workstation]VM workstation 中的虚拟机连不上网络

    之前一直没有想到虚拟机连不上网络是VM workstationg 自身的原因. 突然在进入虚拟机时看见提示:VM 桥接网桥无法正常工作 于是便进入 编辑→虚拟网络编辑器 中将虚拟网卡都重置了一下就可以 ...

  5. Windows环境上装在VM,VM安装CentOS7

    1.下载VM并且安装 VM下载地址:https://www.vmware.com/products/workstation-pro.html 来自百度经验的的一个密钥(VMware Workstati ...

  6. 02_css3.0 前端长度单位 px em rem vm vh vm pc pt in 你真的懂了吗?

    1:废话不多说,直接看如下图表: 2:px就不过多介绍了,就是像素点的大小,加入您的屏幕分辨率为1920,则每一个相当于每一个有横着的1920个像素点: 3:em 为相对单位,一般以 body 内的 ...

  7. ethereumjs/ethereumjs-vm-2-API文档

    https://github.com/ethereumjs/ethereumjs-vm/blob/master/docs/index.md vm.runBlockchain Processes blo ...

  8. ethereumjs/ethereumjs-vm-4-tests

    根据代码发现还要了解的模块有: ethereumjs/merkle-patricia-tree -对应数据存储的数据结构 ethereumjs-blockchain —— 区块链 ethereumjs ...

  9. ethereumjs/ethereumjs-vm-1-简介

    https://github.com/ethereumjs/ethereumjs-vm 其实这就是怎么自己使用该模块来生成一个类似geth客户端的以太坊虚拟机,然后进行各类区块链操作 SYNOPSIS ...

随机推荐

  1. megajson 高性能的json序列化、反序列化工具

    go 自带的 encoding/json 支持json的序列化和反序列化, 然而它是基于反射的,有下面几个缺点: 反射是性能差的代名词, 并且无法在编译时进行优化. 只有 Public 字段才可以,反 ...

  2. 基于SSH框架下登录验证码模块的实现

    1.前端页面代码: 主要以jQuery的ajax异步请求实现. ... <script type="text/javascript" src="${pageCont ...

  3. Jquery获取radio选中的值

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  4. BZOJ2568 [国家集训队2012]比特集合

    Description 比特集合是一种抽象数据类型(Abstract Data Type) ,其包含一个集合S,并支持如下几种操作: INS M : 将元素 M 插入到集合S中: DEL M : 将集 ...

  5. LeetCode赛题392---- Is Subsequence

    392. Is Subsequence Given a string s and a string t, check if s is subsequence of t. You may assume ...

  6. 八、angularjs 中 filter在controller中的使用--避免多次遍历

    filter在html页面的使用司空见惯,比如: filter在controller中使用可以避免多次使用angular.foreach,来进行遍历.例如: 如果使用filter,则会让代码简洁而且明 ...

  7. centos虚拟机网卡配置

    连接模式为NAT

  8. sql server2008安装时提示重启计算机失败怎么办?

    在键盘上按下组合键[Win]+[R],调出运行窗口. 在窗口中输入“regedit”,点击确定,打开注册表管理界面. 在注册表左侧目录栏中找到如下位置:“HKEY_LOCAL_MACHINE\SYST ...

  9. Python标准库:内置函数hasattr() getattr() setattr() 函数使用方法详解

    hasattr(object, name) 本函数是用来判断对象object的属性(name表示)是否存在.如果属性(name表示)存在,则返回True,否则返回False.参数object是一个对象 ...

  10. 第一个c程序和vs2017 在打开MFC rc文件时找不到rcdll.dl

    第一个c程序 #include<stdio.h> int main() { ; ; printf_s("请输入两个数字:"); scanf_s("%d,%d& ...