Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
341 commits
Select commit Hold shift + click to select a range
8d5ef2d
TxBuilder: limit signatures depending on scriptType
dcousens Aug 30, 2014
e1479b6
scripts: add error for >n signatures with multisig
dcousens Aug 30, 2014
1d0fd3e
TxBuilder: add more failing cases and error handling
dcousens Aug 30, 2014
0312f7f
Merge pull request #270 from dcousens/txfix
weilu Aug 31, 2014
8cc1f05
Merge pull request #222 from bitcoinjs/tip4commit
weilu Sep 2, 2014
1764d45
README: added Quickcoin
dcousens Sep 5, 2014
dce2690
README: add BIP38
dcousens Sep 5, 2014
cc98600
Merge pull request #262 from dcousens/wallref
weilu Sep 6, 2014
c41c3bb
Add viacoin support
btcdrak Sep 6, 2014
07a438d
Merge pull request #276 from btcdrak/viacoin
dcousens Sep 8, 2014
6c5a682
Transaction: use isFinite instead over typeof number
dcousens Sep 8, 2014
4e04a7e
Transaction: use isFinite over Number.isFinite
dcousens Sep 8, 2014
f028dff
Wallet: fix missing variable utxo
dcousens Sep 8, 2014
69dfd32
Wallet: add missing variable wallet
dcousens Sep 8, 2014
c3f8869
tests: Wallet test was not comprehensive
dcousens Sep 8, 2014
32cbd02
Merge pull request #280 from dcousens/testprefix
weilu Sep 9, 2014
0a232cd
tests: sign test needs to trigger ecurve.Point side effects
dcousens Sep 15, 2014
3b60d7a
README: s/Bitcoin/bitcoin for namespacing
dcousens Sep 15, 2014
e3d05c6
1.1.0
dcousens Sep 20, 2014
c96b862
crypto: remove cryptojs
dcousens Sep 5, 2014
e82da0c
package: browserify now uses crypto-browserify 3.0.0
dcousens Sep 16, 2014
a580887
HDNode: indicate 2.x.y removal of Buffer interop
dcousens Sep 15, 2014
2ed8ade
Merge pull request #275 from dcousens/byecjs
dcousens Sep 22, 2014
1dad7b6
package: crypto-browserify must be specified until browserify catches up
dcousens Sep 22, 2014
6cd8fc3
Merge pull request #282 from dcousens/nobuff
weilu Sep 22, 2014
18c3a4a
1.1.1
dcousens Sep 22, 2014
faea16c
package: use latest crypto-browserify
dcousens Sep 25, 2014
012f958
package: update dev-dependencies, bigi
dcousens Sep 25, 2014
0631db5
1.1.2
dcousens Sep 25, 2014
de17553
Added Zetacoin support
wmcbain Sep 25, 2014
c96a1bc
Merge pull request #284 from wmcbain/master
dcousens Sep 26, 2014
ed01ed5
remove unused bs58 core dependency
dcousens Oct 3, 2014
756e38b
package: upgrade bs58check to 1.0.3
dcousens Oct 3, 2014
166053a
1.1.3
dcousens Oct 3, 2014
35542e1
types: enforce consistent type checking
dcousens Sep 15, 2014
deaf06b
Wallet: use enforceType where applicable
dcousens Oct 5, 2014
0c380a0
tests: add tests for types
dcousens Oct 7, 2014
01a96e8
types: use the idiomatic equivalents
dcousens Oct 7, 2014
967e724
types: remove JSPerf references
dcousens Oct 7, 2014
ca09849
Merge pull request #288 from dcousens/types
weilu Oct 7, 2014
eb4e888
loose instanceof: check constructor function name instead
weilu Oct 7, 2014
b55b10c
types: replace Function.name with an IE compatible alternative
weilu Oct 8, 2014
8bdf61d
package: update crypto-browserify to 3.2.6
dcousens Oct 9, 2014
7fb45ae
1.1.4
dcousens Oct 9, 2014
1b57f08
message: remove duplicate require
dcousens Oct 10, 2014
98bc168
message: remove unnecessary verbosity
dcousens Oct 10, 2014
1063087
tests: add tests for ecdsa.verify
dcousens Oct 11, 2014
7e897a5
Merge pull request #289 from weilu/loose-instanceof
dcousens Oct 13, 2014
6dc3b4c
tests: add unknown network HDNode version fixture
dcousens Oct 13, 2014
5f2e0af
Add: Coinkite and fixed alphabetic order.
nvk Oct 13, 2014
62d5ebb
Merge pull request #295 from nvk/master
dcousens Oct 14, 2014
8a6a8b1
README: fix QuickCoin capitalization
dcousens Oct 14, 2014
bc2048d
scripts: remove out-of-date comments
dcousens Oct 13, 2014
407d158
scripts: s/opcodes/ops
dcousens Oct 13, 2014
b7febc1
scripts: re-order classify functions
dcousens Oct 13, 2014
1a20c0d
scripts: avoid unnecessary this context
dcousens Oct 13, 2014
b65e70b
scripts: remove explict else branch
dcousens Oct 13, 2014
27a9943
tests: cover all multisigOutput branchs
dcousens Oct 13, 2014
ddb24ee
scripts: check chunks length properly
dcousens Oct 13, 2014
f3138dc
tests: test non-standard pathway for classifyInput
dcousens Oct 13, 2014
f9a5c47
tests: add OP_RETURN scripts fixture
dcousens Oct 13, 2014
f6e340f
tests: add scriptHash redeemScript non-data fixture
dcousens Oct 13, 2014
ab57630
tests: add non-canonical signature test
dcousens Oct 13, 2014
f947360
Merge pull request #294 from bitcoinjs/scriptsclean
dcousens Oct 14, 2014
9340a8a
package: 1.1.5
dcousens Oct 15, 2014
561f52b
index: re-expose base58check until 2.0.0
dcousens Oct 15, 2014
13f07a7
1.1.6
dcousens Oct 15, 2014
ef1eb04
HDNode: move var declaration out of branches
dcousens Sep 15, 2014
307ceb9
HDNode: use === over ==
dcousens Oct 15, 2014
395ef6e
base58check: add deprecation warnings
dcousens Oct 15, 2014
87c3d4f
1.1.7
dcousens Oct 15, 2014
7f5b4b7
index: fix base58check path
dcousens Oct 15, 2014
49ab51c
1.1.8
dcousens Oct 15, 2014
27a3230
base58check: fix wrapper and tests
dcousens Oct 15, 2014
48a2d3c
1.1.9
dcousens Oct 15, 2014
efcad25
tests: amend base58check mock
dcousens Oct 15, 2014
22c67ad
1.1.10
dcousens Oct 15, 2014
4854e4a
tests: bitcoin core tests should act only the public API
dcousens Oct 15, 2014
cba6c7a
tests: remove unused variable
dcousens Oct 15, 2014
9510af1
EC*Key: add .curve static property for public API
dcousens Oct 15, 2014
cfcfe59
1.2.0
dcousens Oct 15, 2014
5d5dcd3
remove unused base58 fixtures
dcousens Oct 17, 2014
062540e
Transaction: optional script for addInput
dcousens Oct 16, 2014
2234e49
Transaction: simplify fromBuffer verbosity
dcousens Oct 16, 2014
929d926
tests: make use of the default behaviour
dcousens Oct 17, 2014
27e69ba
README: s/Multsig/Multisig
dcousens Oct 17, 2014
ea66ede
scripts: add dataOutput convenience function
dcousens Oct 19, 2014
43f724c
integration tests: add brainwallet/README examples
dcousens Oct 18, 2014
ddc9473
integration tests: refactor helloblock P2SH spending test
dcousens Oct 18, 2014
ccd0bb5
integration tests: add example OP_RETURN transaction
dcousens Oct 19, 2014
6db700c
integration tests: add stealth address example
dcousens Oct 19, 2014
a3a4d2a
Transaction: re-order functions for consistency
dcousens Oct 24, 2014
41da79c
Merge pull request #303 from bitcoinjs/datascript
weilu Oct 24, 2014
4283fc2
Added Gamerscoin Support
johngame Oct 24, 2014
787215e
Merge pull request #309 from bitcoinjs/txstring
weilu Nov 9, 2014
5b6249e
Merge pull request #310 from johngame/master
dcousens Nov 10, 2014
5ee3203
Add Jumbucks support
jyap808 Nov 16, 2014
bd8a677
Merge pull request #313 from jyap808/patch-1
weilu Nov 23, 2014
a6febb0
integration tests: add more basic examples
dcousens Nov 24, 2014
f81a47a
integration tests: rename all files to basic/advanced/multisig
dcousens Nov 24, 2014
ec51737
integration tests: test description rephrasing
dcousens Nov 25, 2014
d9c716c
README: remove examples and link to integration tests
dcousens Nov 25, 2014
67e97f7
integration tests: fix 2-of-2 spend address network
dcousens Nov 25, 2014
37a1c93
integration tests: merge #312 test equivalent
dcousens Nov 25, 2014
7e7071b
integration tests: add timeout for 2-of-2 spend
dcousens Nov 25, 2014
126567b
README: fix test line numbers
dcousens Nov 25, 2014
e547ea3
README: s/inttests/master/
dcousens Nov 25, 2014
78d26c2
Wallet: add 2.0.0 deprecation message
dcousens Nov 25, 2014
5b41ffc
Merge pull request #302 from bitcoinjs/inttests
weilu Nov 25, 2014
d869d6d
1.3.0
dcousens Nov 26, 2014
5a1aef3
Add Robocoin to projects utilizing BitcoinJS
thallium205 Nov 26, 2014
c00be27
networks: prioritize bitcoin/testnet
dcousens Nov 27, 2014
936f791
1.3.1
dcousens Nov 27, 2014
c0c47f0
add block.js and tests
dcousens Oct 16, 2014
2214ccf
bufferutils: add varIntBuffer
dcousens Oct 17, 2014
9897fa2
block: adds getUTCDate function
dcousens Oct 29, 2014
b6b5b56
block: re-order functions to project standard
dcousens Nov 27, 2014
110cb86
Merge pull request #300 from bitcoinjs/block
dcousens Nov 28, 2014
62e86e0
scripts: s/dataOutput/nullDataOutput/
dcousens Nov 28, 2014
e4eb743
scripts: expose is* classifiers
dcousens Nov 28, 2014
f8f459d
scripts: add dataOutput deprecation
dcousens Nov 28, 2014
254974d
scripts: add TODO for tests for isCanonical* functions
dcousens Nov 28, 2014
4fe0b34
Address: no need to check other script types
dcousens Nov 28, 2014
7fbc397
Address: use script ASM over hex
dcousens Nov 28, 2014
a845981
HDNode: avoid walking bip32 object
dcousens Nov 29, 2014
10f3d7c
package: remove testling
dcousens Nov 29, 2014
86df6fc
README: better wording
dcousens Nov 29, 2014
25038bd
README: remove testling badge
dcousens Nov 29, 2014
c965ff0
Merge pull request #319 from thallium205/patch-1
kyledrake Nov 29, 2014
c9137a2
Merge pull request #324 from bitcoinjs/notestling
weilu Nov 29, 2014
b1cb56c
Merge pull request #322 from bitcoinjs/scriptexp
weilu Nov 30, 2014
4fca3ac
network: add failing tests for gamerscoin, viacoin and zetacoin
dcousens Nov 27, 2014
311df7e
HDNode: add optional network flag to import functions
dcousens Nov 29, 2014
8bdfa88
tests: remove unused testing data
dcousens Nov 29, 2014
1ac79b8
tests: add test for non-matching network
dcousens Nov 29, 2014
b6017b0
HDNode: move isPrivate logic
dcousens Nov 30, 2014
42f2a34
Merge pull request #323 from bitcoinjs/netcompat
weilu Dec 1, 2014
6ed8e15
transaction/builder: s/txin/txIn/g
dcousens Dec 2, 2014
68e4ba6
1.4.0
dcousens Dec 2, 2014
083e8fa
index: expose Block
dcousens Dec 2, 2014
5bfc89b
1.4.1
dcousens Dec 2, 2014
f3ddc50
crypto: add deprecation warnings
dcousens Dec 8, 2014
7ef1344
ecdsa/HDNode: use node crypto for Hmacs
dcousens Dec 8, 2014
dd2a264
1.4.2
dcousens Dec 8, 2014
a66773b
tests/integration: add HDNode private key recovery example
dcousens Dec 5, 2014
de914ff
tests/integration: move crypto-like tests to test/integration/crypto.js
dcousens Dec 5, 2014
e6b7f51
README: update README links
dcousens Dec 8, 2014
837e0a3
package: use cb-helloblock for integration tests
dcousens Dec 9, 2014
3710105
tests/integration: add k-value derivation and private key recovery ex…
dcousens Dec 9, 2014
953cb56
Merge pull request #327 from bitcoinjs/cryptoint
dcousens Dec 11, 2014
50a3232
tests: remove unused variables
dcousens Dec 12, 2014
3a17e23
tests: remove unused variable
dcousens Dec 12, 2014
fc7c7ce
tests: remove extraneous anonymous function
dcousens Dec 12, 2014
ca4e64d
tests: use ASM for fixtures, avoid JSON comparison
dcousens Dec 12, 2014
fc690d4
tests: rename txid to id in Transaction context
dcousens Dec 12, 2014
044c53b
transaction.addInput checks if sequence is NULL
bezreyhan Dec 12, 2014
1c6d5a2
update fixtures and tests for merge
bezreyhan Dec 16, 2014
85979a0
remove fixture
bezreyhan Dec 16, 2014
4745747
Merge pull request #330 from bezreyhan/check_for_null
dcousens Dec 16, 2014
c716367
tests: add test for null sequence number
dcousens Dec 16, 2014
e42c497
package: use typeforce
dcousens Dec 23, 2014
0524ced
scripts: enforce pubKeys as type ECPubKey
dcousens Dec 23, 2014
646fbbd
Merge pull request #332 from bitcoinjs/typeforce
weilu Dec 23, 2014
c41bc33
Updated license date
benhc123 Jan 1, 2015
ecadda0
Merge pull request #335 from benhc123/patch-2
weilu Jan 1, 2015
4c61380
ecdsa: add comment for Step A
dcousens Jan 4, 2015
e9778ae
ecdsa: fixes edge case presented in #336
dcousens Jan 4, 2015
1e7f537
tests: adds ecdsa test enforcing valid signature callback
dcousens Jan 5, 2015
0e5c7b2
tests: add bip32JPs RFC6979 test vectors and tests
dcousens Jan 5, 2015
a492969
tests: ecdsa test cleanup
dcousens Jan 5, 2015
6938c8f
ecdsa: add default checkSig, to be removed in 2.0.0
dcousens Jan 6, 2015
59143a9
ecdsa: clarify why typeForce call is disabled until 2.0.0
dcousens Jan 8, 2015
6f37389
Merge pull request #337 from bitcoinjs/rfc6979fix
weilu Jan 9, 2015
2223b99
package: latest devDependencies
dcousens Jan 9, 2015
c264941
package: bigi 1.4.0 and crypto-browserify 3.9.0
dcousens Jan 9, 2015
62ebacc
1.4.3
dcousens Jan 9, 2015
912e944
adds .npmignore
dcousens Jan 13, 2015
510212a
Merge pull request #340 from bitcoinjs/npmignore
weilu Jan 13, 2015
a529b3f
TxBuilder: copy version/locktime in fromTransaction
dcousens Jan 23, 2015
cbf8c6f
tests: format JSON consistently
dcousens Jan 23, 2015
93714a2
Merge pull request #342 from bitcoinjs/txbfix
weilu Jan 24, 2015
64678e7
1.4.4
dcousens Jan 27, 2015
5e1cd6e
integration: avoid looking up all address transactions each time
dcousens Jan 27, 2015
234ae84
integration: use 'bitcoinjs-lib' as OP_RETURN constant
dcousens Jan 27, 2015
b93903e
Merge pull request #343 from bitcoinjs/testfix
dcousens Jan 28, 2015
51b23c6
package: remove crypto-browserify specific version
dcousens Feb 2, 2015
abf870f
Merge pull request #346 from bitcoinjs/rmbro
weilu Feb 2, 2015
c13f1df
doc: no section headers
dcousens Oct 13, 2014
c9db90d
ECSignature: enforce valid hashType in toScriptSignature
dcousens Nov 28, 2014
7ee8a85
README: improve browserify instructions
dcousens Jan 5, 2015
2047567
README: add note about browserify version
dcousens Jan 5, 2015
c11f505
README: don't use a bitcoin namespace for other deps
dcousens Jan 5, 2015
75ca385
README: no need to provide 'from the repo' require
dcousens Feb 8, 2015
642315e
README: remove dist/ and clarify installation of other packages
dcousens Feb 8, 2015
7ad3ac5
Merge pull request #357 from bitcoinjs/nodocs
dcousens Feb 12, 2015
fa96764
package: remove uglify-js
dcousens Jan 13, 2015
c35d4b4
scripts: add allowIncomplete for multisig scripts
dcousens Feb 11, 2015
18fb33d
Merge pull request #354 from bitcoinjs/wipscript
dcousens Feb 13, 2015
3ef2d6f
Merge pull request #315 from bitcoinjs/browserdocs
dcousens Feb 13, 2015
f8b9a5f
Merge pull request #356 from bitcoinjs/htenforce
dcousens Feb 13, 2015
437b25e
Merge pull request #358 from bitcoinjs/nouglify
dcousens Feb 13, 2015
75ca355
README: fix example URLs
dcousens Feb 4, 2015
906accd
TxBuilder: extract extractSignatures to free function
dcousens Dec 12, 2014
46db11e
TxBuilder: extract isCoinbaseHash function
dcousens Jan 6, 2015
ebe34db
TxBuilder: avoid var redeclaration due to hoisting
dcousens Jan 5, 2015
ba97b5e
TxBuilder: re-order to avoid mutation in case of failure
dcousens Dec 12, 2014
c29b233
TxBuilder: build convenience functions don't need extra line breaks
dcousens Feb 5, 2015
dfe74fa
TxBuilder: sign now signs inputs in known publicKey order
dcousens Dec 12, 2014
b629a03
TxBuilder: rename prevOutMap to prevTxMap
dcousens Jan 5, 2015
35fa86c
tests: add [failing] raw multisig fixture for TxBuilder
dcousens Jan 5, 2015
396e4d4
tests: add [failing] test for nulldata signing
dcousens Jan 6, 2015
b048627
tests: move TxBuilder.sign tests to fixtures
dcousens Jan 6, 2015
4c9fd60
TxBuilder: fix failing test for non-standard/multisig inputs
dcousens Jan 6, 2015
23a37fb
TxBuilder: fix out-of-order multisignature signing
dcousens Jan 6, 2015
95911c5
tests: consistent test data names
dcousens Jan 6, 2015
3f53b52
tests: reduce setup-code duplication
dcousens Jan 28, 2015
f0c4a76
tests: add scriptHash(pubKey) test fixture
dcousens Jan 28, 2015
ebbe127
tests: add non-standard input fixture
dcousens Jan 28, 2015
1fde0a4
tests: move inconsistent hashType/redeemScript test
dcousens Feb 4, 2015
5f76111
tests: if description undefined, use exception
dcousens Feb 4, 2015
d3af28e
tests: fix TxBuilder fixtures to be consistent w/ compression
dcousens Feb 5, 2015
085b813
TxBuilder: replace switch lookup with object lookup
dcousens Feb 4, 2015
8a8f40e
TxBuilder: defer mutation as long as possible
dcousens Feb 4, 2015
b55e3a0
TxBuilder: missing redeemScript not an issue if already added
dcousens Feb 4, 2015
e33a640
TxBuilder: add explanation for prevOutScript branch
dcousens Feb 4, 2015
c7c5830
TxBuilder: avoid unnecessary assertion, already done in classification
dcousens Feb 5, 2015
986e9d4
TxBuilder: vout is actually vin for addInput
dcousens Feb 5, 2015
fd2311b
TxBuilder: remove impossible/untestable assertions
dcousens Feb 5, 2015
3a371fc
TxBuilder: remove initialized field from signature inputs
dcousens Feb 5, 2015
a788214
TxBuilder: fix undefined scriptSig
dcousens Feb 5, 2015
4ef2c19
TxBuilder: defer mutation further, but still catch non-standards
dcousens Feb 5, 2015
73bf8a4
TxBuilder: hashtype only relevant to things we can sign
dcousens Feb 5, 2015
4f8ef64
Merge pull request #329 from bitcoinjs/txbmerge
dcousens Feb 15, 2015
d68eb49
tests: use fffff... unless txHash is actually useful
dcousens Feb 15, 2015
4bcd169
tests: actually run invalid tests
dcousens Feb 15, 2015
c982622
scripts: catch error in Script.fromBuffer
dcousens Feb 15, 2015
7a515a1
tests: use beforeEach for initialization
dcousens Feb 18, 2015
f136505
Transaction: add internal flag to disable size assertion
dcousens Feb 19, 2015
4934574
Transaction: add isCoinbaseHash static method
dcousens Feb 19, 2015
dc253bb
Transaction: extract Script size calculations
dcousens Feb 19, 2015
db17e35
tests: transaction.add* better tested by raw functions
dcousens Feb 19, 2015
445eb26
tests: add failing Coinbase transaction fixture
dcousens Feb 19, 2015
23bae57
Transaction: fix coinbase script handling
dcousens Feb 19, 2015
50dab3b
block: use Transaction.fromBuffer
dcousens Feb 19, 2015
e0b1aa8
Merge pull request #360 from bitcoinjs/scriptfix
dcousens Feb 19, 2015
1da8297
Merge pull request #363 from bitcoinjs/coinbase
dcousens Feb 22, 2015
f16630c
1.4.5
dcousens Feb 22, 2015
ff3b1bd
package: use browserify 9.0.0
dcousens Feb 22, 2015
376c653
tests: bitcoin/core check WIF exports correctly
dcousens Feb 22, 2015
f87ac58
tests: add reverse order multisig 2-of-2
dcousens Feb 23, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
node_modules
bitcoinjs-min.js
bitcoin.js
coverage
node_modules
4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.gitignore
.travis.yml
jshint.json
test/
22 changes: 18 additions & 4 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
Copyright (c) 2011 Stefan Thomas
The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Copyright (c) 2011-2015 Bitcoinjs-lib contributors

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
126 changes: 53 additions & 73 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# BitcoinJS (bitcoinjs-lib)

