ethereumjs/browser-builds
https://github.com/ethereumjs/browser-builds
ethereumjs - Browser Builds
This repository contains browser builds of the following ethereumjs libraries:
这个存储库包含以下ethereumjs库的浏览器构建(其实就是将下面的ethereumjs库构造成浏览器能够使用的js文件形式)
- ethereumjs-vm
- ethereumjs-tx
- ethereumjs-wallet
- ethereumjs-wallet-hd
- ethereumjs-wallet-thirdparty
- ethereumjs-icap
- ethereumjs-abi
- ethereumjs-all
They are built using browserify with a known set of working dependencies.
使用带着具有一组已知的工作依赖项的browserify来构建
For every library/build collection there is a larger plain source version also including the source mappings (e.g. ethereumjs-vm-x.x.x.js) and a minified version for use in production (e.g. ethereumjs-vm-x.x.x.min.js).
这里对每个库/构建收集有一个更大的包含资源映射(比如ethereumjs-vm-x.x.x.js) 的纯资源版本,以及在生产时使用的简化版本 (比如ethereumjs-vm-x.x.x.min.js)
Note注意:
This repository was just lately (October 2017) revived. Currently all builds are considered experimental in terms of API stability, functionality and security!
这个存储库最近(2017/10)才恢复使用。目前,从API的稳定性、功能和安全性来看,所有构建都是实验性的
Usage使用
In your web application, include only one of the builds from the dist directory. All exports will be available under the global ethereumjs.
在你的web应用中,只包含来自dist目录之一的构建。在全局变量ethereumjs下,所有的构建都是可用的
Note: all packages expect ECMAScript 6 (ES6) as a minimum environment. From browsers lacking ES6 support, please use a shim (like es6-shim) before including any of the builds from this repo.
注意:所有包都期待使用 ECMAScript 6 (ES6) 作为最小的环境。如果浏览器缺少ES6支持,从该存储库中包含任何构建之前,请使用shim(like es6-shim)
Examples例子
Examples for usage of the browser builds can be found in the examples directory:
vm.html
<!doctype html> <html lang="en">
<head>
<meta charset="utf-8">
<title>EthereumJS VM - Browser Example</title>
</head> <body>
<script src="../dist/ethereumjs-vm/ethereumjs-vm-2.3.1.js"></script> <script>
var vm = new ethereumjs.VM() var code = '7f4e616d65526567000000000000000000000000000000000000000000000000003055307f4e616d6552656700000000000000000000000000000000000000000000000000557f436f6e666967000000000000000000000000000000000000000000000000000073661005d2720d855f1d9976f88bb10c1a3398c77f5573661005d2720d855f1d9976f88bb10c1a3398c77f7f436f6e6669670000000000000000000000000000000000000000000000000000553360455560df806100c56000396000f3007f726567697374657200000000000000000000000000000000000000000000000060003514156053576020355415603257005b335415603e5760003354555b6020353360006000a233602035556020353355005b60007f756e72656769737465720000000000000000000000000000000000000000000060003514156082575033545b1560995733335460006000a2600033545560003355005b60007f6b696c6c00000000000000000000000000000000000000000000000000000000600035141560cb575060455433145b1560d25733ff5b6000355460005260206000f3' console.log('Code to be run in the VM:')
console.log(code) vm.on('step', function (data) {
console.log(data.opcode.name)
}) vm.runCode({
code: ethereumjs.Buffer.Buffer.from(code, 'hex'),
gasLimit: ethereumjs.Buffer.Buffer.from('ffffffff', 'hex')
}, function (err, results) {
console.log('returned: ' + results.return.toString('hex'))
console.log('gasUsed: ' + results.gasUsed.toString())
console.log(err)
})
</script>
</body>
</html>
Start an http-server from the main directory of the repository to run the examples in the browser.
从存储库的主目录开启 http-server去在浏览器中运行该例子
Build构建
Builds are done using the .js exports compilation files from the src/ directory and using the build.js script from the main directory to create the build in the dist/ folder.
构建的完成需要先从src/文件夹中使用.js输出编译文件,然后使用来自主目录的build.js脚本在dist/文件夹中创建构建
Version numbers for the builds are directly extracted from the versions installed in the local node_modules folder.
构建的版本数目直接从安装在本地的node_modules文件夹的版本中抽取出。
For creating new builds:为了创建新的构建
- Change
package.jsonto require desired/up-to-date versions of the libraries 改变package.json去获取想要的/最新版本的库
package.json
{
"private": true,
"name": "browser-builds",
"version": "0.0.0",
"description": "Browser builds of ethereumjs libraries.",
"scripts": {
"build": "node build.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ethereumjs/browser-builds.git"
},
"keywords": [
"ethereum",
"browser"
],
"author": "Alex Beregszaszi <alex@rtfs.hu>",
"license": "MIT",
"bugs": {
"url": "https://github.com/ethereumjs/browser-builds/issues"
},
"homepage": "https://github.com/ethereumjs/browser-builds#readme",
"dependencies": {//这里写了所有的库,你可以根据你自己的需求进行删减,并更改相应的版本
"ethereumjs-abi": "^0.6.2",
"ethereumjs-icap": "^0.3.1",
"ethereumjs-tx": "^1.3.1",
"ethereumjs-units": "^0.2.0",
"ethereumjs-vm": "^2.3.0",
"ethereumjs-wallet": "^0.6.0"
},
"devDependencies": {
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"babelify": "^7.3.0",
"browserify": "^14.4.0",
"uglifyify": "^4.0.4"
}
}
2.Reinstall/update local node_modules packages 重新安装/更新本地node_modules包
运行npm install
3.Run npm run build to generate new set of builds 运行npm run build命令去生成新构建集
返回:
userdeMBP:browser-builds-master user$ npm run build > browser-builds@0.0. build /Users/user/browser-builds-master
> node build.js ***ethereumjs-all***
Creating debug version package dist/ethereumjs-all/ethereumjs-all---.js
Creating minified package dist/ethereumjs-all/ethereumjs-all---.min.js ***ethereumjs-vm***
Creating debug version package dist/ethereumjs-vm/ethereumjs-vm-2.5..js
Creating minified package dist/ethereumjs-vm/ethereumjs-vm-2.5..min.js ***ethereumjs-tx***
Creating debug version package dist/ethereumjs-tx/ethereumjs-tx-1.3..js
Creating minified package dist/ethereumjs-tx/ethereumjs-tx-1.3..min.js ***ethereumjs-icap***
Omitting debug version package dist/ethereumjs-icap/ethereumjs-icap-0.3..js (file exists)
Omitting minified package dist/ethereumjs-icap/ethereumjs-icap-0.3..min.js (file exists) ***ethereumjs-wallet***
Creating debug version package dist/ethereumjs-wallet/ethereumjs-wallet-0.6..js
Creating minified package dist/ethereumjs-wallet/ethereumjs-wallet-0.6..min.js ***ethereumjs-wallet-hd***
Creating debug version package dist/ethereumjs-wallet-hd/ethereumjs-wallet-hd-0.6..js ***ethereumjs-abi***
Omitting debug version package dist/ethereumjs-abi/ethereumjs-abi-0.6..js (file exists)
Omitting minified package dist/ethereumjs-abi/ethereumjs-abi-0.6..min.js (file exists)
Creating minified package dist/ethereumjs-wallet-hd/ethereumjs-wallet-hd-0.6..min.js ***ethereumjs-wallet-thirdparty***
Creating debug version package dist/ethereumjs-wallet-thirdparty/ethereumjs-wallet-thirdparty-0.6..js
Creating minified package dist/ethereumjs-wallet-thirdparty/ethereumjs-wallet-thirdparty-0.6..min.js
然后你的dist文件夹下就会得到你想要的构建了,然后你就能够在页面端使用这些构建了,就像上面的例子一样
ethereumjs/browser-builds的更多相关文章
- ethjs-1-了解
https://github.com/ethjs/ethjs/blob/master/docs/user-guide.md Install npm install --save ethjs Usage ...
- 18 个最好的CSS框架用于提高开发效率
根据维基百科,CSS框架是事先准备好的库,是为了让使用层叠样式表语言来美化网页更容易,更符合标准.在这篇文章中,我们已经收集了一些现成的框架,这将使你减少你的任务流程和代码.我们希望你会发现列表中的方 ...
- 前端工程师应该都了解的16个最受欢迎的CSS框架
摘要: 今天给大家分享16个最受欢迎的CSS框架.这些是根据笔者的爱好以及相关查阅规整出来的.可能还有一些更棒的或者您更喜欢的没有列举出来.如果有,欢迎留言! Pure : CSS Framework ...
- ethereumjs/ethereumjs-tx
https://github.com/ethereumjs/ethereumjs-tx A simple module for creating, manipulating and signing e ...
- Graded Browser Support
( The YUI Target Environments Matrix is here) About the Browser Test Baseline and Operating Systems ...
- Activating Browser Modes with Doctype
原文地址:https://hsivonen.fi/doctype/ In order to deal both with content written according to Web standa ...
- Tech Stuff - Mobile Browser ID (User-Agent) Strings
Tech Stuff - Mobile Browser ID (User-Agent) Strings The non-mobile stuff is here (hint: you get jerk ...
- ethereumjs/ethereumjs-wallet
Utilities for handling Ethereum keys ethereumjs-wallet A lightweight wallet implementation. At the m ...
- ethereumjs/ethereumjs-icap
https://github.com/ethereumjs/ethereumjs-icap ethereumjs-icap 安装: npm install ethereumjs-icap --save ...
随机推荐
- Java学习--Calendar 类的应用
Calendar 类的应用 Date 类最主要的作用就是获得当前时间,同时这个类里面也具有设置时间以及一些其他的功能,但是由于本身设计的问题,这些方法却遭到众多批评,不建议使用,更推荐使用 Calen ...
- Java学习--Java 中的包装类
Java 中的包装类 相信各位小伙伴们对基本数据类型都非常熟悉,例如 int.float.double.boolean.char 等.基本数据类型是不具备对象的特性的,比如基本类型不能调用方法.功能简 ...
- java虚拟机的内存机制
我们都知道,java程序的跨平台性离不开java虚拟机,虚拟机隔绝了底层操作系统,使得java程序可以直接运行在虚拟机之上.所以,对java的学习,离不开对java虚拟机的学习与了解.下面简单整理下j ...
- final的作用
前言 一直想写写这个话题.代表公司也面试过一些求职者,每次面试我必问的两个问题之一 就是“请你谈一谈对于final关键字的理解”.这是一个简单的小问题,但是不要小看它,通过对这个问题的回答以及一些简单 ...
- Golang把所有包括底层类库,输出到stderr的内容, 重新定向到一个日志文件里面?
不论应用是如何部署的,我们都期望能扑捉到应用的错误日志, 解决思路: 自己写代码处理异常拦截,甚至直接在main函数中写异常拦截. stderr重定向到某个文件里 使用 syscall.Dup2 第一 ...
- 一款软件同时管理MySQL,MongoDB数据库
互联网应用开发日新月异,去年分布式应用都还大量使用springmvc+ zookeeper +dubbo,今年就被spring boot ,spring cloud微服务架构替换了,技术的更新换代太快 ...
- 【转】老生常谈-从输入url到页面展示到底发生了什么
今天看到了一篇很详细地解释了从输入url到页面展示过程的文章,好文章不能错过,所以转到自己这里来了. 原文地址:老生常谈-从输入url到页面展示到底发生了什么 以下为原文: 刚开始写这篇文章还是挺纠结 ...
- <!DOCTYPE> 标签是什么
DOCTYPE 标签,是html文档的类型声明(document type declaration,所谓声明,也就是宣称我他妈是谁),用来告诉浏览器,使用什么样的文档类型定义(Document Typ ...
- 中国国内 - 可用API合集
中国国内 - 可用API合集 收录一篇中国国内可用API合集,分享给大家 目录 笔记 出行 词典 电商 地图 电影 即时通讯 开发者网站 快递查询 旅游 社交 视频 天气 团队协作 图片与图像处理 外 ...
- Python爬虫教程-07-post介绍(百度翻译)(上)
Python爬虫教程-07-post介绍(百度翻译)(上) 访问网络两种方法 get: 利用参数给服务器传递信息 参数为dict,使用parse编码 post :(今天给大家介绍的post) 一般向服 ...