hsk: rename to hsk.

This commit is contained in:
Christopher Jeffrey 2018-02-01 13:28:31 -08:00
parent 6f64f8ba49
commit c090793e79
No known key found for this signature in database
GPG key ID: 8962AB9DE6666BBD
150 changed files with 8315 additions and 8883 deletions

2
.gitignore vendored
View file

@ -1,6 +1,6 @@
node_modules/
docs/reference/
docker_data/
browser/bcoin*
browser/hsk*
package-lock.json
npm-debug.log

View file

@ -4,6 +4,6 @@ docs/
docker_data/
test/
node_modules/
browser/bcoin*
browser/hsk*
package-lock.json
npm-debug.log

View file

@ -1,382 +1,6 @@
# Bcoin Release Notes & Changelog
# HSK Release Notes & Changelog
## v1.0.0
### Migration
The latest bcoin release contains almost a total rewrite of the wallet. A
migration is required.
Bcoin has also been modularized quite a bit. Users installing globally from npm
should be sure to run:
``` bash
$ npm update -g bcoin
```
For users who cloned the respository themselves, it might be wise to simply
remove the `node_modules` directory and do a fresh `npm install`.
``` bash
$ cd bcoin/
$ git pull origin master
$ rm -rf node_modules/
$ npm install
$ npm test
```
---
Once upgrading is complete, a migration script must be executed. The migration
script resides in `./migrate/latest` as an executable file.
A bcoin __prefix directory__ must be passed as the first argument.
Example:
``` bash
$ ./migrate/latest ~/.bcoin
```
What this does:
- Renames `chain.ldb` to `chain`.
- Renames `spvchain.ldb` to `spvchain`.
- Renames `walletdb.ldb` to `wallet`.
- Runs a migration (`chaindb3to4.js`) on `chain`.
- Runs a migration (`chaindb3to4.js`) on `spvchain`.
- Runs a migration (`walletdb6to7.js`) on `wallet`.
The chain migration should be minor, and only taxing if you have
`--index-address` enabled.
If you have a testnet, regtest, or simnet directory, the migration must also be
run on these, e.g.
``` bash
$ ./migrate/latest ~/.bcoin/testnet
```
Also note that the `--prefix` argument now __always__ creates a fully-fledged
prefix directory. For example `--prefix ~/.bcoin_whatever --network testnet`
will create a directory structure of `~/.bcoin_whatever/testnet/` instead of
`~/.bcoin_whatever`. Please update your directory structure accordingly.
### Bcoin Client Changes
The `bcoin cli` interface has been deprecated and is now replaced with a
separate tool: `bcoin-cli`. `bcoin wallet` has also been deprecated and is
replaced with `bwallet-cli`. Both `bcoin-cli` and `bwallet-cli` can be
installed with the `bclient` package in npm.
### Wallet API Changes
The main wallet API changes have to do with changes in the structure of the
HTTP server itself. The bcoin wallet HTTP server will now always listen on it's
own port. Standard ports are:
```
main: 8334
testnet: 18334
regtest: 48334
simnet: 18558
```
The default account object is no longer present on the wallet. To retrieve it,
request `/wallet/:id/account/default` instead. More minor changes to the JSON
output include the removal of `id` and `wid` properties on a number of objects.
Please update your code accordingly.
For socket.io events, all `wallet ` prefixes have been removed. For example,
`wallet join` should be replaced with simply `join`. All wallet-related events
(`tx`, `confirmed`, etc) now receive the wallet ID as the first argument. The
`tx` event will receive `[id, details]` instead of `[details]`.
The `_admin` endpoints have been moved up a level. Instead of requesting
`/wallet/_admin/backup` (for example), request `/backup` instead. If
`--wallet-auth` is enabled, a new flag `--admin-token` is accepted. Admin token
is a 64 character hex string and allows access to all admin routes. For
example, `GET /backup?token=xxx...`. It also allows access to any wallet on the
HTTP or websocket layer (websockets who use the admin token can join a wallet
of `*`, which notifies them of events on _all_ wallets).
### Notable Changes
- __wallet/http__ - A `conflict` event will be correctly emitted for _all_
double spends.
- __wallet/http__ - Account balances are now indexed and will appear on account
objects via the API.
- __bcoin__ - Bcoin has been rewritten using class syntax. Objects will not be
inheritable with legacy prototypal inheritance.
- __pkg__ - Bcoin is once again buildable with browserify.
- __pkg__ - Numerous modules have been moved out to separate dependencies. For
example, the `lib/crypto` module has been moved to the `bcrypto` package (and
also heavily optimized even further).
- __bcoin__ - The main `bcoin` module has been rewritten in terms of what it
exposes and how. Conventions have changed (`Address` instead of `address`).
Due to the use of class syntax, something like `bcoin.Address(str)` is no
longer possible. Please take a look at `lib/bcoin.js` to get a better idea of
what has changed.
## v1.0.0-beta.15
### Notable Changes
## v1.0.0-beta.14
### Notable Changes
- __pkg__ - Ignored `bcoin*` files in npmignore have been removed. This fixes
the npm install.
## v1.0.0-beta.13
### Notable Changes
- __config__ - Options using megabyte units are now calculated properly again
(6182df044228f9215938e7d314435f3f2640acca,
a630d23a97b68f189a85105856fedc4e9e515754,
7728a0047053d4c368e60426e5fc7cc812d54caf).
- __address__ - Bech32 addresses are now supported
(6acef06cbc87a3051ba238a2fb640562e718135e). This changes the semantics of
the `Address` object: to support bech32, `Address.fromBase58` calls should be
replaced with `Address.fromString`. Likewise, `addr.toBase58` calls should
be replaced with `addr.toString`
- __rpc__ - `getblockbyheight` is now exposed via JSON-RPC. It takes the same
parameters as the `getblock` call, requiring a height instead of block hash
(12d3ee6f9582afa9a3ba8984c63dcbc27b8db57e).
- __bin__ - `bcoin --version` and `bcoin --help` now exit with appropriate
messages (f2f94a800e37c5dbdda6920fa6b85fbd485c212a).
- __net__ - The p2p pool now exposes an `--only` option
(a1d0948f2e528c5d77d6502659fafd064b1e693b).
- __mempool__ - The mempool `indexAddress` option should now work correctly
(fba9b46d253c19bbf8e662d9d75ab03dc9e20a78).
- __rpc__ - JSON-RPC calls now properly cast booleans a la bitcoin core
(dd49ee076196d2353783e3044185165dbac4aeb9).
- __rpc__ - Various RPC calls have been improved and updated
(c78707ed6a71ce46c41c4e43ecb505e78a84b380,
c1e684dc12d0a86573a905d54d4f81fce921987a,
5bde338a53117b1bd0fd92df0abc23d95180ab32).
- __rpc__ - Retroactive pruning is now available via the `pruneblockchain` call
(f0bc6d5925419ba4a8289fa7828efc48ecc152d4).
- __http__ - Getting block by height via the Rest API now works again
(df4c8cc68c965bd818a5004354d2652751d4a702).
- __net__ - Peers who serve invalid orphans are now punished properly
(0ceca23cb5a3d724c79c6bf587ede5d473df8486).
- __utils__ - An implementation of GCS filters is now supported
(b994c278f25408886c3095d0c24123baaf07f78f).
- __http__ - The `witness` option is now properly exposed on the Rest API for
segwit wallets (f04ad612b216becd35765c6e231f7820c7eee358).
- __deps__ - Node.js >=v7.6.0 is now a required dependency
(a0bd9680fed07c5eb37c227d160b0868f8adaf31).
- __build__ - The browser build has switched from browserify to webpack
(19f236f74072d473123d20282d2119f6d9130458).
- __bcoin__ - The codebase has been rewritten to use all ES6 and ES7 features
supported by node.js
(aa05bb5df79d9a3af53060a4c0c066226f6e9e4c,
78d62c73b82e1953999d1cf80c90ed2035d4996e,
e00472891df5934d8fc3aa63662f852816aa86b0,
c53f4cf89e46d9de8ab7f65430310567558fe03f,
8c7279518f5341a2482a79ac98f0574468541edc).
- __workers__ - The worker pool has been refactored to solve the dissonance
between the browser and node.js (27c60ce76e57af1695d78f912227d93194812c88).
- __net__ - DNS requests should now timeout sooner
(647b6909c6d527eb82f6d789c88a23b2f8a60126).
- __http__ - Satoshi values are now required for all JSON serialization, as
opposed to BTC strings which were used in the past
(2f51fd1c5066f194a5a52383f4dd45497b882706).
- __bin__ - The `--no-wallet` flag is now exposed for nodes who want to run
without a wallet.
- __chain__ - BIP91 support is now exposed via the `--bip91` option. The
`segwit` and `segsignal` rules will be automatically added when calling
`getblocktemplate`. To enable bip91 on an existing database `--force-flags`
must be passed. This will force bip91 to be enforced, but will not invalidate
any previous blocks (`bcoin cli reset [height]` may need to be used).
- __chain__ - BIP148 support is now exposed via the `--bip148` option. This
likewise must be enabled with `--force-flags` on existing chains. This has
the same potential "reset" implications as the `--bip91` option.
### Migrating
This release contains a few non-backward-compatible changes.
Bcoin now requires node.js >=7.6.0 due to the use of ES6/7 features, and for
the sake of more stability.
Bcoin's rest API now assumes satoshi values for in all JSON serialization.
__This is a breaking change__ for code that is not aware of it. All code which
hits the rest API must be updated to use only satoshi values as opposed to BTC
strings.
In other words, this:
``` json
{
"unconfirmed": "1.12",
"confirmed": "1.12"
}
```
Becomes this:
``` json
{
"unconfirmed": 112000000,
"confirmed": 112000000
}
```
## v1.0.0-beta.12
### Notable Changes
- __networks__ - Fixed simnet wpkh prefix.
- __http__ - `wallet join` without wallet auth has been fixed for responses.
This was causing a hanging issue with the client.
## v1.0.0-beta.11
### Notable Changes
- __networks__ - Simnet params have been fixed.
- __cli__ - Chain reset call has been fixed.
## v1.0.0-beta.10
### Notable Changes
- __wallet/http__ - Create wallet route modified
(`POST /wallet/:id?` changed to `PUT /wallet/:id`).
- __wallet/http__ - Create account route modified
(`POST /wallet/:id/account/:account?` changed to
`PUT /wallet/:id/account/:account`).
- __wallet/http__ - `auth` socket.io event name for wallet auth changed to
`wallet auth`.
- __config__ - `payout-address` option was changed to `coinbase-address`.
- __node__ - Plugin system is now exposed.
See https://github.com/bcoin-org/bcoin/pull/156.
- __config__ - The internal API for the config object has been rewritten
and is now more reusable, particularly by node plugins.
- __http/rpc__ - Both the HTTPBase and RPCBase objects now allow "mounting" by
other rpc and http servers.
- __wallet__ - The wallet code has been completely removed from the node, and
now resides entirely within one module. The wallet is exposed only as a
plugin or a separate server.
- __rpc__ - `prioritisetransaction` is now exposed properly (`deltaFee`s are
now tracked on mempool entries).
- __rpc__ - Proper `id` and error codes are now implemented.
- __rpc__ - Several `getblocktemplate` improvements have been implemented for
more accuracy. e.g. `curtime` will now be updated each call.
- __mining__ - The internal miner API has been rewritten, and now mimics
stratum in a sense.
- __chain__ - Faster verification with checkpoints.
- __net__ - Fixed a potential block stalling issue.
- __net__ - Hardcoded seeds for main added. Makes
for better shipping with browsers.
- __wsproxy/proxysocket__ - DNS resolution is no longer exposed.
- __logger__ - Log files now trim to 20mb on boot.
- __hostlist__ - A persistent `hosts` file is now written by default.
## v1.0.0-beta.9
### Notable Changes
- __mempool__ - Trimming now removes dependency chains by cumulative fee rate.
- __mempool__ - Cumulative descendant fees are now updated properly when
removing a transaction.
- __net__ - Preliminary upnp support for adding port mappings.
- __chain/mempool/miner__ - Various atomicity fixes and extra sanity checking.
- __pool/peer__ - Peer height is now tracked and exposed on the RPC as
`bestheight`.
## v1.0.0-beta.8
### Notable Changes
- __mempool__ - Fixed critical fee estimator bug causing throwing in the
mempool.
## v1.0.0-beta.7
### Notable Changes
- __http__ - Always display spent coins in tx routes (e.g. `/tx/[txid]`).
- __mempool__ - An on-disk mempool is now exposed via `--persistent-mempool`
(also makes fee data persistent).
- __chain__ - `chain.add` now takes a `flags` parameter to avoid POW and
non-contextual checks if necessary.
- __net__ - HostList is now potentially persistent with a `hostLocation` option.
- __net__ - Smarter stall behavior and timeouts.
## v1.0.0-beta.6
### Notable Changes
- __http__ - Better bitcoind compatability for JSON-RPC.
## v1.0.0-beta.5
### Notable Changes
- __miner__ - Better fee rate comparisons.
- __deps__ - Upgrade deps, fix build on arm and windows.
## v1.0.0-beta.4
### Notable Changes
- __miner__ - Optimized TX sorting.
- __rpc__ - Improved getblocktemplate to provide more
accurate results to bitcoind.
## v1.0.0-beta.3
### Notable Changes
- __miner__ - Improved fee rate sorting.
- __rpc__ - Fix incompatibilities in rpc api (getblocktemplate & submitblock).
## v1.0.0-beta.2
### Notable Changes
- __pool__ - Increase max header chain failures to 500 (prevents the initial
sync from reverting to getblocks so frequently).
## v1.0.0-beta.1
### Notable Changes
- __wsproxy__: Fixed proof of work handling in websocket proxy (43c491b).
- __chain__: Optimized MTP and network target calculations (1e07d1b).
- __wallet__: Implemented "smart" coin selection (304f0e7e).
- __protocol__: Increased default network fees for main (09c2357).
- __http__: Fix for handling `DELETE` http method (393dd5d).
- __miner__: Improved handling of default reserved size and sigops (f2964e0
and 7104e4c).
## v1.0.0-beta
## v0.0.0
### Notable Changes

