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. WPF月视图控件

    简介 在做一个应用时,需要做成日历月视图的形式.自己做较麻烦,于是上网找找看,在CodeProject上发现了这个Quick and Simple WPF Month-view Calendar,可是 ...

  2. 怎么实现Linux下的逆波兰计算器dc?

    #返回上一级 @Author: 张海拔 @Update: 2014-01-12 @Link: http://www.cnblogs.com/zhanghaiba/p/3516660.html /* * ...

  3. [LeetCode]Maximum Length of Repeated Subarray

    Maximum Length of Repeated Subarray: Given two integer arrays A and B, return the maximum length of ...

  4. hdu 3474 Necklace 单调队列

    Necklace Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Su ...

  5. h5的classList对象

    H5新增属性classList h5中新增了一个classList,原生js可以通过它来判断获取dom节点有无某个class. classList是html元素对象的成员,它的使用非常简单,比如 co ...

  6. CSS绝对定位属性

    position - 类型:用于确定定位的类型,共有绝对(absolute).相对(relative)和静态(static)等3种选择. z-index - Z轴:用于控制网页中块元素的叠放顺序,可为 ...

  7. LintCode2016年8月8日算法比赛----中序遍历和后序遍历构造二叉树

    中序遍历和后序遍历构造二叉树 题目描述 根据中序遍历和后序遍历构造二叉树 注意事项 你可以假设树中不存在相同数值的节点 样例 给出树的中序遍历: [1,2,3] 和后序遍历: [1,3,2] 返回如下 ...

  8. ContentProvider与ContentResolver

    使用ContentProvider共享数据: 当应用继承ContentProvider类,并重写该类用于提供数据和存储数据的方法,就可以向其他应用共享其数据.虽然使用其他方法也可以对外共享数据,但数据 ...

  9. CentOS7安装minio

    [root@localhost ~]# wget https://dl.minio.io/server/minio/release/linux-amd64/minio -bash: wget: 未找到 ...

  10. 爬虫day03之scrapy安装与使用

    参考博客 技术问题不要问,业务问题可以问是不是有一种更好的方法? scrapy windows安装 1. 安装scrapy 参考博客 https://www.cnblogs.com/wupeiqi/a ...