Building-Blockchain-Projects:Packt发布的用于构建区块链项目的代码存储库

  • y1_736367
    了解作者
  • 3.5MB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-10 01:56
    上传日期
建立区块链项目 这是发布的的代码存储库。 它包含从头到尾完成本书所必需的所有支持项目文件。 关于这本书 本书将教您什么是区块链,如何维护数据完整性以及如何使用以太坊创建现实世界的区块链项目。 通过有趣的现实世界项目,您将学到如何编写完全按编程方式运行,没有任何欺诈,审查或第三方干扰机会的智能合约,并为区块链构建端到端应用程序。 您将学习诸如加密货币中的加密,以太安全性,挖掘,智能合约和可靠性之类的概念。 ##说明和导航所有代码都组织在文件夹中。 每个文件夹均以数字开头,后跟应用程序名称。 例如,Chapter02。 第1、2、3章没有任何代码文件。 第1章是简介,第2章是设置,第3章具有最少的一个班级代码。 该代码将如下所示: var solc = require("solc"); var input = "contract x { function g() {} }"; va
Building-Blockchain-Projects-master.zip
内容介绍
![bignumber.js](https://raw.githubusercontent.com/MikeMcl/bignumber.js/gh-pages/bignumberjs.png) A JavaScript library for arbitrary-precision decimal and non-decimal arithmetic. [![Build Status](https://travis-ci.org/MikeMcl/bignumber.js.svg)](https://travis-ci.org/MikeMcl/bignumber.js) <br /> ## Features - Faster, smaller, and perhaps easier to use than JavaScript versions of Java's BigDecimal - 8 KB minified and gzipped - Simple API but full-featured - Works with numbers with or without fraction digits in bases from 2 to 64 inclusive - Replicates the `toExponential`, `toFixed`, `toPrecision` and `toString` methods of JavaScript's Number type - Includes a `toFraction` and a correctly-rounded `squareRoot` method - Supports cryptographically-secure pseudo-random number generation - No dependencies - Wide platform compatibility: uses JavaScript 1.5 (ECMAScript 3) features only - Comprehensive [documentation](http://mikemcl.github.io/bignumber.js/) and test set ![API](https://raw.githubusercontent.com/MikeMcl/bignumber.js/gh-pages/API.png) If a smaller and simpler library is required see [big.js](https://github.com/MikeMcl/big.js/). It's less than half the size but only works with decimal numbers and only has half the methods. It also does not allow `NaN` or `Infinity`, or have the configuration options of this library. See also [decimal.js](https://github.com/MikeMcl/decimal.js/), which among other things adds support for non-integer powers, and performs all operations to a specified number of significant digits. ## Load The library is the single JavaScript file *bignumber.js* (or minified, *bignumber.min.js*). ```html <script src='relative/path/to/bignumber.js'></script> ``` For [Node.js](http://nodejs.org) or [io.js](https://iojs.org/en/index.html), the library is available from the [npm](https://npmjs.org/) registry $ npm install bignumber.js ```javascript var BigNumber = require('bignumber.js'); ``` To load with AMD loader libraries such as [requireJS](http://requirejs.org/): ```javascript require(['path/to/bignumber'], function(BigNumber) { // Use BigNumber here in local scope. No global BigNumber. }); ``` ## Use *In all examples below, `var`, semicolons and `toString` calls are not shown. If a commented-out value is in quotes it means `toString` has been called on the preceding expression.* The library exports a single function: `BigNumber`, the constructor of BigNumber instances. It accepts a value of type number *(up to 15 significant digits only)*, string or BigNumber object, ```javascript x = new BigNumber(123.4567) y = BigNumber('123456.7e-3') z = new BigNumber(x) x.equals(y) && y.equals(z) && x.equals(z) // true ``` and a base from 2 to 64 inclusive can be specified. ```javascript x = new BigNumber(1011, 2) // "11" y = new BigNumber('zz.9', 36) // "1295.25" z = x.plus(y) // "1306.25" ``` A BigNumber is immutable in the sense that it is not changed by its methods. ```javascript 0.3 - 0.1 // 0.19999999999999998 x = new BigNumber(0.3) x.minus(0.1) // "0.2" x // "0.3" ``` The methods that return a BigNumber can be chained. ```javascript x.dividedBy(y).plus(z).times(9).floor() x.times('1.23456780123456789e+9').plus(9876.5432321).dividedBy('4444562598.111772').ceil() ``` Many method names have a shorter alias. ```javascript x.squareRoot().dividedBy(y).toPower(3).equals(x.sqrt().div(y).pow(3)) // true x.cmp(y.mod(z).neg()) == 1 && x.comparedTo(y.modulo(z).negated()) == 1 // true ``` Like JavaScript's number type, there are `toExponential`, `toFixed` and `toPrecision` methods ```javascript x = new BigNumber(255.5) x.toExponential(5) // "2.55500e+2" x.toFixed(5) // "255.50000" x.toPrecision(5) // "255.50" x.toNumber() // 255.5 ``` and a base can be specified for `toString`. ```javascript x.toString(16) // "ff.8" ``` There is also a `toFormat` method which may be useful for internationalisation ```javascript y = new BigNumber('1234567.898765') y.toFormat(2) // "1,234,567.90" ``` The maximum number of decimal places of the result of an operation involving division (i.e. a division, square root, base conversion or negative power operation) is set using the `config` method of the `BigNumber` constructor. The other arithmetic operations always give the exact result. ```javascript BigNumber.config({ DECIMAL_PLACES: 10, ROUNDING_MODE: 4 }) // Alternatively, BigNumber.config( 10, 4 ); x = new BigNumber(2); y = new BigNumber(3); z = x.div(y) // "0.6666666667" z.sqrt() // "0.8164965809" z.pow(-3) // "3.3749999995" z.toString(2) // "0.1010101011" z.times(z) // "0.44444444448888888889" z.times(z).round(10) // "0.4444444445" ``` There is a `toFraction` method with an optional *maximum denominator* argument ```javascript y = new BigNumber(355) pi = y.dividedBy(113) // "3.1415929204" pi.toFraction() // [ "7853982301", "2500000000" ] pi.toFraction(1000) // [ "355", "113" ] ``` and `isNaN` and `isFinite` methods, as `NaN` and `Infinity` are valid `BigNumber` values. ```javascript x = new BigNumber(NaN) // "NaN" y = new BigNumber(Infinity) // "Infinity" x.isNaN() && !y.isNaN() && !x.isFinite() && !y.isFinite() // true ``` The value of a BigNumber is stored in a decimal floating point format in terms of a coefficient, exponent and sign. ```javascript x = new BigNumber(-123.456); x.c // [ 123, 45600000000000 ] coefficient (i.e. significand) x.e // 2 exponent x.s // -1 sign ``` Multiple BigNumber constructors can be created, each with their own independent configuration which applies to all BigNumber's created from it. ```javascript // Set DECIMAL_PLACES for the original BigNumber constructor BigNumber.config({ DECIMAL_PLACES: 10 }) // Create another BigNumber constructor, optionally passing in a configuration object BN = BigNumber.another({ DECIMAL_PLACES: 5 }) x = new BigNumber(1) y = new BN(1) x.div(3) // '0.3333333333' y.div(3) // '0.33333' ``` For futher information see the [API](http://mikemcl.github.io/bignumber.js/) reference in the *doc* directory. ## Test The *test* directory contains the test scripts for each method. The tests can be run with Node or a browser. For Node use $ npm test or $ node test/every-test To test a single method, e.g. $ node test/toFraction For the browser, see *every-test.html* and *single-test.html* in the *test/browser* directory. *bignumber-vs-number.html* enables some of the methods of bignumber.js to be compared with those of JavaScript's number type. ## Versions This is version 2.x.x of the library, for version 1.x.x see the tagged releases or switch to the 'original' branch. The advantages of version 2 are that it is considerably faster for numbers with many digits and that there are a some added methods (see Change Log below). The disadvantages are more lines of code and increased code complexity, and the loss of simplicity in no longer having the coefficient of a BigNumber stored in base 10. The 'original' version will continue to be supported. ## Performance See the [README](https://github.com/MikeMcl/bignumber.js/tree/master/perf) in the *perf* directory. ## Build For Node, if [uglify-js](https://github.com/mishoo/UglifyJS2) is installed npm install uglify-js -g then npm r
评论
    相关推荐
    • BlockChain:该存储库包含关于区块链的项目
      区块链存储库包含有关Blockchain的项目。 区块链最初是区块链,是越来越多的记录列表,称为区块,这些记录使用密码术进行链接。 每个区块都包含前一个区块的加密哈希,时间戳和交易数据
    • 数字资产区块链:该项目旨在为数字资产加盖时间戳并将其存储区块链
      私人区块链应用 您以区块链开发人员的身份开始旅程,该项目可让您证明您已熟悉区块链平台的基本概念。 像这样的概念:-区块-区块链-钱包-区块链身份-存在证明 您是否需要描述区块链框架中一些最重要的组件,为什么不...
    • 区块链资料
      区块链资料22222222222222222222222222222
    • 核心:Compendia区块链的主要存储
      存储库包含构成Compendia Core的所有模块。 如果要开始开发自己的插件,请查看我们以获取有关所有可用插件以及插件的信息。 文献资料 API文档 安全漏洞奖励/漏洞赏金 学分 由 ( )创建 基于 。 执照 :...
    • 塔塔姆区块链连接器
      存储库用作查找集成到Tatum API中的所有区块链连接器的地方。 结构体 有一个blueprint文件夹,其中为您准备了一个示例连接器。 您应该扩展*Controller.ts和*Service.ts文件并实现所需的方法,并希望通过Tatum API...
    • MedicalCards:医疗卡存储区块链项目
      用于存储医疗卡数据的区块链项目 英文变体doc即将推出 给我发邮件,如果您有任何疑问
    • 区块链编程
      区块链相关编程学习资源,有部分代码,及软件使用方法介绍
    • Python区块链应用
      可以添加多个节点,每个节点都有自己的本地存储区块链,一个公钥和一个私钥。 区块链存储在本地的.txt文件中。 钱包保存,加载和交易签名验证 块的真实SHA256哈希和工作量证明。 可以将硬币转移到其他钱包/...
    • 区块链文献
      区块链的相关参考文献
    • emsi-blockchain:区块链存储
      霍尔伯顿学校项目的Emsi区块链存储