ethereumjs/ethereumjs-vm-5-vm对象
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对象的更多相关文章
- vm.dirty_ratio & vm.dirty_background_ratio
https://lonesysadmin.net/2013/12/22/better-linux-disk-caching-performance-vm-dirty_ratio/ Better Lin ...
- 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 ...
- Java虚拟机性能监测工具Visual VM与OQL对象查询语言
1.Visual VM多合一工具 Visual VM是一个功能强大的多合一故障诊断和性能监控的可视化工具,它集成了多种性能统计工具的功能,使用 Visual VM 可以代替jstat.jmap.jha ...
- [VM workstation]VM workstation 中的虚拟机连不上网络
之前一直没有想到虚拟机连不上网络是VM workstationg 自身的原因. 突然在进入虚拟机时看见提示:VM 桥接网桥无法正常工作 于是便进入 编辑→虚拟网络编辑器 中将虚拟网卡都重置了一下就可以 ...
- Windows环境上装在VM,VM安装CentOS7
1.下载VM并且安装 VM下载地址:https://www.vmware.com/products/workstation-pro.html 来自百度经验的的一个密钥(VMware Workstati ...
- 02_css3.0 前端长度单位 px em rem vm vh vm pc pt in 你真的懂了吗?
1:废话不多说,直接看如下图表: 2:px就不过多介绍了,就是像素点的大小,加入您的屏幕分辨率为1920,则每一个相当于每一个有横着的1920个像素点: 3:em 为相对单位,一般以 body 内的 ...
- ethereumjs/ethereumjs-vm-2-API文档
https://github.com/ethereumjs/ethereumjs-vm/blob/master/docs/index.md vm.runBlockchain Processes blo ...
- ethereumjs/ethereumjs-vm-4-tests
根据代码发现还要了解的模块有: ethereumjs/merkle-patricia-tree -对应数据存储的数据结构 ethereumjs-blockchain —— 区块链 ethereumjs ...
- ethereumjs/ethereumjs-vm-1-简介
https://github.com/ethereumjs/ethereumjs-vm 其实这就是怎么自己使用该模块来生成一个类似geth客户端的以太坊虚拟机,然后进行各类区块链操作 SYNOPSIS ...
随机推荐
- centos ssh远程登陆
登录Centos6.5系统. ◆示例:使用root用户登录. 注:若为非root用户登录,输入执行某些命权限不够时需加sudo. 查看SSH是否安装. ◆输入命令:rpm -qa | grep s ...
- java:模拟栈操作
import java.util.ArrayList; public class MyStack { private ArrayList<Object> arrayList; public ...
- hdu 1251 统计难题 字典树第一题。
统计难题 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131070/65535 K (Java/Others)Total Submi ...
- HDU 2276 Kiki & Little Kiki 2 矩阵构造
Kiki & Little Kiki 2 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java ...
- K:java中的RMI(Remote Method Invocation)
相关介绍: RMI全称是Remote Method Invocation,即远程方法调用.它是一种计算机之间利用远程对象互相调用,从而实现双方通讯的一种通讯机制.使用这种机制,某一台计算机(虚拟机) ...
- 淘宝 NPM 镜像
使用说明 : 更多见 https://npm.taobao.org 你可以使用我们定制的 cnpm (gzip 压缩支持) 命令行工具代替默认的 npm: $ npm install -g cnpm ...
- this keyword details
学生类: package com.itheima_07; /* * 学生类 * * 起名字我们要求做到见名知意. * 而我们现在的代码中的n和a就没有做到见名知意,所以我要改进. * * 如果有局部变 ...
- [2014年学习计划之RoR系列] 第二步 – 熟悉Ruby语言 (2/n) Blocks and Iterators (代码块和迭代器)
[就算没有含金量,也请尊重原创, 转载自我的独立博客http://brucejia.net] Blocks and Iterators (代码块和迭代器) 代码块和迭代器是Ruby语言中比较有特点的东 ...
- Unihan(统汉字)常用字段介绍
0 背景 1 文件 1.1 IRG Sources 1.2 Dictionary Indices 1.3 Dictionary-like Data 1.4 Other Mappings 1.5 Rad ...
- 使用@Value进行静态常量的值注入
@Component public class ExpressConstant { public static String URL; @Value("${express.url}" ...