[![Build Status](https://travis-ci.org/bitcoinjs/bitcoinjs-lib.png?branch=master)](https://travis-ci.org/bitcoinjs/bitcoinjs-lib) [![Coverage Status](https://coveralls.io/repos/bitcoinjs/bitcoinjs-lib/badge.png)](https://coveralls.io/r/bitcoinjs/bitcoinjs-lib)
[![Build Status](https://travis-ci.org/bitcoinjs/bitcoinjs-lib.png?branch=master)](https://travis-ci.org/bitcoinjs/bitcoinjs-lib)
[![Coverage Status](https://coveralls.io/repos/bitcoinjs/bitcoinjs-lib/badge.png)](https://coveralls.io/r/bitcoinjs/bitcoinjs-lib)
[![tip for next commit](http://tip4commit.com/projects/735.svg)](http://tip4commit.com/projects/735)

[![NPM](https://nodei.co/npm/bitcoinjs-lib.png)](https://nodei.co/npm/bitcoinjs-lib/)

[![Browser Support](https://ci.testling.com/bitcoinjs/bitcoinjs-lib.png)](https://ci.testling.com/bitcoinjs/bitcoinjs-lib)

The pure JavaScript Bitcoin library for node.js and browsers.
A continued implementation of the original `0.1.3` version used by over a million wallet users; the backbone for almost all Bitcoin web wallets in production today.

Expand All @@ -26,6 +26,7 @@ A continued implementation of the original `0.1.3` version used by over a millio


## Should I use this in production?

If you are thinking of using the master branch of this library in production, *stop*.
Master is not stable; it is our development branch, and only tagged releases may be classified as stable.

Expand All @@ -43,99 +44,76 @@ If you are looking for the original, it is tagged as `0.1.3`. Unless you need it

var bitcoin = require('bitcoinjs-lib')

From the repo:

var bitcoin = require('./src/index.js')


### Browser

From the repository: Compile `bitcoinjs-min.js` with the following command:

$ npm run-script compile

From NPM:

$ npm -g install bitcoinjs-lib browserify uglify-js
$ browserify -r bitcoinjs-lib -s Bitcoin | uglifyjs > bitcoinjs.min.js

After loading this file in your browser, you will be able to use the global `bitcoin` object.
If you're familiar with how to use browserify, ignore this and proceed normally.
These steps are advisory only and allow you to use the API to its full extent.

[Browserify](https://github.com/substack/node-browserify) is assumed to be installed for these steps.

## Usage
From your repository, create a `foobar.js` file

These examples assume you are running bitcoinjs-lib in the browser.


### Generating a Bitcoin address

```javascript

key = bitcoin.ECKey.makeRandom()

// Print your private key (in WIF format)
console.log(key.toWIF())
// => 8c112cf628362ecf4d482f68af2dbb50c8a2cb90d226215de925417aa9336a48

// Print your public key (toString defaults to a Bitcoin address)
console.log(key.pub.getAddress().toString())
// => 14bZ7YWde4KdRb5YN7GYkToz3EHVCvRxkF
``` javascript
var foobar = {
base58: require('bs58'),
bitcoin: require('bitcoinjs-lib'),
ecurve: require('ecurve'),
BigInteger: require('bigi'),
Buffer: require('buffer')
}

module.exports = foobar
```

### Creating a Transaction
Each of these included packages are seperate to `bitcoinjs-lib`, and must be installed separately.
They are however used in the bitcoinjs-lib public API.

```javascript
tx = new bitcoin.Transaction()
Using browserify, compile `foobar.js` for use in the browser:

// Add the input (who is paying) of the form [previous transaction hash, index of the output to use]
tx.addInput("aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31", 0)
$ browserify foobar.js -s foobar > foobar.js

// Add the output (who to pay to) of the form [payee's address, amount in satoshis]
tx.addOutput("1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK", 15000)
You will then be able to load `foobar.js` into your browser, with each of the dependencies above accessible from the global `foobar` object.

// Initialize a private key using WIF
key = bitcoin.ECKey.fromWIF("L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy")
**NOTE**: See our package.json for the currently supported version of browserify used by this repository.

// Sign the first input with the new key
tx.sign(0, key)

// Print transaction serialized as hex
console.log(tx.toHex())
// => 0100000001313eb630b128102b60241ca895f1d0ffca2170d5a0990e094f2182c102ab94aa000000008a47304402200169f1f844936dc60df54e812345f5dd3e6681fea52e33c25154ad9cc23a330402204381ed8e73d74a95b15f312f33d5a0072c7a12dd6c3294df6e8efbe4aff27426014104e75628573696aed32d7656fb35e9c71ea08eb6492837e13d2662b9a36821d0fff992692fd14d74fdec20fae29128ba12653249cbeef521fc5eba84dde0689f27ffffffff01983a0000000000001976a914ad618cf4333b3b248f9744e8e81db2964d0ae39788ac00000000
## Examples

// You could now push the transaction onto the Bitcoin network manually (see https://blockchain.info/pushtx)
```

### Creating a P2SH Multsig Address

``` javascript
var bitcoin = require('bitcoinjs-lib')

var privKeys = [bitcoin.ECKey.makeRandom(), bitcoin.ECKey.makeRandom(), bitcoin.ECKey.makeRandom()]
var pubKeys = privKeys.map(function(x) { return x.pub })

var redeemScript = bitcoin.scripts.multisigOutput(2, pubKeys) // 2 of 3
var scriptPubKey = bitcoin.scripts.scriptHashOutput(redeemScript.getHash())

var multisigAddress = bitcoin.Address.fromOutputScript(scriptPubKey).toString()

console.log("multisigP2SH:", multisigAddress)
```
The below examples are implemented as integration tests, they should be very easy to understand. Otherwise, pull requests are appreciated.

- [Generate a random address](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/basic.js#L8)
- [Generate a address from a SHA256 hash](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/basic.js#L20)
- [Import an address via WIF](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/basic.js#L29)
- [Create a Transaction](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/basic.js#L36)
- [Sign a Bitcoin message](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/advanced.js#L9)
- [Verify a Bitcoin message](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/advanced.js#L17)
- [Create an OP RETURN transaction](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/advanced.js#L24)
- [Create a 2-of-3 multisig P2SH address](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/multisig.js#L8)
- [Spend from a 2-of-2 multisig P2SH address](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/multisig.js#L22)
- [Generate a single-key stealth address](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/crypto.js#L7)
- [Generate a dual-key stealth address](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/crypto.js#L42)
- [Recover a BIP32 parent private key from the parent public key and a derived non-hardened child private key](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/crypto.js#L44)
- [Recover a Private key from duplicate R values in a signature](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/crypto.js#L90)


## Projects utilizing BitcoinJS

- [Coinpunk](https://coinpunk.com)
- [Hive Wallet](https://www.hivewallet.com)
- [Justchain Exchange](https://justcoin.com)
- [Skyhook ATM](http://projectskyhook.com)
- [BitAddress](https://www.bitaddress.org)
- [Blockchain.info](https://blockchain.info/wallet)
- [Brainwallet](https://brainwallet.github.io)
- [Coinkite](https://coinkite.com)
- [Coinpunk](https://coinpunk.com)
- [Dark Wallet](https://darkwallet.unsystem.net)
- [DecentralBank](http://decentralbank.co)
- [Dogechain Wallet](https://dogechain.info)
- [GreenAddress](https://greenaddress.it)
- [Hive Wallet](https://www.hivewallet.com)
- [Justchain Exchange](https://justcoin.com)
- [QuickCoin](https://wallet.quickcoin.co)
- [Robocoin](https://wallet.robocoin.com)
- [Skyhook ATM](http://projectskyhook.com)


## Contributors

Expand All @@ -145,6 +123,7 @@ Since then, many people have contributed. [Click here](https://github.com/bitcoi

Daniel Cousens, Wei Lu, JP Richardson and Kyle Drake lead the major refactor of the library from 0.1.3 to 1.0.0.


## Contributing

Join the ongoing IRC development channel at `#bitcoinjs-dev` on Freenode.
Expand All @@ -161,9 +140,9 @@ Please make your best effort to adhere to these when contributing to save on tri

## Complementing Libraries

- [bip39](https://github.com/weilu/bip39) - Wei Lu's Mnemonic code generator
- [BIP39](https://github.com/weilu/bip39) - Mnemonic code for generating deterministic keys
- [BIP38](https://github.com/cryptocoinjs/bip38) - Passphrase-protected private keys
- [BCoin](https://github.com/indutny/bcoin) - BIP37 / Bloom Filters / SPV client
- [scryptsy](https://github.com/cryptocoinjs/scryptsy) - Private key encryption (BIP38)
- [insight](https://github.com/bitpay/insight) - A bitcoin blockchain API for web wallets.


Expand All @@ -172,12 +151,13 @@ Please make your best effort to adhere to these when contributing to save on tri
- [Bitcore](https://github.com/bitpay/bitcore)
- [Cryptocoin](https://github.com/cryptocoinjs/cryptocoin)


## License

This library is free and open-source software released under the MIT license.


## Copyright

BitcoinJS (c) 2011-2012 Stefan Thomas
BitcoinJS (c) 2011-2014 Bitcoinjs-lib contributors
Released under MIT license
68 changes: 25 additions & 43 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bitcoinjs-lib",
"version": "1.0.0",
"version": "1.4.5",
"description": "Client-side Bitcoin JavaScript library",
"main": "./src/index.js",
"keywords": [
Expand Down Expand Up @@ -31,53 +31,35 @@
"url": "http://www.justmoon.net"
}
],
"scripts": {
"compile": "browserify ./src/index.js -s bitcoin > bitcoin.js",
"coverage": "istanbul cover _mocha -- test/*.js",
"coveralls": "npm run-script coverage && coveralls < coverage/lcov.info",
"integration": "mocha --reporter list test/integration/*.js",
"jshint": "jshint --config jshint.json src/*.js ; true",
"test": "npm run-script unit",
"unit": "istanbul test mocha -- --reporter list test/*.js"
},
"repository": {
"type": "git",
"url": "https://github.com/bitcoinjs/bitcoinjs-lib.git"
},
"dependencies": {
"bigi": "^1.4.0",
"bs58check": "^1.0.4",
"ecurve": "^1.0.0",
"typeforce": "^0.1.0"
},
"devDependencies": {
"browserify": "4.1.11",
"coveralls": "~2.10.0",
"helloblock-js": "^0.2.1",
"istanbul": "0.1.30",
"jshint": "2.5.1",
"mocha": "1.18.2",
"async": "^0.9.0",
"browserify": "^9.0.3",
"bs58": "^2.0.1",
"cb-helloblock": "^0.4.10",
"coveralls": "^2.11.2",
"istanbul": "^0.3.5",
"jshint": "^2.5.11",
"mocha": "^2.1.0",
"mocha-lcov-reporter": "0.0.1",
"sinon": "1.9.0",
"uglify-js": "2.4.13"
},
"testling": {
"browsers": [
"android-browser/4.2..latest",
"chrome/20..latest",
"firefox/21..latest",
"ipad/6..latest",
"iphone/6..latest",
"opera/15..latest",
"safari/latest"
],
"harness": "mocha-bdd",
"files": "test/*.js"
},
"scripts": {
"compile": "./node_modules/.bin/browserify ./src/index.js -s Bitcoin | ./node_modules/.bin/uglifyjs > bitcoinjs-min.js",
"coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- --reporter list test/*.js",
"coveralls": "npm run-script coverage && node ./node_modules/.bin/coveralls < coverage/lcov.info",
"integration": "./node_modules/.bin/_mocha --reporter list test/integration/*.js",
"jshint": "./node_modules/.bin/jshint --config jshint.json src/*.js ; true",
"test": "npm run-script unit",
"unit": "./node_modules/.bin/istanbul test ./node_modules/.bin/_mocha -- --reporter list `find test -maxdepth 1 -not -type d`"
},
"browser": {
"crypto": "crypto-browserify"
},
"dependencies": {
"bigi": "1.1.0",
"bs58": "1.1.0",
"bs58check": "1.0.0",
"crypto-js": "3.1.2-3",
"crypto-browserify": "2.1.8",
"ecurve": "0.10.0",
"secure-random": "1.1.1"
"sinon": "^1.12.2"
}
}
14 changes: 6 additions & 8 deletions src/address.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var assert = require('assert')
var base58check = require('bs58check')
var typeForce = require('typeforce')
var networks = require('./networks')
var scripts = require('./scripts')

Expand All @@ -13,15 +14,15 @@ function findScriptTypeByVersion(version) {
}

function Address(hash, version) {
assert(Buffer.isBuffer(hash), 'Expected Buffer, got ' + hash)
typeForce('Buffer', hash)

assert.strictEqual(hash.length, 20, 'Invalid hash length')
assert.strictEqual(version & 0xff, version, 'Invalid version byte')

this.hash = hash
this.version = version
}

// Import functions
Address.fromBase58Check = function(string) {
var payload = base58check.decode(string)
var version = payload.readUInt8(0)
Expand All @@ -33,15 +34,12 @@ Address.fromBase58Check = function(string) {
Address.fromOutputScript = function(script, network) {
network = network || networks.bitcoin

var type = scripts.classifyOutput(script)

if (type === 'pubkeyhash') return new Address(script.chunks[2], network.pubKeyHash)
if (type === 'scripthash') return new Address(script.chunks[1], network.scriptHash)
if (scripts.isPubKeyHashOutput(script)) return new Address(script.chunks[2], network.pubKeyHash)
if (scripts.isScriptHashOutput(script)) return new Address(script.chunks[1], network.scriptHash)

assert(false, type + ' has no matching Address')
assert(false, script.toASM() + ' has no matching Address')
}

// Export functions
Address.prototype.toBase58Check = function () {
var payload = new Buffer(21)
payload.writeUInt8(this.version, 0)
Expand Down
18 changes: 18 additions & 0 deletions src/base58check.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
var bs58check = require('bs58check')

function decode() {
console.warn('bs58check will be removed in 2.0.0. require("bs58check") instead.');

return bs58check.decode.apply(undefined, arguments)
}

function encode() {
console.warn('bs58check will be removed in 2.0.0. require("bs58check") instead.');

return bs58check.encode.apply(undefined, arguments)
}

module.exports = {
decode: decode,
encode: encode
}
Loading