View file

@ -1,54 +1,32 @@
# Bcoin
# HSK
__NOTE__: The latest release of bcoin contains a non-backward compatible change
to the rest API. Please read the [changelog]'s "migrating" section for more
details.
---
**Bcoin** is an alternative implementation of the bitcoin protocol, written in
node.js.
Bcoin is well tested and aware of all known consensus rules. It is currently
used in production as the consensus backend and wallet system for
[purse.io][purse].
## Uses
- Full Node
- SPV Node
- Wallet Backend (bip44 derivation)
- Mining Backend (getblocktemplate support)
- Layer 2 Backend (lightning)
- General Purpose Bitcoin Library
Try it in the browser: http://bcoin.io/browser.html
**HSK** is an implementation of the Handshake Protocol.
## Install
```
$ git clone git://github.com/bcoin-org/bcoin.git
$ cd bcoin
$ git clone git://github.com/handshakecompany/hsk.git
$ cd hsk
$ npm install
$ ./bin/bcoin
$ ./bin/hsk
```
See the [Beginner's Guide][guide] for more in-depth installation instructions.
## Documentation
- API Docs: http://bcoin.io/docs/
- REST Docs: http://bcoin.io/api-docs/index.html
- API Docs: http://handshake.org/docs/
- REST Docs: http://handshake.org/api-docs/index.html
- Docs: [docs/](docs/README.md)
## Support
Join us on [freenode][freenode] in the [#bcoin][irc] channel.
Join us on [freenode][freenode] in the [#handshake][irc] channel.
## Disclaimer
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
HSK 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.
## Contribution and License Agreement
@ -59,13 +37,11 @@ all code is your original work. `</legalese>`
## License
- Copyright (c) 2014-2015, Fedor Indutny (MIT License).
- Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
- Copyright (c) 2017-2018, Christopher Jeffrey (MIT License).
See LICENSE for more info.
[purse]: https://purse.io
[guide]: https://github.com/bcoin-org/bcoin/blob/master/docs/Beginner's-Guide.md
[guide]: https://github.com/handshakecompany/hsk/blob/master/docs/Beginner's-Guide.md
[freenode]: https://freenode.net/
[irc]: irc://irc.freenode.net/bcoin
[changelog]: https://github.com/bcoin-org/bcoin/blob/master/CHANGELOG.md
[irc]: irc://irc.freenode.net/handshake
[changelog]: https://github.com/handshakecompany/hsk/blob/master/CHANGELOG.md

View file

@ -1,69 +0,0 @@
#!/bin/bash
rl=0
daemon=0
cmd='node'
if ! type perl > /dev/null 2>& 1; then
if uname | grep -i 'darwin' > /dev/null; then
echo 'Bcoin requires perl to start on OSX.' >& 2
exit 1
fi
rl=1
fi
if test $rl -eq 1; then
file=$(readlink -f "$0")
else
# Have to do it this way
# because OSX isn't a real OS
file=$(perl -MCwd -e "print Cwd::realpath('$0')")
fi
dir=$(dirname "$file")
if test x"$1" = x'cli'; then
shift
exec "${dir}/cli" "$@"
exit 1
fi
if test x"$1" = x'wallet'; then
exec "${dir}/cli" "$@"
exit 1
fi
if test x"$1" = x'rpc'; then
exec "${dir}/cli" "$@"
exit 1
fi
for arg in "$@"; do
case "$arg" in
--daemon)
daemon=1
;;
--spv)
cmd='spvnode'
;;
esac
done
if test $daemon -eq 1; then
# And yet again, OSX doesn't support something.
if ! type setsid > /dev/null 2>& 1; then
(
"${dir}/${cmd}" "$@" > /dev/null 2>& 1 &
echo "$!"
)
exit 0
fi
(
setsid "${dir}/${cmd}" "$@" > /dev/null 2>& 1 &
echo "$!"
)
exit 0
else
exec "${dir}/${cmd}" "$@"
exit 1
fi

View file

@ -1,55 +0,0 @@
#!/bin/bash
rl=0
daemon=0
if ! type perl > /dev/null 2>& 1; then
if uname | grep -i 'darwin' > /dev/null; then
echo 'Bcoin requires perl to start on OSX.' >& 2
exit 1
fi
rl=1
fi
if test $rl -eq 1; then
file=$(readlink -f "$0")
else
# Have to do it this way
# because OSX isn't a real OS
file=$(perl -MCwd -e "print Cwd::realpath('$0')")
fi
dir=$(dirname "$file")
if test x"$1" = x'cli'; then
shift
exec "${dir}/cli" "wallet" "$@"
exit 1
fi
for arg in "$@"; do
case "$arg" in
--daemon)
daemon=1
;;
esac
done
if test $daemon -eq 1; then
# And yet again, OSX doesn't support something.
if ! type setsid > /dev/null 2>& 1; then
(
"${dir}/wallet" "$@" > /dev/null 2>& 1 &
echo "$!"
)
exit 0
fi
(
setsid "${dir}/wallet" "$@" > /dev/null 2>& 1 &
echo "$!"
)
exit 0
else
exec "${dir}/wallet" "$@"
exit 1
fi

