Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit bed0702

Browse files
committedMar 15, 2022
Merge branch 'bitcore-documentation' of https://github.com/escottalexander/bitcore
2 parents 380870b + 373c00a commit bed0702

File tree

10 files changed

+217
-355
lines changed

10 files changed

+217
-355
lines changed
 

‎Contributing.md

Lines changed: 63 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,86 @@
1-
# Git Workflow
1+
# Submitting Issues
2+
## Bug Reports
23

3-
This project is a monorepo that uses lerna to link dependencies.
4+
A bug is a _demonstrable problem_ that is caused by the code in the repository.
5+
Good bug reports are extremely helpful - thank you!
46

5-
https://github.com/lerna/lerna
7+
Guidelines for bug reports:
68

7-
This mono repo should contain the commits from all of the packages.
9+
1. **Use the GitHub issue search** — Check if the issue has already been
10+
reported. If it already exists, consider leaving a comment with any extra clarifying
11+
details about your situation that might help us narrow in on the nature of the problem.
812

9-
Each package has it's own repo.
13+
2. **Check if the issue has already been fixed** — In the event that you are don't
14+
have the latest, try to reproduce it using the latest changes in the `master` branch.
1015

11-
## Packages
16+
3. **Submit a clear and detailed issue** — Please try to be as detailed as possible
17+
in your report. Please include the following:
18+
- Your environment, OS and/or browsers facing the issue
19+
- Steps to reproduce the issue
20+
- Specific errors thrown, stack trace etc.
21+
- The behaviour you expect vs what it's doing
1222

13-
Each package is in the packages directory.
1423

15-
Code changes that touch multiple modules should be done on the bitcore repo.
16-
This way one branch can update multiple modules.
24+
## Feature Requests
1725

18-
Lengthy developments on a single package should be done on that package's repo.
19-
Once the package is at a good point, it should be merged into the monorepo
26+
Feature requests are welcome. But take a moment to find out whether your idea
27+
fits with the scope and aims of the project. It's up to *you* to make a strong
28+
case to convince the project's developers of the merits of this feature. Please
29+
provide as much detail and context as possible.
2030

21-
## Updating Packages From Their Own Repo
2231

23-
The monorepo packages can be updated via git subtrees, then submitted to the bitcore repo as a MR
32+
# Contributing Code
2433

25-
Example:
34+
Good pull requests - patches, improvements, new features - are a fantastic
35+
help. They should remain focused in scope and avoid containing unrelated
36+
commits.
2637

27-
```sh
28-
git co -b feature/bitcore-node-update
29-
git subtree pull --prefix=packages/bitcore-node git@github.com:bitpay/bitcore-node.git branchToPull
30-
git push -u origin feature/bitcore-node-update
31-
# Create MR from origin:feature/bitcore-node-update to upstream:bitcore
32-
```
38+
Please adhere to the coding conventions used throughout this monorepo (indentation,
39+
accurate comments, etc.) and any other requirements (such as test coverage).
3340

34-
## Updating Repos from Bitcore Package
41+
Follow this process:
3542

36-
Changes to the mono repo can be pushed to the package repo.
43+
1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork,
44+
and configure the remotes:
3745

38-
```sh
39-
git subtree push --prefix=packages/bitcore-node git@github.com:micahriggan/bitcore-node.git branchToPush
40-
```
46+
```bash
47+
# Clone your fork of the repo into the current directory
48+
git clone https://github.com/<your-username>/bitcore
49+
# Navigate to the newly cloned directory
50+
cd bitcore
51+
# Assign the original repo to a remote called "upstream"
52+
git remote add upstream https://github.com/bitpay/bitcore
53+
```
4154

42-
## Adding New Packages from Existing Repos
55+
2. If you cloned a while ago, get the latest changes from upstream:
4356

44-
Packages can be added via Lerna or via git subtrees.
57+
```bash
58+
git checkout master
59+
git pull upstream master
60+
```
4561

