You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-19Lines changed: 19 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,41 +41,41 @@ var bitcoin = require('bitcoinjs-lib')
41
41
42
42
### Browser
43
43
If you're familiar with how to use browserify, ignore this and proceed normally.
44
-
These steps are advisory only, and may not be necessary for your application.
44
+
These steps are advisory only, and may not be suitable for your application.
45
45
46
46
[Browserify](https://github.com/substack/node-browserify) is assumed to be installed for these steps.
47
47
48
-
From your repository, create an `index.js` file
48
+
For your project, create an `index.js` file
49
49
```javascript
50
-
module.exports= {
51
-
base58:require('bs58'),
52
-
bitcoin:require('bitcoinjs-lib'),
53
-
ecurve:require('ecurve'),
54
-
BigInteger:require('bigi')
50
+
let bitcoin =require('bitcoinjs-lib')
51
+
52
+
// your code here
53
+
functionmyFunction () {
54
+
returnbitcoin.ECPair.makeRandom().toWIF()
55
55
}
56
-
```
57
56
58
-
Install each of the above packages locally
59
-
```bash
60
-
npm install bs58 bitcoinjs-lib ecurve bigi
57
+
module.exports= {
58
+
myFunction
59
+
}
61
60
```
62
61
63
-
After installation, use browserify to compile `index.js`for use in the browser:
62
+
Now, to compile for the browser:
64
63
```bash
65
-
$ browserify index.js --standalone foo > app.js
64
+
browserify index.js --standalone foo > app.js
66
65
```
67
66
68
-
You will now be able to use `<script src="app.js" />` in your browser, with each of the above exports accessible via the global `foo` object (or whatever you chose for the `--standalone` parameter above).
69
-
70
-
**NOTE**: See our package.json for the currently supported version of browserify used by this repository.
67
+
You can now put `<script src="app.js" />` in your web page, using `foo.myFunction` to create a new Bitcoin private key.
71
68
72
-
**NOTE**: When uglifying the javascript, you must exclude the following variable names from being mangled: `Array`, `BigInteger`, `Boolean`, `ECPair`, `Function`, `Number`, `Point` and `Script`.
69
+
**NOTE**: If you uglify the javascript, you must exclude the following variable names from being mangled: `BigInteger`, `ECPair`, `Point`.
73
70
This is because of the function-name-duck-typing used in [typeforce](https://github.com/dcousens/typeforce).
**NOTE**: This library tracks Node LTS features, if you need strict ES5, use [`--transform babelify`](https://github.com/babel/babelify) in conjunction with your `browserify` step (using an [`es2015`](http://babeljs.io/docs/plugins/preset-es2015/) preset).
78
+
79
79
**NOTE**: If you expect this library to run on an iOS 10 device, ensure that you are using [[email protected]](https://github.com/feross/buffer/pull/155) or greater.
80
80
81
81
@@ -85,7 +85,7 @@ Type declarations for Typescript are available for version `^3.0.0` of the libra
85
85
npm install @types/bitcoinjs-lib
86
86
```
87
87
88
-
You can now use `bitcoinjs-lib` as a typescript compliant library.
88
+
You can now use `bitcoinjs-lib` as a typescript compliant library.
0 commit comments