We're working hard to make *bitcore* the most powerful JavaScript library for working with bitcoin. Our goal is to have *bitcore* be a library that can be used by anyone interested in bitcoin, and to level expertise differences with great design and documentation.
## Community
If there are any questions, etc., please feel to ask in one of the community channels:
We're working hard to make *bitcoincashjs* the most powerful JavaScript library for working with Bitcoin Cash. Our goal is to have *bitcoincashjs* be a library that can be used by anyone interested in Bitcoin Cash.
## Quick Checklist
@ -20,7 +13,7 @@ Ideally, please make sure to run:
## Design Guidelines
These are some global design goals in bitcore that any change must adhere.
These are some global design goals in bitcoincashjs that any change must adhere.
### D1 - Naming Matters
@ -91,7 +84,7 @@ var bufferUtil = require('./util/buffer');
#### G7 - Standard Methods
When possible, bitcore objects should have standard methods on an instance prototype:
When possible, bitcoincashjs objects should have standard methods on an instance prototype:
* `toObject/toJSON` - A plain JavaScript object that `JSON.stringify` can call
* `toString` - A string representation of the instance
* `toBuffer` - A hex Buffer
@ -101,7 +94,7 @@ These should have a matching static method that can be used for instantiation:
* `fromString` - Should be able to instantiate with output from `toString`
* `fromBuffer` - Should likewise be able to instantiate from output from `toBuffer`
`JSON.stringify` and `JSON.parse` are expected to be handled outside of the scope of Bitcore methods. For example, calling `JSON.stringify` on an Bitcore object will behave as expected and call `transaction.toJSON()` and then stringify it:
`JSON.stringify` and `JSON.parse` are expected to be handled outside of the scope of BitcoinCash.js methods. For example, calling `JSON.stringify` on an BitcoinCash.js object will behave as expecte`transaction.toJSON()` and the
```javascript
var transactionString = JSON.stringify(transaction);
@ -116,7 +109,7 @@ var tx = new Transaction(data);
### Errors
#### E1 - Use bitcore.Errors
#### E1 - Use bitcoincashjs.Errors
We've designed a structure for Errors to follow and are slowly migrating to it.
@ -206,14 +199,14 @@ Don't write long tests, write helper functions to make them be as short and conc
Inputs for tests should not be generated randomly. Also, the type and structure of outputs should be checked.
#### T3 - Require 'bitcore' and Look up Classes from There
#### T3 - Require 'bitcoincashjs' and Look up Classes from There
This helps to make tests more useful as examples, and more independent of where they are placed. This also helps prevent forgetting to include all submodules in the bitcore object.
This helps to make tests more useful as examples, and more independent of where they are placed. This also helps prevent forgetting to include all submodules in the bitcoincashjs object.
Finally go to [github.com/bitpay/bitcore](https://github.com/bitpay/bitcore) in your web browser and issue a new pull request.
Finally go to [github.com/bitcoincashjs/bitcoincashjs](https://github.com/bitcoincashjs/bitcoincashjs) in your web browser and issue a new pull request.
Main contributors will review your code and possibly ask for changes before your code is pulled in to the main repository. We'll check that all tests pass, review the coding style, and check for general code correctness. If everything is OK, we'll merge your pull request and your code will be part of bitcore.
Main contributors will review your code and possibly ask for changes before your code is pulled in to the main repository. We'll check that all tests pass, review the coding style, and check for general code correctness. If everything is OK, we'll merge your pull request and your code will be part of bitcoincashjs.
If you have any questions feel free to post them to
A pure and powerful JavaScript Bitcoin Cash library.
A pure and powerful JavaScript Bitcoin *Cash* library.
## Bitcoin Cash
## Principles
Bitcoin Cash is an other powerful peer-to-peer platform for the next generation of financial technology. The decentralized nature of the Bitcoin network allows for highly resilient bitcoin infrastructure, and the developer community needs reliable, open-source tools to implement bitcoin apps and services.
## Bitcoin Cash changes
Bitcoin cash uses a different `sighash` for transaction signatures. The implementation in bitcore-cash has been tested agains the original bitcoin-cash test vectors (see sighash.json in `/test`). `bitcoin-cash` modifications in script evaluation has not been implemented yet.
An usage example of ubitcore-lib-cash can be seen at https://github.com/bitpay/copay-recovery
Bitcoin Cash is the continuation of the Bitcoin project as peer-to-peer electronic cash for the Internet.
Bitcoin Cash uses a different `SigHash` for transaction signatures. The implementation in BitcoinCash.js has been tested agains the original Bitcoin Cash test vectors (see sighash.json in `/test`). Modifications in script evaluation have not yet been implemented.
The complete docs are hosted here: [bitcore documentation](http://bitcore.io/guide/). There's also a [bitcore API reference](http://bitcore.io/api/) available generated from the JSDocs of the project, where you'll find low-level details on each bitcore utility.
The complete docs are hosted here: [BitcoinCash.js documentation](http://bitcore.io/guide/).
- [Read the Developer Guide](http://bitcore.io/guide/)
- [Read the API Reference](http://bitcore.io/api/)
To get community assistance and ask for help with implementation questions, please use our [community forums](https://forum.bitcore.io/).
## Examples
* [Generate a random address](https://github.com/bitpay/bitcore-lib/blob/master/docs/examples.md#generate-a-random-address)
* [Generate a address from a SHA256 hash](https://github.com/bitpay/bitcore-lib/blob/master/docs/examples.md#generate-a-address-from-a-sha256-hash)
* [Import an address via WIF](https://github.com/bitpay/bitcore-lib/blob/master/docs/examples.md#import-an-address-via-wif)
* [Create a Transaction](https://github.com/bitpay/bitcore-lib/blob/master/docs/examples.md#create-a-transaction)
* [Sign a Bitcoin message](https://github.com/bitpay/bitcore-lib/blob/master/docs/examples.md#sign-a-bitcoin-message)
* [Verify a Bitcoin message](https://github.com/bitpay/bitcore-lib/blob/master/docs/examples.md#verify-a-bitcoin-message)
* [Create an OP RETURN transaction](https://github.com/bitpay/bitcore-lib/blob/master/docs/examples.md#create-an-op-return-transaction)
* [Create a 2-of-3 multisig P2SH address](https://github.com/bitpay/bitcore-lib/blob/master/docs/examples.md#create-a-2-of-3-multisig-p2sh-address)
* [Spend from a 2-of-2 multisig P2SH address](https://github.com/bitpay/bitcore-lib/blob/master/docs/examples.md#spend-from-a-2-of-2-multisig-p2sh-address)
* [Generate a random address](https://github.com/bitcoincashjs/bitcoincashjs/blob/master/docs/examples.md#generate-a-random-address)
* [Generate a address from a SHA256 hash](https://github.com/bitcoincashjs/bitcoincashjs/blob/master/docs/examples.md#generate-a-address-from-a-sha256-hash)
* [Import an address via WIF](https://github.com/bitcoincashjs/bitcoincashjs/blob/master/docs/examples.md#import-an-address-via-wif)
* [Create a Transaction](https://github.com/bitcoincashjs/bitcoincashjs/blob/master/docs/examples.md#create-a-transaction)
* [Sign a Bitcoin message](https://github.com/bitcoincashjs/bitcoincashjs/blob/master/docs/examples.md#sign-a-bitcoin-message)
* [Verify a Bitcoin message](https://github.com/bitcoincashjs/bitcoincashjs/blob/master/docs/examples.md#verify-a-bitcoin-message)
* [Create an OP RETURN transaction](https://github.com/bitcoincashjs/bitcoincashjs/blob/master/docs/examples.md#create-an-op-return-transaction)
* [Create a 2-of-3 multisig P2SH address](https://github.com/bitcoincashjs/bitcoincashjs/blob/master/docs/examples.md#create-a-2-of-3-multisig-p2sh-address)
* [Spend from a 2-of-2 multisig P2SH address](https://github.com/bitcoincashjs/bitcoincashjs/blob/master/docs/examples.md#spend-from-a-2-of-2-multisig-p2sh-address)
## Security
We're using Bitcore in production, as are [many others](http://bitcore.io#projects), but please use common sense when doing anything related to finances! We take no responsibility for your implementation decisions.
BitcoinCash.js is built upon Bitcore, which is used in production at Bitpay and many other [projects](http://bitcore.io#projects).
If you find a security issue, please email security@bitpay.com.
If you find a security issue, please email bitcoincashjs@tuta.io.
## Contributing
Please send pull requests for bug fixes, code optimization, and ideas for improvement. For more information on how to contribute, please refer to our [CONTRIBUTING](https://github.com/bitpay/bitcore-lib/blob/master/CONTRIBUTING.md) file.
Please send pull requests for bug fixes, code optimization, and ideas for improvement. For more information on how to contribute, please refer to our [CONTRIBUTING](https://github.com/bitcoincashjs/bitcoincashjs/blob/master/CONTRIBUTING.md) file.
## Building the Browser Bundle
To build a bitcore-lib full bundle for the browser:
To build a bitcoincashjs full bundle for the browser:
```sh
gulp browser
```
This will generate files named `bitcore-lib.js` and `bitcore-lib.min.js`.
You can also use our pre-generated files, provided for each release along with a PGP signature by one of the project's maintainers. To get them, checkout a release commit (for example, https://github.com/bitpay/bitcore-lib/commit/e33b6e3ba6a1e5830a079e02d949fce69ea33546 for v0.12.6).
Bitcoin is a powerful new peer-to-peer platform for the next generation of financial technology. The decentralized nature of the Bitcoin network allows for highly resilient bitcoin infrastructure, and the developer community needs reliable, open-source tools to implement bitcoin apps and services. Bitcore provides a reliable API for JavaScript apps that need to interface with Bitcoin.
## Bitcoin Cash
To get started, just `npm install bitcore` or `bower install bitcore`.
Bitcoin Cash is the continuation of the Bitcoin project as peer-to-peer electronic cash for the Internet.
Bitcoin Cash uses a different `SigHash` for transaction signatures. The implementation in BitcoinCash.js has been tested agains the original Bitcoin Cash test vectors (see sighash.json in `/test`). Modifications in script evaluation have not yet been implemented.
To get started, just `npm install --save bitcoincashjs` or `bower install bitcoincashjs`.