View file

@ -3,8 +3,8 @@
'use strict';
console.error('%s%s',
'Warning: The `bcoin cli` interface is deprecated.\n',
'Please use `bcoin-cli` ($ npm install bclient).');
'Warning: The `hsk cli` interface is deprecated.\n',
'Please use `hsk-cli` ($ npm install bclient).');
if (process.argv.length > 2 && process.argv[2] === 'wallet') {
process.argv.splice(2, 1); // Evil hack.

View file

@ -1,4 +1,4 @@
# Sample bcoin config file (~/.bcoin/bcoin.conf)
# Sample hsk config file (~/.hsk/hsk.conf)
#
# Options
@ -10,7 +10,7 @@
# Node
#
prefix: ~/.bcoin
prefix: ~/.hsk
db: leveldb
max-files: 64
cache-size: 100
@ -95,7 +95,7 @@ identity-key: 74b4147957813b62cc8987f2b711ddb31f8cb46dcbf71502033da66053c8780a
# Miner
#
coinbase-flags: mined by bcoin
coinbase-flags: mined by hsk
# coinbase-address: 1111111111111111111114oLvT2,1111111111111111111114oLvT2
preverify: false
max-block-weight: 4000000

View file

@ -1,125 +0,0 @@
/*!
* 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/bcoin-org/bcoin
*/
'use strict';
/**
* A bcoin "environment" which exposes all
* constructors for primitives, the blockchain,
* mempool, wallet, etc. It also exposes a
* global worker pool.
*
* @exports bcoin
* @type {Object}
*/
const bcoin = exports;
/**
* Set the default network.
* @param {String} network
*/
bcoin.set = function set(network) {
bcoin.Network.set(network);
return bcoin;
};
/*
* Expose
*/
// Blockchain
bcoin.blockchain = require('./blockchain');
bcoin.Chain = require('./blockchain/chain');
bcoin.ChainEntry = require('./blockchain/chainentry');
// BTC
bcoin.btc = require('./btc');
bcoin.Amount = require('./btc/amount');
bcoin.URI = require('./btc/uri');
// Coins
bcoin.coins = require('./coins');
bcoin.Coins = require('./coins/coins');
bcoin.CoinEntry = require('./coins/coinentry');
bcoin.CoinView = require('./coins/coinview');
// HD
bcoin.hd = require('./hd');
bcoin.HDPrivateKey = require('./hd/private');
bcoin.HDPublicKey = require('./hd/public');
bcoin.Mnemonic = require('./hd/mnemonic');
// Mempool
bcoin.mempool = require('./mempool');
bcoin.Fees = require('./mempool/fees');
bcoin.Mempool = require('./mempool/mempool');
bcoin.MempoolEntry = require('./mempool/mempoolentry');
// Miner
bcoin.mining = require('./mining');
bcoin.Miner = require('./mining/miner');
// Net
bcoin.net = require('./net');
bcoin.packets = require('./net/packets');
bcoin.Peer = require('./net/peer');
bcoin.Pool = require('./net/pool');
// Node
bcoin.node = require('./node');
bcoin.Node = require('./node/node');
bcoin.FullNode = require('./node/fullnode');
bcoin.SPVNode = require('./node/spvnode');
// Primitives
bcoin.primitives = require('./primitives');
bcoin.Address = require('./primitives/address');
bcoin.Block = require('./primitives/block');
bcoin.Coin = require('./primitives/coin');
bcoin.Headers = require('./primitives/headers');
bcoin.Input = require('./primitives/input');
bcoin.InvItem = require('./primitives/invitem');
bcoin.KeyRing = require('./primitives/keyring');
bcoin.MerkleBlock = require('./primitives/merkleblock');
bcoin.MTX = require('./primitives/mtx');
bcoin.Outpoint = require('./primitives/outpoint');
bcoin.Output = require('./primitives/output');
bcoin.TX = require('./primitives/tx');
// Protocol
bcoin.protocol = require('./protocol');
bcoin.consensus = require('./protocol/consensus');
bcoin.Network = require('./protocol/network');
bcoin.networks = require('./protocol/networks');
bcoin.policy = require('./protocol/policy');
// Script
bcoin.script = require('./script');
bcoin.Opcode = require('./script/opcode');
bcoin.Program = require('./script/program');
bcoin.Script = require('./script/script');
bcoin.ScriptNum = require('./script/scriptnum');
bcoin.SigCache = require('./script/sigcache');
bcoin.Stack = require('./script/stack');
bcoin.Witness = require('./script/witness');
// Utils
bcoin.utils = require('./utils');
bcoin.util = require('./utils/util');
// Wallet
bcoin.wallet = require('./wallet');
bcoin.WalletDB = require('./wallet/walletdb');
// Workers
bcoin.workers = require('./workers');
bcoin.WorkerPool = require('./workers/workerpool');
// Package Info
bcoin.pkg = require('./pkg');

View file

@ -1,146 +0,0 @@
/*!
* 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/bcoin-org/bcoin
*/
/* eslint prefer-arrow-callback: "off" */
'use strict';
/**
* A bcoin "environment" which exposes all
* constructors for primitives, the blockchain,
* mempool, wallet, etc. It also exposes a
* global worker pool.
*
* @exports bcoin
* @type {Object}
*/
const bcoin = exports;
/**
* Define a module for lazy loading.
* @param {String} name
* @param {String} path
*/
bcoin.define = function define(name, path) {
let cache = null;
Object.defineProperty(bcoin, name, {
get() {
if (!cache)
cache = require(path);
return cache;
}
});
};
/**
* Set the default network.
* @param {String} network
*/
bcoin.set = function set(network) {
bcoin.Network.set(network);
return bcoin;
};
/*
* Expose
*/
// Blockchain
bcoin.define('blockchain', './blockchain');
bcoin.define('Chain', './blockchain/chain');
bcoin.define('ChainEntry', './blockchain/chainentry');
// BTC
bcoin.define('btc', './btc');
bcoin.define('Amount', './btc/amount');
bcoin.define('URI', './btc/uri');
// Coins
bcoin.define('coins', './coins');
bcoin.define('Coins', './coins/coins');
bcoin.define('CoinEntry', './coins/coinentry');
bcoin.define('CoinView', './coins/coinview');
// HD
bcoin.define('hd', './hd');
bcoin.define('HDPrivateKey', './hd/private');
bcoin.define('HDPublicKey', './hd/public');
bcoin.define('Mnemonic', './hd/mnemonic');
// Mempool
bcoin.define('mempool', './mempool');
bcoin.define('Fees', './mempool/fees');
bcoin.define('Mempool', './mempool/mempool');
bcoin.define('MempoolEntry', './mempool/mempoolentry');
// Miner
bcoin.define('mining', './mining');
bcoin.define('Miner', './mining/miner');
// Net
bcoin.define('net', './net');
bcoin.define('packets', './net/packets');
bcoin.define('Peer', './net/peer');
bcoin.define('Pool', './net/pool');
// Node
bcoin.define('node', './node');
bcoin.define('Node', './node/node');
bcoin.define('FullNode', './node/fullnode');
bcoin.define('SPVNode', './node/spvnode');
// Primitives
bcoin.define('primitives', './primitives');
bcoin.define('Address', './primitives/address');
bcoin.define('Block', './primitives/block');
bcoin.define('Coin', './primitives/coin');
bcoin.define('Headers', './primitives/headers');
bcoin.define('Input', './primitives/input');
bcoin.define('InvItem', './primitives/invitem');
bcoin.define('KeyRing', './primitives/keyring');
bcoin.define('MerkleBlock', './primitives/merkleblock');
bcoin.define('MTX', './primitives/mtx');
bcoin.define('Outpoint', './primitives/outpoint');
bcoin.define('Output', './primitives/output');
bcoin.define('TX', './primitives/tx');
// Protocol
bcoin.define('protocol', './protocol');
bcoin.define('consensus', './protocol/consensus');
bcoin.define('Network', './protocol/network');
bcoin.define('networks', './protocol/networks');
bcoin.define('policy', './protocol/policy');
// Script
bcoin.define('script', './script');
bcoin.define('Opcode', './script/opcode');
bcoin.define('Program', './script/program');
bcoin.define('Script', './script/script');
bcoin.define('ScriptNum', './script/scriptnum');
bcoin.define('SigCache', './script/sigcache');
bcoin.define('Stack', './script/stack');
bcoin.define('Witness', './script/witness');
// Utils
bcoin.define('utils', './utils');
bcoin.define('util', './utils/util');
// Wallet
bcoin.define('wallet', './wallet');
bcoin.define('Path', './wallet/path');
bcoin.define('WalletKey', './wallet/walletkey');
bcoin.define('WalletDB', './wallet/walletdb');
// Workers
bcoin.define('workers', './workers');
bcoin.define('WorkerPool', './workers/workerpool');
// Package Info
bcoin.define('pkg', './pkg');

View file

@ -1,8 +1,8 @@
/*!
* chain.js - blockchain management for bcoin
* chain.js - blockchain management for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* chaindb.js - blockchain data management for bcoin
* chaindb.js - blockchain data management for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* chainentry.js - chainentry object for bcoin
* chainentry.js - chainentry object for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* common.js - bitcoin constants for bcoin
* common.js - bitcoin constants for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* blockchain/index.js - blockchain for bcoin
* blockchain/index.js - blockchain for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* layout.js - blockchain data layout for bcoin
* layout.js - blockchain data layout for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* amount.js - amount object for bcoin
* amount.js - amount object for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* btc/index.js - high-level btc objects for bcoin
* btc/index.js - high-level btc objects for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/**
* uri.js - bitcoin uri parsing for bcoin
* uri.js - bitcoin uri parsing for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* coinentry.js - coin entry object for bcoin
* coinentry.js - coin entry object for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* coins.js - coins object for bcoin
* coins.js - coins object for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* coinview.js - coin viewpoint object for bcoin
* coinview.js - coin viewpoint object for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* compress.js - coin compressor for bcoin
* compress.js - coin compressor for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* coins/index.js - utxo management for bcoin
* coins/index.js - utxo management for hsk
* Copyright (c) 2016-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* undocoins.js - undocoins object for bcoin
* undocoins.js - undocoins object for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* chain.js - blockchain management for bcoin
* chain.js - blockchain management for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* namedb.js - name database for bcoin
* namedb.js - name database for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
HD mnemonics and keys (BIP32, BIP39) for bcoin.
HD mnemonics and keys (BIP32, BIP39).
Parts of this software were originally based on bitcore-lib:

View file

@ -1,7 +1,7 @@
/*!
* common.js - common functions for hd
* Copyright (c) 2015-2016, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* hd.js - hd keys for bcoin
* hd.js - hd keys for hsk
* Copyright (c) 2015-2016, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* hd/index.js - hd keys for bcoin
* hd/index.js - hd keys for hsk
* Copyright (c) 2014-2016, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* mnemonic.js - hd mnemonics for bcoin
* mnemonic.js - hd mnemonics for hsk
* Copyright (c) 2015-2016, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* nfkd-compat.js - unicode normalization for bcoin
* nfkd-compat.js - unicode normalization for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* nfkd.js - unicode normalization for bcoin
* nfkd.js - unicode normalization for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* private.js - hd private keys for bcoin
* private.js - hd private keys for hsk
* Copyright (c) 2015-2016, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* public.js - hd public keys for bcoin
* public.js - hd public keys for hsk
* Copyright (c) 2015-2016, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* wordlist.js - wordlists for bcoin
* wordlist.js - wordlists for hsk
* Copyright (c) 2015-2016, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* wordlist.js - wordlists for bcoin
* wordlist.js - wordlists for hsk
* Copyright (c) 2015-2016, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* index.js - wordlists for bcoin
* index.js - wordlists for hsk
* Copyright (c) 2015-2016, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

125
lib/hsk-browser.js Normal file
View file

@ -0,0 +1,125 @@
/*!
* hsk.js - a javascript bitcoin library.
* Copyright (c) 2014-2015, Fedor Indutny (MIT License).
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/handshakecompany/hsk
*/
'use strict';
/**
* An HSK "environment" which exposes all
* constructors for primitives, the blockchain,
* mempool, wallet, etc. It also exposes a
* global worker pool.
*
* @exports hsk
* @type {Object}
*/
const hsk = exports;
/**
* Set the default network.
* @param {String} network
*/
hsk.set = function set(network) {
hsk.Network.set(network);
return hsk;
};
/*
* Expose
*/
// Blockchain
hsk.blockchain = require('./blockchain');
hsk.Chain = require('./blockchain/chain');
hsk.ChainEntry = require('./blockchain/chainentry');
// BTC
hsk.btc = require('./btc');
hsk.Amount = require('./btc/amount');
hsk.URI = require('./btc/uri');
// Coins
hsk.coins = require('./coins');
hsk.Coins = require('./coins/coins');
hsk.CoinEntry = require('./coins/coinentry');
hsk.CoinView = require('./coins/coinview');
// HD
hsk.hd = require('./hd');
hsk.HDPrivateKey = require('./hd/private');
hsk.HDPublicKey = require('./hd/public');
hsk.Mnemonic = require('./hd/mnemonic');
// Mempool
hsk.mempool = require('./mempool');
hsk.Fees = require('./mempool/fees');
hsk.Mempool = require('./mempool/mempool');
hsk.MempoolEntry = require('./mempool/mempoolentry');
// Miner
hsk.mining = require('./mining');
hsk.Miner = require('./mining/miner');
// Net
hsk.net = require('./net');
hsk.packets = require('./net/packets');
hsk.Peer = require('./net/peer');
hsk.Pool = require('./net/pool');
// Node
hsk.node = require('./node');
hsk.Node = require('./node/node');
hsk.FullNode = require('./node/fullnode');
hsk.SPVNode = require('./node/spvnode');
// Primitives
hsk.primitives = require('./primitives');
hsk.Address = require('./primitives/address');
hsk.Block = require('./primitives/block');
hsk.Coin = require('./primitives/coin');
hsk.Headers = require('./primitives/headers');
hsk.Input = require('./primitives/input');
hsk.InvItem = require('./primitives/invitem');
hsk.KeyRing = require('./primitives/keyring');
hsk.MerkleBlock = require('./primitives/merkleblock');
hsk.MTX = require('./primitives/mtx');
hsk.Outpoint = require('./primitives/outpoint');
hsk.Output = require('./primitives/output');
hsk.TX = require('./primitives/tx');
// Protocol
hsk.protocol = require('./protocol');
hsk.consensus = require('./protocol/consensus');
hsk.Network = require('./protocol/network');
hsk.networks = require('./protocol/networks');
hsk.policy = require('./protocol/policy');
// Script
hsk.script = require('./script');
hsk.Opcode = require('./script/opcode');
hsk.Program = require('./script/program');
hsk.Script = require('./script/script');
hsk.ScriptNum = require('./script/scriptnum');
hsk.SigCache = require('./script/sigcache');
hsk.Stack = require('./script/stack');
hsk.Witness = require('./script/witness');
// Utils
hsk.utils = require('./utils');
hsk.util = require('./utils/util');
// Wallet
hsk.wallet = require('./wallet');
hsk.WalletDB = require('./wallet/walletdb');
// Workers
hsk.workers = require('./workers');
hsk.WorkerPool = require('./workers/workerpool');
// Package Info
hsk.pkg = require('./pkg');

146
lib/hsk.js Normal file
View file

@ -0,0 +1,146 @@
/*!
* hsk.js - a javascript bitcoin library.
* Copyright (c) 2014-2015, Fedor Indutny (MIT License).
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/handshakecompany/hsk
*/
/* eslint prefer-arrow-callback: "off" */
'use strict';
/**
* An hsk "environment" which exposes all
* constructors for primitives, the blockchain,
* mempool, wallet, etc. It also exposes a
* global worker pool.
*
* @exports hsk
* @type {Object}
*/
const hsk = exports;
/**
* Define a module for lazy loading.
* @param {String} name
* @param {String} path
*/
hsk.define = function define(name, path) {
let cache = null;
Object.defineProperty(hsk, name, {
get() {
if (!cache)
cache = require(path);
return cache;
}
});
};
/**
* Set the default network.
* @param {String} network
*/
hsk.set = function set(network) {
hsk.Network.set(network);
return hsk;
};
/*
* Expose
*/
// Blockchain
hsk.define('blockchain', './blockchain');
hsk.define('Chain', './blockchain/chain');
hsk.define('ChainEntry', './blockchain/chainentry');
// BTC
hsk.define('btc', './btc');
hsk.define('Amount', './btc/amount');
hsk.define('URI', './btc/uri');
// Coins
hsk.define('coins', './coins');
hsk.define('Coins', './coins/coins');
hsk.define('CoinEntry', './coins/coinentry');
hsk.define('CoinView', './coins/coinview');
// HD
hsk.define('hd', './hd');
hsk.define('HDPrivateKey', './hd/private');
hsk.define('HDPublicKey', './hd/public');
hsk.define('Mnemonic', './hd/mnemonic');
// Mempool
hsk.define('mempool', './mempool');
hsk.define('Fees', './mempool/fees');
hsk.define('Mempool', './mempool/mempool');
hsk.define('MempoolEntry', './mempool/mempoolentry');
// Miner
hsk.define('mining', './mining');
hsk.define('Miner', './mining/miner');
// Net
hsk.define('net', './net');
hsk.define('packets', './net/packets');
hsk.define('Peer', './net/peer');
hsk.define('Pool', './net/pool');
// Node
hsk.define('node', './node');
hsk.define('Node', './node/node');
hsk.define('FullNode', './node/fullnode');
hsk.define('SPVNode', './node/spvnode');
// Primitives
hsk.define('primitives', './primitives');
hsk.define('Address', './primitives/address');
hsk.define('Block', './primitives/block');
hsk.define('Coin', './primitives/coin');
hsk.define('Headers', './primitives/headers');
hsk.define('Input', './primitives/input');
hsk.define('InvItem', './primitives/invitem');
hsk.define('KeyRing', './primitives/keyring');
hsk.define('MerkleBlock', './primitives/merkleblock');
hsk.define('MTX', './primitives/mtx');
hsk.define('Outpoint', './primitives/outpoint');
hsk.define('Output', './primitives/output');
hsk.define('TX', './primitives/tx');
// Protocol
hsk.define('protocol', './protocol');
hsk.define('consensus', './protocol/consensus');
hsk.define('Network', './protocol/network');
hsk.define('networks', './protocol/networks');
hsk.define('policy', './protocol/policy');
// Script
hsk.define('script', './script');
hsk.define('Opcode', './script/opcode');
hsk.define('Program', './script/program');
hsk.define('Script', './script/script');
hsk.define('ScriptNum', './script/scriptnum');
hsk.define('SigCache', './script/sigcache');
hsk.define('Stack', './script/stack');
hsk.define('Witness', './script/witness');
// Utils
hsk.define('utils', './utils');
hsk.define('util', './utils/util');
// Wallet
hsk.define('wallet', './wallet');
hsk.define('Path', './wallet/path');
hsk.define('WalletKey', './wallet/walletkey');
hsk.define('WalletDB', './wallet/walletdb');
// Workers
hsk.define('workers', './workers');
hsk.define('WorkerPool', './workers/workerpool');
// Package Info
hsk.define('pkg', './pkg');

View file

@ -1,7 +1,7 @@
/*!
* fees.js - fee estimation for bcoin
* fees.js - fee estimation for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
* Ported from:
* https://github.com/bitcoin/bitcoin/blob/master/src/policy/fees.cpp
*/

View file

@ -1,7 +1,7 @@
/*!
* mempool/index.js - mempool for bcoin
* mempool/index.js - mempool for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* layout.js - mempool data layout for bcoin
* layout.js - mempool data layout for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* mempool.js - mempool for bcoin
* mempool.js - mempool for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* mempoolentry.js - mempool entry object for bcoin
* mempoolentry.js - mempool entry object for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* common.js - mining utils
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* cpuminer.js - inefficient cpu miner for bcoin (because we can)
* cpuminer.js - inefficient cpu miner for hsk (because we can)
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* mining/index.js - mining infrastructure for bcoin
* mining/index.js - mining infrastructure for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* mine.js - mining function for bcoin
* mine.js - mining function for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* miner.js - block generator for bcoin
* miner.js - block generator for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* template.js - block template object for bcoin
* template.js - block template object for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* bip150.js - peer auth.
* Copyright (c) 2016-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
* Resources:
* https://github.com/bitcoin/bips/blob/master/bip-0150.mediawiki
*/

View file

@ -1,7 +1,7 @@
/*!
* bip151.js - peer-to-peer communication encryption.
* Copyright (c) 2016-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
* Resources:
* https://github.com/bitcoin/bips/blob/master/bip-0151.mediawiki
* https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.chacha20poly1305

View file

@ -1,7 +1,7 @@
/*!
* bip152.js - compact block object for bcoin
* bip152.js - compact block object for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* common.js - p2p constants for bcoin
* common.js - p2p constants for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';
@ -50,7 +50,7 @@ exports.services = {
};
/**
* Bcoin's services (we support everything).
* Our node's services (we support everything).
* @const {Number}
* @default
*/
@ -68,7 +68,7 @@ exports.REQUIRED_SERVICES = 0
| exports.services.NETWORK;
/**
* Default user agent: `/bcoin:[version]/`.
* Default user agent: `/[pkg.name]:[version]/`.
* @const {String}
* @default
*/

View file

@ -1,8 +1,8 @@
/*!
* framer.js - packet framer for bcoin
* framer.js - packet framer for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* hostlist.js - address management for bcoin
* hostlist.js - address management for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* net/index.js - p2p for bcoin
* net/index.js - p2p for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* netaddress.js - network address object for bcoin
* netaddress.js - network address object for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* packets.js - packets for bcoin
* packets.js - packets for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* parser.js - packet parser for bcoin
* parser.js - packet parser for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
/* eslint nonblock-statement-body-position: "off" */

View file

@ -1,8 +1,8 @@
/*!
* peer.js - peer object for bcoin
* peer.js - peer object for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* pool.js - peer management for bcoin
* pool.js - peer management for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* seeds.js - seeds for bcoin
* seeds.js - seeds for hsk
* Copyright (c) 2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* fullnode.js - full node for bcoin
* fullnode.js - full node for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* server.js - http server for bcoin
* server.js - http server for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* node/index.js - node for bcoin
* node/index.js - node for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* node.js - node object for bcoin
* node.js - node object for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* rpc.js - bitcoind-compatible json rpc for bcoin.
* rpc.js - bitcoind-compatible json rpc for hsk.
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* spvnode.js - spv node for bcoin
* spvnode.js - spv node for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* pkg.js - package constants
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';
@ -12,7 +12,15 @@
* @default
*/
exports.name = 'handshake';
exports.name = 'hsk';
/**
* Organization Name
* @const {String}
* @default
*/
exports.organization = 'handshakecompany';
/**
* Currency Name
@ -31,7 +39,7 @@ exports.currency = 'handshake';
exports.unit = 'hsk';
/**
* Base Unit
* Base Unit (dollarydoos!)
* @const {String}
* @default
*/
@ -60,4 +68,4 @@ exports.version = '0.0.0';
* @default
*/
exports.url = 'https://github.com/handshakecompany/handshake';
exports.url = `https://github.com/${exports.organization}/${exports.name}`;

View file

@ -1,8 +1,8 @@
/*!
* abstractblock.js - abstract block object for bcoin
* abstractblock.js - abstract block object for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* address.js - address object for bcoin
* address.js - address object for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* block.js - block object for bcoin
* block.js - block object for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* coin.js - coin object for bcoin
* coin.js - coin object for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* covenant.js - covenant object for bcoin
* covenant.js - covenant object for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* headers.js - headers object for bcoin
* headers.js - headers object for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* primitives/index.js - bitcoin primitives for bcoin
* primitives/index.js - bitcoin primitives for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* input.js - input object for bcoin
* input.js - input object for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* invitem.js - inv item object for bcoin
* invitem.js - inv item object for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* keyring.js - keyring object for bcoin
* keyring.js - keyring object for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* memblock.js - memblock block object for bcoin
* memblock.js - memblock block object for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';
@ -24,7 +24,7 @@ const DUMMY = Buffer.alloc(0);
* data on the javascript heap. Blocks can currently
* be up to 1mb in size. In the future, they may be
* 2mb, 8mb, or maybe 20mb, who knows? A MemBlock
* is an optimization in Bcoin which defers parsing of
* is an optimization which defers parsing of
* the serialized transactions (the block Buffer) until
* the block has passed through the chain queue and
* is about to enter the chain. This keeps a lot data

View file

@ -1,8 +1,8 @@
/*!
* merkleblock.js - merkleblock object for bcoin
* merkleblock.js - merkleblock object for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* mtx.js - mutable transaction object for bcoin
* mtx.js - mutable transaction object for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* outpoint.js - outpoint object for bcoin
* outpoint.js - outpoint object for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* output.js - output object for bcoin
* output.js - output object for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* tx.js - transaction object for bcoin
* tx.js - transaction object for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* txmeta.js - extended transaction object for bcoin
* txmeta.js - extended transaction object for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';
@ -225,7 +225,7 @@ class TXMeta {
/**
* Serialize a transaction to "extended format".
* This is the serialization format bcoin uses internally
* This is the serialization format we use internally
* to store transactions in the database. The extended
* serialization includes the height, block hash, index,
* timestamp, and pending-since time.

View file

@ -1,8 +1,8 @@
/*!
* consensus.js - consensus constants and helpers for bcoin
* consensus.js - consensus constants and helpers for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';
@ -31,6 +31,14 @@ exports.EXP = 6;
exports.COIN = Math.pow(10, exports.EXP);
/**
* Maximum airdrop amount in dollarydoos (consensus).
* @const {Amount}
* @default
*/
exports.MAX_AIRDROP = 2.8e9 * exports.COIN;
/**
* Maximum amount of subsidies in dollarydoos (consensus).
* @const {Amount}
@ -45,7 +53,7 @@ exports.MAX_SUBSIDY = 1.4e9 * exports.COIN;
* @default
*/
exports.MAX_MONEY = exports.MAX_SUBSIDY;
exports.MAX_MONEY = exports.MAX_AIRDROP + exports.MAX_SUBSIDY;
/**
* Base block subsidy (consensus).

View file

@ -1,8 +1,8 @@
/*!
* errors.js - error objects for bcoin
* errors.js - error objects for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* protocol/index.js - protocol constants for bcoin
* protocol/index.js - protocol constants for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* network.js - network object for bcoin
* network.js - network object for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';
@ -376,7 +376,7 @@ Network.simnet = null;
* Set initial network.
*/
Network.set(process.env.BCOIN_NETWORK || 'main');
Network.set(process.env.HSK_NETWORK || 'main');
/*
* Helpers

View file

@ -1,8 +1,8 @@
/*!
* network.js - bitcoin networks for bcoin
* network.js - bitcoin networks for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* policy.js - bitcoin constants for bcoin
* policy.js - bitcoin constants for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* timedata.js - time management for bcoin
* timedata.js - time management for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* common.js - common script functions for bcoin
* common.js - common script functions for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,7 +1,7 @@
/*!
* script/index.js - bitcoin scripting for bcoin
* script/index.js - bitcoin scripting for hsk
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

View file

@ -1,8 +1,8 @@
/*!
* opcode.js - opcode object for bcoin
* opcode.js - opcode object for hsk
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
* https://github.com/handshakecompany/hsk
*/
'use strict';

Some files were not shown because too many files have changed in this diff Show more