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. Echarts 有点难度的柱状图

    本次的难点在于交叉传数据,又要把四组20个不同日期 显示上! 先看效果图: 数据传递方式:图 function func_echarts_2ba() { var echarts_2bar = echa ...

  2. 一:Jquery-selector

    一:jQuery概述 1.基本功能 a.访问和操作DOM元素:获取元素,修改其样式和内容,删除元素,复制元素... b.对页面事件的处理:不需要指定事件中的函数名,直接在事件中绑定响应函数(匿名函数) ...

  3. 一:Bootstrap-css样式

    页面大块布局: div.container 栅格系统: 一行分成 12 列 div.row div.col-md-12 div.col-xs-12 <div class="row&qu ...

  4. java虚拟机的内存机制

    我们都知道,java程序的跨平台性离不开java虚拟机,虚拟机隔绝了底层操作系统,使得java程序可以直接运行在虚拟机之上.所以,对java的学习,离不开对java虚拟机的学习与了解.下面简单整理下j ...

  5. php and js to facebook登陆 最佳实践

    Facebook Login Flow & Best Practices Best practice for Facebook login flow with the JavaScript S ...

  6. String 简单使用

    package com.direct.str; public class TestObject { /** * @param args */ /* * 1.object类是根类,里面定义的==和equ ...

  7. Django实现数据库中表格的增删查改

    1.urls.py """Django_demo1 URL Configuration The `urlpatterns` list routes URLs to vie ...

  8. LOJ572: Misaka Network 与求和

    传送门 假设 \(f^k(i)\) 就是 \(f(i)\) 莫比乌斯反演得到 \[ans=\sum_{i=1}^{N}\lfloor\frac{N}{i}\rfloor^2\sum_{d|i}f(d) ...

  9. BZOJ P1188 HNOI2007 分裂游戏——solution

    题目描述: (<--这个) 组合游戏,——把每个石头看做一个游戏, Multi_game——消去i上的石子后,,k上的游戏又多了一个: 于是就套用multi_game的模型即可 求解SG函数时, ...

  10. java三元运算符

    由?:符号表示的,具体的含义其实就和if-else结构的含义差不多,这种运算符会将某个条件作两种处理,如果满足条件的话就执行第一个结果,如果不满足的话就执行另外一个结果,例如: Int A,B,C;  ...