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. 三、synchronized同步锁

    一.简介 在Java多线程中,我们要实现同步串行最早接触的就是synchronized关键字. 基本语法如下: synchronized(锁) { // 代码块 } sychronized关键字的锁主 ...

  2. 添加FB登陆时,需要curl扩展

    安装curl扩展遇到一个傻逼问题 [root@xxx openssl]# /usr/local/php/bin/phpizeCannot find config.m4.Make sure that y ...

  3. linux-ubuntu安装配置uwsgi

    参考原文 对于 Python2.x 版本:(测试通过) 第一步:sudo apt-get install python-dev 第二步:sudo apt-get install python-pip  ...

  4. protobuf版本冲突

    在编译chromium代码的过程中发现,官方推荐使用的版本是ubuntu16.04,但是这个版本的ubuntu比较老旧,一些库都比较老了,但是google自己用的部分却是挺新的,protobuf就是一 ...

  5. JQuery 更改属性 JQ对象循环 each 全选反选 三元运算

    <!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  6. Mongodb安装详解及mongochef视图工具安装。

    按照国际惯例我们先来介绍一下MongoDB. MongoDB是一个基于分布式文件存储的数据库,由c++语言编写,为WEB应用提供可扩展的高性能数据存储解决方案.MongoDB属于非关系数据库,也不能说 ...

  7. 使用ArcGIS Chef Cookbook轻松搞掂WebGIS平台部署

    1.安装Chef Client v12版本. 2.复制arcgis cookbook资源到Chef安装目录. 3.考虑到一般部署的服务器环境无法连接互联网,所以需要事先部署ArcGIS Cookboo ...

  8. js作用域链以及全局变量和局部变量

    > [带var] > 在当前作用于中声明了一个变量,如果当前是全局作用域,也相当于给全局作用域设置了一个属性叫做a ```javascript //=>变量提升:var a; < ...

  9. Software Testing Techniques LAB 01: test Junit and Eclemma

    1. Installing  1. Install Junit and hamcrest First, I download the Junit-4.12.jar and hamcrest-core- ...

  10. C#中的特殊数据类型

    一.c#中的特殊数据类型 C#中特殊数据类型有class类型.结构类型.数组类型.枚举类型.集合类型.委托类型.事件.Lambda表达式.接口类型. 1.class类型 1.1类定义 class St ...