46-
```sh
47-
lerna import ~/somedir/path-to-bitcore-repo --flatten
48-
# OR
49-
git subtree add --prefix=packages/bitcore-repo-to-add git@github.com:bitpay/bitcore-repo-to-add.git branchToAdd
50-
```
62+
3. Create a new feature branch (off the `master` branch) to
63+
contain your feature, change, or fix:
5164

52-
This will merge all of the commits into the bitcore history
65+
```bash
66+
git checkout -b <feature-branch-name>
67+
```
5368

54-
## Dev Dependencies
69+
4. Write code and commit your changes in logical chunks.
5570

56-
Dev dependencies that are used on multiple packages can be hoisted to the top-level
71+
5. Locally merge (or rebase) the upstream `master` branch into your feature branch:
72+
73+
```bash
74+
git pull [--rebase] upstream master
75+
```
76+
77+
6. Push your feature branch up to your fork:
78+
79+
```bash
80+
git push origin <feature-branch-name>
81+
```
82+
83+
7. [Open a Merge Request](https://help.github.com/articles/using-pull-requests/)
84+
with a clear title and description from your fork to the base repository (bitpay/bitcore - master).
5785

58-
Linters, formatters, and other standards can be defined top-level for the monorepo
5986

60-
This allows reuse of eslint/tslint/prettier standards for all projects.

‎README.md

Lines changed: 11 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# Bitcore
2-
3-
1+
# Bitcore Monorepo
42

53
<p align="center">
64
<img alt="npm" src="https://img.shields.io/npm/v/bitcore-lib">
@@ -11,158 +9,8 @@
119
<img src="https://circleci.com/gh/bitpay/bitcore.svg?style=shield" alt="master build">
1210
</p>
1311

14-
15-
1612
**Infrastructure to build Bitcoin and blockchain-based applications for the next generation of financial technology.**
1713

18-
## Getting Started
19-
20-
### Requirements
21-
22-
- Trusted P2P Peer
23-
- MongoDB Server >= v3.4
24-
- make g++ gcc
25-
26-
### Checkout the repo
27-
28-
29-
```sh
30-
git clone git@github.com:bitpay/bitcore.git
31-
git checkout master
32-
npm install
33-
```
34-
35-
## Setup Guide
36-
37-
### 1. Setup Bitcore config
38-
39-
<details>
40-
<summary>Example bitcore.config.json</summary>
41-
<br>
42-
43-
```json
44-
{
45-
"bitcoreNode": {
46-
"chains": {
47-
"BTC": {
48-
"mainnet": {
49-
"chainSource": "p2p",
50-
"trustedPeers": [
51-
{
52-
"host": "127.0.0.1",
53-
"port": 20008
54-
}
55-
],
56-
"rpc": {
57-
"host": "127.0.0.1",
58-
"port": 20009,
59-
"username": "username",
60-
"password": "password"
61-
}
62-
},
63-
"regtest": {
64-
"chainSource": "p2p",
65-
"trustedPeers": [
66-
{
67-
"host": "127.0.0.1",
68-
"port": 20020
69-
}
70-
],
71-
"rpc": {
72-
"host": "127.0.0.1",
73-
"port": 20021,
74-
"username": "username",
75-
"password": "password"
76-
}
77-
}
78-
},
79-
"BCH": {
80-
"mainnet": {
81-
"parentChain": "BTC",
82-
"forkHeight": 478558,
83-
"trustedPeers": [
84-
{
85-
"host": "127.0.0.1",
86-
"port": 30008
87-
}
88-
],
89-
"rpc": {
90-
"host": "127.0.0.1",
91-
"port": 30009,
92-
"username": "username",
93-
"password": "password"
94-
}
95-
},
96-
"regtest": {
97-
"chainSource": "p2p",
98-
"trustedPeers": [
99-
{
100-
"host": "127.0.0.1",
101-
"port": 30020
102-
}
103-
],
104-
"rpc": {
105-
"host": "127.0.0.1",
106-
"port": 30021,
107-
"username": "username",
108-
"password": "password"
109-
}
110-
}
111-
}
112-
}
113-
}
114-
}
115-
```
116-
117-
</details>
118-
119-
### 2. Setup Bitcoin Node
120-
121-
<details>
122-
<summary>Example Bitcoin Mainnet Config</summary>
123-
124-
```sh
125-
whitelist=127.0.0.1
126-
txindex=0
127-
listen=1
128-
server=1
129-
irc=1
130-
upnp=1
131-
132-
# Make sure port & rpcport matches the
133-
# bitcore.config.json ports for BTC mainnet
134-
135-
# if using Bitcoin Core v0.17+ prefix
136-
# [main]
137-
138-
port=20008
139-
rpcport=20009
140-
rpcallowip=127.0.0.1
141-
142-
rpcuser=username
143-
rpcpassword=password
144-
```
145-
146-
</details>
147-
148-
### 3. Run Bitcoin node
149-
150-
<details>
151-
<summary>Example Starting a Bitcoin Node</summary>
152-
153-
```sh
154-
# Path to your bitcoin application and path to the config above
155-
/Applications/Bitcoin-Qt.app/Contents/MacOS/Bitcoin-Qt -datadir=/Users/username/blockchains/bitcoin-core/networks/mainnet/
156-
```
157-
158-
</details>
159-
160-
### 4. Start Bitcore
161-
162-
```sh
163-
npm run node
164-
```
165-
16614
## Applications
16715

16816
- [Bitcore Node](packages/bitcore-node) - A full node with extended capabilities using Bitcoin Core
@@ -176,12 +24,15 @@ npm run node
17624

17725
- [Bitcore Channel](https://github.com/bitpay/bitcore-channel) - Micropayment channels for rapidly adjusting bitcoin transactions
17826
- [Bitcore ECIES](https://github.com/bitpay/bitcore-ecies) - Uses ECIES symmetric key negotiation from public keys to encrypt arbitrarily long data streams
179-
- [Bitcore Lib](packages/bitcore-lib) - A pure and powerful JavaScript Bitcoin library
180-
- [Bitcore Lib Cash](packages/bitcore-lib-cash) - A pure and powerful JavaScript Bitcoin Cash library
27+
- [Bitcore Lib](packages/bitcore-lib) - A powerful JavaScript library for Bitcoin
28+
- [Bitcore Lib Cash](packages/bitcore-lib-cash) - A powerful JavaScript library for Bitcoin Cash
29+
- [Bitcore Lib Doge](packages/bitcore-lib-doge) - A powerful JavaScript library for Dogecoin
30+
- [Bitcore Lib Litecoin](packages/bitcore-lib-ltc) - A powerful JavaScript library for Litecoin
18131
- [Bitcore Message](https://github.com/bitpay/bitcore-message) - Bitcoin message verification and signing
18232
- [Bitcore Mnemonic](packages/bitcore-mnemonic) - Implements mnemonic code for generating deterministic keys
183-
- [Bitcore P2P](packages/bitcore-p2p) - The peer-to-peer networking protocol for BTC
184-
- [Bitcore P2P Cash](packages/bitcore-p2p-cash) - The peer-to-peer networking protocol for BCH
33+
- [Bitcore P2P](packages/bitcore-p2p) - The peer-to-peer networking protocol for Bitcoin
34+
- [Bitcore P2P Cash](packages/bitcore-p2p-cash) - The peer-to-peer networking protocol for Bitcoin Cash
35+
- [Bitcore P2P Doge](packages/bitcore-p2p-doge) **DEPRECATED**[^1] - The peer-to-peer networking protocol for Dogecoin
18536
- [Crypto Wallet Core](packages/crypto-wallet-core) - A coin-agnostic wallet library for creating transactions, signing, and address derivation
18637

18738
## Extras
@@ -197,4 +48,6 @@ See [CONTRIBUTING.md](https://github.com/bitpay/bitcore/blob/master/Contributing
19748

19849
Code released under [the MIT license](https://github.com/bitpay/bitcore/blob/master/LICENSE).
19950

200-
Copyright 2013-2019 BitPay, Inc. Bitcore is a trademark maintained by BitPay, Inc.
51+
Copyright 2013-2022 BitPay, Inc. Bitcore is a trademark maintained by BitPay, Inc.
52+
53+
[^1]: The Bitcore P2P Doge library is no longer maintained as all the core functionality is contained in Bitcore P2P

‎packages/bitcore-lib/README.md

Lines changed: 65 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,27 @@
1-
# Bitcore Lib
1+
# Bitcore JavaScript Library for Bitcoin
22

33
[![NPM Package](https://img.shields.io/npm/v/bitcore-lib.svg?style=flat-square)](https://www.npmjs.org/package/bitcore-lib)
44
[![Build Status](https://img.shields.io/travis/bitpay/bitcore-lib.svg?branch=master&style=flat-square)](https://travis-ci.org/bitpay/bitcore-lib)
55
[![Coverage Status](https://img.shields.io/coveralls/bitpay/bitcore-lib.svg?style=flat-square)](https://coveralls.io/r/bitpay/bitcore-lib)
66

7-
**A pure and powerful JavaScript Bitcoin library.**
7+
**A pure and powerful JavaScript library for Bitcoin.**
88

99
## Principles
1010

11-
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.
11+
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 JavaScript Library provides a reliable API for JavaScript apps that need to interface with Bitcoin.
1212

1313
## Get Started
1414

15+
Clone the Bitcore monorepo and `npm install`:
1516
```sh
16-
npm install bitcore-lib
17+
git clone https://github.com/bitpay/bitcore.git
18+
npm install
1719
```
18-
20+
`cd` into bitcore-lib repository:
1921
```sh
20-
bower install bitcore-lib
22+
cd packages/bitcore-lib
2123
```
2224

23-
## Documentation
24-
25-
The complete docs are hosted here: [bitcore documentation](https://github.com/bitpay/bitcore). There's also a [bitcore API reference](https://github.com/bitpay/bitcore/blob/master/packages/bitcore-node/docs/api-documentation.md) available generated from the JSDocs of the project, where you'll find low-level details on each bitcore utility.
26-
27-
## Examples
28-
29-
- [Generate a random address](docs/examples.md#generate-a-random-address)
30-
- [Generate a address from a SHA256 hash](docs/examples.md#generate-a-address-from-a-sha256-hash)
31-
- [Import an address via WIF](docs/examples.md#import-an-address-via-wif)
32-
- [Create a Transaction](docs/examples.md#create-a-transaction)
33-
- [Sign a Bitcoin message](docs/examples.md#sign-a-bitcoin-message)
34-
- [Verify a Bitcoin message](docs/examples.md#verify-a-bitcoin-message)
35-
- [Create an OP RETURN transaction](docs/examples.md#create-an-op-return-transaction)
36-
- [Create a 2-of-3 multisig P2SH address](docs/examples.md#create-a-2-of-3-multisig-p2sh-address)
37-
- [Spend from a 2-of-2 multisig P2SH address](docs/examples.md#spend-from-a-2-of-2-multisig-p2sh-address)
38-
3925
## Building the Browser Bundle
4026

4127
To build a bitcore-lib full bundle for the browser:
@@ -46,27 +32,71 @@ gulp browser
4632

4733
This will generate files named `bitcore-lib.js` and `bitcore-lib.min.js`.
4834

49-
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 the [releases](https://github.com/bitpay/bitcore/blob/master/packages/bitcore-lib/CHANGELOG.md).
50-
51-
## Development & Tests
35+
## Running Tests
5236

5337
```sh
54-
git clone https://github.com/bitpay/bitcore-lib
55-
cd bitcore-lib
56-
npm install
38+
npm test
5739
```
5840

59-
Run all the tests:
41+
You can also run just the Node.js tests with `gulp test:node`, just the browser tests with `gulp test:browser` or create a test coverage report (you can open `coverage/lcov-report/index.html` to visualize it) with `gulp coverage`.
6042

61-
```sh
62-
gulp test
63-
```
43+
## Documentation
6444

65-
You can also run just the Node.js tests with `gulp test:node`, just the browser tests with `gulp test:browser` or create a test coverage report (you can open `coverage/lcov-report/index.html` to visualize it) with `gulp coverage`.
45+
### Addresses and Key Management
46+
47+
- [Addresses](docs/address.md)
48+
- [Using Different Networks](docs/networks.md)
49+
- [Private Keys](docs/privatekey.md) and [Public Keys](docs/publickey.md)
50+
- [Hierarchically-derived Private and Public Keys](docs/hierarchical.md)
51+
52+
### Payment Handling
53+
54+
- [Using Different Units](docs/unit.md)
55+
- [Acknowledging and Requesting Payments: Bitcoin URIs](docs/uri.md)
56+
- [The Transaction Class](docs/transaction.md)
57+
- [Unspent Transaction Output Class](docs/unspentoutput.md)
58+
59+
### Bitcoin Internals
60+
61+
- [Scripts](docs/script.md)
62+
- [Block](docs/block.md)
63+
64+
### Extra
65+
66+
- [Crypto](docs/crypto.md)
67+
- [Encoding](docs/encoding.md)
68+
69+
### Module Development
70+
71+
- [Browser Builds](docs/browser.md)
72+
73+
### Modules
74+
75+
Some functionality is implemented as a module that can be installed separately:
76+
77+
- [Peer to Peer Networking](https://github.com/bitpay/bitcore/tree/master/packages/bitcore-p2p)
78+
- [Bitcoin Core JSON-RPC](https://github.com/bitpay/bitcoind-rpc)
79+
- [Payment Channels](https://github.com/bitpay/bitcore-channel)
80+
- [Mnemonics](https://github.com/bitpay/bitcore/tree/master/packages/bitcore-mnemonic)
81+
- [Elliptical Curve Integrated Encryption Scheme](https://github.com/bitpay/bitcore-ecies)
82+
- [Blockchain Explorers](https://github.com/bitpay/bitcore-explorers)
83+
- [Signed Messages](https://github.com/bitpay/bitcore-message)
84+
85+
## Examples
86+
87+
- [Generate a random address](docs/examples.md#generate-a-random-address)
88+
- [Generate a address from a SHA256 hash](docs/examples.md#generate-a-address-from-a-sha256-hash)
89+
- [Import an address via WIF](docs/examples.md#import-an-address-via-wif)
90+
- [Create a Transaction](docs/examples.md#create-a-transaction)
91+
- [Sign a Bitcoin message](docs/examples.md#sign-a-bitcoin-message)
92+
- [Verify a Bitcoin message](docs/examples.md#verify-a-bitcoin-message)
93+
- [Create an OP RETURN transaction](docs/examples.md#create-an-op-return-transaction)
94+
- [Create a 2-of-3 multisig P2SH address](docs/examples.md#create-a-2-of-3-multisig-p2sh-address)
95+
- [Spend from a 2-of-2 multisig P2SH address](docs/examples.md#spend-from-a-2-of-2-multisig-p2sh-address)
6696

6797
## Security
6898

69-
We're using Bitcore in production, as are many others, but please use common sense when doing anything related to finances! We take no responsibility for your implementation decisions.
99+
We're using the Bitcore JavaScript Library in production, as are many others, but please use common sense when doing anything related to finances! We take no responsibility for your implementation decisions.
70100

71101
If you find a security issue, please email security@bitpay.com.
72102

@@ -78,4 +108,4 @@ See [CONTRIBUTING.md](https://github.com/bitpay/bitcore/blob/master/Contributing
78108

79109
Code released under [the MIT license](https://github.com/bitpay/bitcore/blob/master/LICENSE).
80110

81-
Copyright 2013-2019 BitPay, Inc. Bitcore is a trademark maintained by BitPay, Inc.
111+
Copyright 2013-2022 BitPay, Inc. Bitcore is a trademark maintained by BitPay, Inc.

‎packages/bitcore-lib/docs/browser.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Browser Builds
22

3-
Bitcore and most official submodules work in the browser, thanks to [browserify](http://browserify.org/) (some modules are not fully compatible with web browsers).
3+
Bitcore Javascript Library and most official submodules work in the browser, thanks to [browserify](http://browserify.org/) (some modules are not fully compatible with web browsers).
44

5-
The easiest and recommended way to use them, is via [Bower](http://bower.io/), a browser package manager, and get the release bundles. For example, when building an app that uses `bitcore` and `bitcore-mnemonic`, you do:
5+
The easiest and recommended way to use them, is via [Bower](http://bower.io/), a browser package manager, and get the release bundles. For example, when building an app that uses `bitcore-lib` and `bitcore-mnemonic`, you do:
66

77
```sh
88
bower install bitcore-lib

‎packages/bitcore-lib/docs/examples.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Bitcore examples
1+
# Bitcore Javascript Library examples
22

33
## Generate a random address
44

‎packages/bitcore-lib/docs/index.md

Lines changed: 0 additions & 107 deletions
This file was deleted.

‎packages/bitcore-lib/docs/transaction.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Transaction
22

3-
Bitcore provides a very simple API for creating transactions. We expect this API to be accessible for developers without knowing the working internals of bitcoin in deep detail. What follows is a small introduction to transactions with some basic knowledge required to use this API.
3+
Bitcore JavaScript Library provides a very simple API for creating transactions. We expect this API to be accessible for developers without knowing the working internals of bitcoin in deep detail. What follows is a small introduction to transactions with some basic knowledge required to use this API.
44

55
A Transaction contains a set of inputs and a set of outputs. Each input contains a reference to another transaction's output, and a signature that allows the value referenced in that output to be used in this transaction.
66

@@ -86,7 +86,7 @@ All inputs have the following five properties:
8686

8787
- `prevTxId`: a `Buffer` with the id of the transaction with the output this input is spending
8888
- `outputIndex`: a `number` the index of the output in the previous transaction
89-
- `sequenceNumber`: a `number`, the sequence number, see [bitcoin's developer guide on nLockTime and the sequence number](https://bitcoin.org/en/developer-guide#locktime-and-sequence-number).
89+
- `sequenceNumber`: a `number`, the sequence number, see [bitcoin's developer guide on nLockTime and the sequence number](https://developer.bitcoin.org/devguide/transactions.html#locktime-and-sequence-number).
9090
- `script`: the `Script` instance for this input. Usually called `scriptSig` in the bitcoin community.
9191
- `output`: if available, a `Output` instance of the output associated with this input.
9292

@@ -95,7 +95,7 @@ Both `PublicKeyHashInput` and `MultisigScriptHashInput` cache the information ab
9595
Some methods related to adding inputs are:
9696

9797
- `from`: A high level interface to add an input from a UTXO. It has a series of variants:
98-
- `from(utxo)`: add an input from an [Unspent Transaction Output](http://bitcore.io/guide/unspentoutput.html). Currently, only P2PKH outputs are supported.
98+
- `from(utxo)`: add an input from an [Unspent Transaction Output](unspentoutput.md).
9999
- `from(utxos)`: same as above, but passing in an array of Unspent Outputs.
100100
- `from(utxo, publicKeys, threshold)`: add an input that spends a UTXO with a P2SH output for a Multisig script. The `publicKeys` argument is an array of public keys, and `threshold` is the number of required signatures in the Multisig script.
101101

@@ -114,8 +114,8 @@ This input contains a set of signatures in a `signatures` property, and each tim
114114

115115
The following methods are used to manage signatures for a transaction:
116116

117-
- `getSignatures`: takes an array of `PrivateKey` or strings from which a `PrivateKey` can be instantiated; the transaction to be signed; the kind of [signature hash to use](https://bitcoin.org/en/developer-guide#signature-hash-types). Returns an array of objects with the following properties:
118-
- `signature`: an instance of [Signature](https://github.com/bitpay/bitcore/blob/master/lib/crypto/signature.js)
117+
- `getSignatures`: takes an array of `PrivateKey` or strings from which a `PrivateKey` can be instantiated; the transaction to be signed; the kind of [signature hash to use](https://developer.bitcoin.org/devguide/transactions.html#signature-hash-types). Returns an array of objects with the following properties:
118+
- `signature`: an instance of [Signature](https://github.com/bitpay/bitcore/blob/master/packages/bitcore-lib/lib/transaction/signature.js)
119119
- `prevTxId`: this input's `prevTxId`,
120120
- `outputIndex`: this input's `outputIndex`,
121121
- `inputIndex`: this input's index in the transaction
@@ -142,7 +142,7 @@ There are a series of methods used for serialization:
142142

143143
- `toObject`: Returns a plain JavaScript object with no methods and enough information to fully restore the state of this transaction. Using other serialization methods (except for `toJSON`) will cause a some information to be lost.
144144
- `toJSON`: Will be called when using `JSON.stringify` to return JSON-encoded string using the output from `toObject`.
145-
- `toString` or `uncheckedSerialize`: Returns an hexadecimal serialization of the transaction, in the [serialization format for bitcoin](https://bitcoin.org/en/developer-reference#raw-transaction-format).
145+
- `toString` or `uncheckedSerialize`: Returns an hexadecimal serialization of the transaction, in the [serialization format for bitcoin](https://developer.bitcoin.org/reference/transactions.html#raw-transaction-format).
146146
- `serialize`: Does a series of checks before serializing the transaction
147147
- `inspect`: Returns a string with some information about the transaction (currently a string formatted as `<Transaction 000...000>`, that only shows the serialized value of the transaction.
148148
- `toBuffer`: Serializes the transaction for sending over the wire in the bitcoin network
@@ -178,7 +178,7 @@ Internally, a `_changeIndex` property stores the index of the change output (so
178178

179179
## Time-Locking transaction
180180

181-
All bitcoin transactions contain a locktime field. The locktime indicates the earliest time a transaction can be added to the blockchain. Locktime allows signers to create time-locked transactions which will only become valid in the future, giving the signers a chance to change their minds. Locktime can be set in the form of a bitcoin block height (the transaction can only be included in a block with a higher height than specified) or a linux timestamp (transaction can only be confirmed after that time). For more information see [bitcoin's development guide section on locktime](https://bitcoin.org/en/developer-guide#locktime-and-sequence-number).
181+
All bitcoin transactions contain a locktime field. The locktime indicates the earliest time a transaction can be added to the blockchain. Locktime allows signers to create time-locked transactions which will only become valid in the future, giving the signers a chance to change their minds. Locktime can be set in the form of a bitcoin block height (the transaction can only be included in a block with a higher height than specified) or a linux timestamp (transaction can only be confirmed after that time). For more information see [bitcoin's development guide section on locktime](https://developer.bitcoin.org/devguide/transactions.html#locktime-and-sequence-number).
182182

183183
In bitcore, you can set a `Transaction`'s locktime by using the methods `Transaction#lockUntilDate` and `Transaction#lockUntilBlockHeight`. You can also get a friendly version of the locktime field via `Transaction#getLockTime`;
184184

@@ -192,6 +192,3 @@ console.log(transaction.getLockTime());
192192
// output similar to: Sun Nov 30 2025 00:00:00 GMT-0300 (ART)
193193
```
194194

195-
## Upcoming changes
196-
197-
We're debating an API for Merge Avoidance, CoinJoin, Smart contracts, CoinSwap, and Stealth Addresses. We're expecting to have all of them by some time in 2015. Payment channel creation is available in the [bitcore-channel](https://github.com/bitpay/bitcore-channel) module.

‎packages/bitcore-lib/docs/unit.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ To understand the need of using the `Unit` class when dealing with unit conversi
77
```javascript
88
> 81.99 * 100000 // wrong
99
8198999.999999999
10-
> var bitcore = require('bitcore');
10+
> var bitcore = require('bitcore-lib');
1111
> var Unit = bitcore.Unit;
1212
> Unit.fromMilis(81.99).toSatoshis() // correct
1313
8199000

‎packages/bitcore-lib/test/docs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe('Documentation', function() {
1010

1111
it.skip('major and minor versions should match', function() {
1212
var versionRE = /v[0-9]+\.[0-9]+/;
13-
var docIndex = fs.readFileSync('./docs/index.md', 'ascii');
13+
var docIndex = fs.readFileSync('./README.md', 'ascii');
1414
var docVersion = docIndex.match(versionRE)[0];
1515
bitcore.version.indexOf(docVersion).should.equal(0);
1616
});

‎packages/bitcore-node/README.md

Lines changed: 66 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,30 @@
22

33
**A full node with extended capabilities using Bitcoin Core.**
44

5+
## Getting Started
6+
7+
### Requirements
8+
9+
- Trusted P2P Peer
10+
- MongoDB Server >= v3.4
11+
- make g++ gcc
12+
13+
### Checkout the repo
14+
15+
16+
```sh
17+
git clone git@github.com:bitpay/bitcore.git
18+
git checkout master
19+
npm install
20+
```
21+
522
## Setup Guide
623

7-
### Example bitcore.config.json
24+
### 1. Setup Bitcore config
825

9-
Set up your bitcore.config.json file in ./bitcore
26+
<details>
27+
<summary>Example bitcore.config.json</summary>
28+
<br>
1029

1130
```json
1231
{
@@ -82,12 +101,56 @@ Set up your bitcore.config.json file in ./bitcore
82101
}
83102
```
84103

85-
Then start the node
104+
</details>
105+
106+
### 2. Setup Bitcoin Node
107+
108+
<details>
109+
<summary>Example Bitcoin Mainnet Config</summary>
110+
111+
```sh
112+
whitelist=127.0.0.1
113+
txindex=0
114+
listen=1
115+
server=1
116+
irc=1
117+
upnp=1
118+
119+
# Make sure port & rpcport matches the
120+
# bitcore.config.json ports for BTC mainnet
121+
122+
# if using Bitcoin Core v0.17+ prefix
123+
# [main]
124+
125+
port=20008
126+
rpcport=20009
127+
rpcallowip=127.0.0.1
128+
129+
rpcuser=username
130+
rpcpassword=password
131+
```
132+
133+
</details>
134+
135+
### 3. Run Bitcoin node
136+
137+
<details>
138+
<summary>Example Starting a Bitcoin Node</summary>
139+
140+
```sh
141+
# Path to your bitcoin application and path to the config above
142+
/Applications/Bitcoin-Qt.app/Contents/MacOS/Bitcoin-Qt -datadir=/Users/username/blockchains/bitcoin-core/networks/mainnet/
143+
```
144+
145+
</details>
146+
147+
### 4. Start Bitcore
86148

87149
```sh
88150
npm run node
89151
```
90152

153+
91154
## API Documentation
92155

93156
- [REST API parameters and example responses](./docs/api-documentation.md)

0 commit comments

Comments
 (0)
Please sign in to comment.