Skip to content

Commit

Permalink
docs: get jsdoc compiling again.
Browse files Browse the repository at this point in the history
  • Loading branch information
chjj committed Feb 4, 2017
1 parent b4a21ca commit 4e7df6e
Show file tree
Hide file tree
Showing 176 changed files with 1,763 additions and 386 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ This software is licensed under the MIT License.

Copyright (c) 2014-2015, Fedor Indutny (https://github.com/indutny)

Copyright (c) 2014-2016, Christopher Jeffrey (https://github.com/chjj)
Copyright (c) 2014-2017, Christopher Jeffrey (https://github.com/chjj)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ $ npm install
$ bcoin --fast
```

Note that the latest BCoin has not been published to NPM yet, as it is still
Note that the latest Bcoin has not been published to NPM yet, as it is still
under fairly heavy development (which may involve changing serialization
formats for the database).

Expand Down Expand Up @@ -373,7 +373,7 @@ Normal transactions in bcoin are immutable. The primary TX object contains a
bunch of consensus and policy checking methods. A lot of it is for internal use
and pretty boring for users of this library.

BCoin also offers a mutable transaction object (MTX). Mutable transactions
Bcoin also offers a mutable transaction object (MTX). Mutable transactions
inherit from the TX object, but can also be signed and modified.

``` js
Expand Down Expand Up @@ -446,7 +446,7 @@ assert(tx.getFee(mtx.view) === 40000);

The above method works, but is pretty contrived. In reality, you probably
wouldn't select inputs and calculate the fee by hand. You would want a
change output added. BCoin has a nice method of dealing with this.
change output added. Bcoin has a nice method of dealing with this.

Let's try it more realistically:

Expand Down Expand Up @@ -575,7 +575,7 @@ output.execute(stack);

## Wallet usage

BCoin maintains a wallet database which contains every wallet. Wallets are _not
Bcoin maintains a wallet database which contains every wallet. Wallets are _not
usable_ without also using a wallet database. For testing, the wallet database
can be in-memory, but it must be there.

Expand All @@ -584,7 +584,7 @@ but support was removed to reduce code complexity, and also because bip45
doesn't seem to add any benefit in practice.

The wallet database can contain many different wallets, with many different
accounts, with many different addresses for each account. BCoin should
accounts, with many different addresses for each account. Bcoin should
theoretically be able to scale to hundreds of thousands of
wallets/accounts/addresses.

Expand All @@ -602,7 +602,7 @@ TODO

## Design

BCoin is thoroughly event driven. It has a fullnode object, but BCoin was
Bcoin is thoroughly event driven. It has a fullnode object, but Bcoin was
specifically designed so the mempool, blockchain, p2p pool, and wallet database
could all be used separately. All the fullnode object does is tie these things
together. It's essentially a huge proxying of events. The general communication
Expand Down Expand Up @@ -638,7 +638,7 @@ well-written.

#### Concurrency

BCoin runs in node.js, so the javascript code is limited to one thread. We
Bcoin runs in node.js, so the javascript code is limited to one thread. We
solve this limitation by spinning up persistent worker processes for
transaction verification (webworkers when in the browser). This ensures the
blockchain and mempool do not block the master process very much. It also means
Expand All @@ -652,7 +652,7 @@ data to another process.
But of course, there is a benefit to having a multi-process architecture: the
worker processes can die on their own without disturbing the master process.

BCoin uses [secp256k1-node][secp256k1-node] for ecdsa verification, which is a
Bcoin uses [secp256k1-node][secp256k1-node] for ecdsa verification, which is a
node.js binding to Pieter Wuille's blazingly fast [libsecp256k1][libsecp256k1]
library.

Expand All @@ -669,7 +669,7 @@ visiting a webpage.

## Disclaimer

BCoin does not guarantee you against theft or lost funds due to bugs, mishaps,
Bcoin does not guarantee you against theft or lost funds due to bugs, mishaps,
or your own incompetence. You and you alone are responsible for securing your
money.

Expand All @@ -683,7 +683,7 @@ all code is your original work. `</legalese>`

Copyright (c) 2014-2015, Fedor Indutny (MIT License).

Copyright (c) 2014-2016, Christopher Jeffrey (MIT License).
Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).

See LICENSE for more info.

Expand Down
4 changes: 2 additions & 2 deletions bin/bcoin
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cmd='node'

if ! type perl > /dev/null 2>& 1; then
if uname | grep -i 'darwin' > /dev/null; then
echo 'BCoin requires perl to start.' >& 2
echo 'Bcoin requires perl to start.' >& 2
exit 1
fi
rl=1
Expand Down Expand Up @@ -51,7 +51,7 @@ done

if test $daemon -eq 1; then
if ! type setsid > /dev/null 2>& 1; then
echo 'BCoin requires setsid to start as a daemon.' >& 2
echo 'Bcoin requires setsid to start as a daemon.' >& 2
exit 1
fi
(
Expand Down
2 changes: 1 addition & 1 deletion browser/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<script src="/bcoin.js"></script>
</head>
<body>
<h1>BCoin, the browser full node</h1>
<h1>Bcoin, the browser full node</h1>
<small>Welcome. Your machine is currently validating the blockchain.
The blocks and wallet are stored on your local disk with indexed DB. You are
connecting to the actual bitcoin P2P network via a websocket-&gt;tcp proxy.
Expand Down
20 changes: 16 additions & 4 deletions lib/bcoin.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
/*!
* bcoin.js - a javascript bitcoin library.
* Copyright (c) 2014-2015, Fedor Indutny (MIT License).
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/indutny/bcoin
*/

'use strict';

/**
* Javascript bitcoin library. Exposes the global environment.
* Exposes the global environment.
* An instance of {@link Environment}.
* @module bcoin
* @see {Environment}
* @license
* Copyright (c) 2014-2015, Fedor Indutny (MIT License).
* Copyright (c) 2014-2016, Christopher Jeffrey (MIT License).
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/indutny/bcoin
*/

'use strict';

var env = require('./env');
var util = require('./utils/util');
var global = util.global;
Expand All @@ -22,4 +30,8 @@ var global = util.global;
if (util.isBrowser)
global.bcoin = env;

/*
* Expose
*/

module.exports = env;
6 changes: 5 additions & 1 deletion lib/bip70/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
/*!
* bip70.js - bip70 for bcoin
* Copyright (c) 2016, Christopher Jeffrey (MIT License).
* Copyright (c) 2016-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
*/

'use strict';

/**
* @module bip70
*/

exports.PaymentRequest = require('./paymentrequest');
exports.PaymentDetails = require('./paymentdetails');
exports.Payment = require('./payment');
Expand Down
3 changes: 2 additions & 1 deletion lib/bip70/payment.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* payment.js - bip70 payment for bcoin
* Copyright (c) 2016, Christopher Jeffrey (MIT License).
* Copyright (c) 2016-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
*/

Expand All @@ -17,6 +17,7 @@ var ProtoWriter = protobuf.ProtoWriter;

/**
* Represents a BIP70 payment.
* @alias module:bip70.Payment
* @constructor
* @param {Object?} options
* @property {Buffer} merchantData
Expand Down
4 changes: 3 additions & 1 deletion lib/bip70/paymentack.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* paymentack.js - bip70 paymentack for bcoin
* Copyright (c) 2016, Christopher Jeffrey (MIT License).
* Copyright (c) 2016-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
*/

Expand All @@ -14,6 +14,8 @@ var ProtoWriter = protobuf.ProtoWriter;

/**
* Represents a BIP70 payment ack.
* @alias module:bip70.PaymentACK
* @constructor
* @param {Object?} options
* @property {Payment} payment
* @property {String|null} memo
Expand Down
4 changes: 3 additions & 1 deletion lib/bip70/paymentdetails.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* paymentdetails.js - bip70 paymentdetails for bcoin
* Copyright (c) 2016, Christopher Jeffrey (MIT License).
* Copyright (c) 2016-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
*/

Expand All @@ -15,6 +15,8 @@ var ProtoWriter = protobuf.ProtoWriter;

/**
* Represents BIP70 payment details.
* @alias module:bip70.PaymentDetails
* @constructor
* @param {Object?} options
* @property {String|null} network
* @property {Output[]} outputs
Expand Down
6 changes: 5 additions & 1 deletion lib/bip70/paymentrequest.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* paymentrequest.js - bip70 paymentrequest for bcoin
* Copyright (c) 2016, Christopher Jeffrey (MIT License).
* Copyright (c) 2016-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
*/

Expand All @@ -18,6 +18,8 @@ var ProtoWriter = protobuf.ProtoWriter;

/**
* Represents a BIP70 payment request.
* @alias module:bip70.PaymentRequest
* @constructor
* @param {Object?} options
* @property {Number} version
* @property {String|null} pkiType
Expand Down Expand Up @@ -332,6 +334,7 @@ PaymentRequest.prototype.getCA = function getCA() {
/**
* Algorithm
* @constructor
* @ignore
*/

function Algorithm(key, hash) {
Expand All @@ -342,6 +345,7 @@ function Algorithm(key, hash) {
/**
* CA
* @constructor
* @ignore
*/

function CA(root) {
Expand Down
33 changes: 32 additions & 1 deletion lib/bip70/pk.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
/*!
* pk.js - public key algorithms for bcoin
* Copyright (c) 2016, Christopher Jeffrey (MIT License).
* Copyright (c) 2016-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
*/

'use strict';

/**
* @module bip70/pk
*/

var pk = require('../crypto/pk');

/**
* Verify signature with public key.
* @private
* @param {String} hash - Hash algorithm.
* @param {Buffer} msg
* @param {Buffer} sig
* @param {Object} key
* @returns {Boolean}
*/

exports._verify = function verify(hash, msg, sig, key) {
switch (key.alg) {
case 'rsa':
Expand All @@ -19,6 +33,15 @@ exports._verify = function verify(hash, msg, sig, key) {
}
};

/**
* Verify signature with public key.
* @param {String} hash - Hash algorithm.
* @param {Buffer} msg
* @param {Buffer} sig
* @param {Object} key
* @returns {Boolean}
*/

exports.verify = function verify(hash, msg, sig, key) {
try {
return exports._verify(hash, msg, sig, key);
Expand All @@ -27,6 +50,14 @@ exports.verify = function verify(hash, msg, sig, key) {
}
};

/**
* Sign message with private key.
* @param {String} hash - Hash algorithm.
* @param {Buffer} msg
* @param {Object} key
* @returns {Buffer}
*/

exports.sign = function sign(hash, msg, key) {
switch (key.alg) {
case 'rsa':
Expand Down
7 changes: 6 additions & 1 deletion lib/bip70/x509.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* x509.js - x509 handling for bcoin
* Copyright (c) 2016, Christopher Jeffrey (MIT License).
* Copyright (c) 2016-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
*/

Expand All @@ -12,6 +12,11 @@ var PEM = require('../utils/pem');
var util = require('../utils/util');
var crypto = require('../crypto/crypto');
var pk = require('./pk');

/**
* @exports bip70/x509
*/

var x509 = exports;

/**
Expand Down
Loading

0 comments on commit 4e7df6e

Please sign in to comment.