23 KiB
Bcoin release notes & changelog
v2.0.0-dev
How to upgrade
The way that block data is stored has changed for greater performance, efficiency, reliability and portability.
- Block and undo block data has been moved from LevelDB into flat files.
- The transaction and address indexes have been moved into separate LevelDB databases.
- The transaction has been de-duplicated, and will reduce disk usage by
half for those running with
txindexenabled. - The
txindexandaddrindexcan now be enabled after the initial block download. - The
addrindexhas been sorted to support querying for large sets of results, and will no longer cause CPU and memory exhaustion issues. - The
addrindexwill correctly distinguish betweenp2pkhandp2wpkhaddresses.
To upgrade to the new disk layout it's necessary to move block data
from LevelDB (e.g. ~/.bcoin/chain) to a new file based block
storage (e.g. ~./.bcoin/blocks), and remove txindex and addrindex
data from the chain database, for those that have that feature enabled.
To do this you can run:
node ./migrate/chaindb4to6.js /path/to/bcoin/chain
The migration will take 1-3 hours, depending on hardware. The block data
will now be stored at /path/to/bcoin/blocks, after the data has been moved
the chain database will be compacted to free disk space.
Alternatively, you can also sync the chain again, however the above migration will be faster as additional network bandwidth won't be used for downloading the blocks again.
For those with txindex and addrindex enabled, the indexes will be
regenerated by rescanning the chain on next startup, this process can
take multiple hours (e.g. 8 hours) depending on hardware and the
index. Please take the potential downtime in re-indexing into account
before upgrading.
Wallet API changes
HTTP
PUT /wallet/:idCreating a watch-only wallet now requires anaccountKeyargument. This is to prevent bcoin from generating keys and addresses the user can not spend from.POST /wallet/:id/create- Now has a
signargument for optional signing of transactions. - Now has a
templateoption, that will skip templating inputs whensign = false, but you can enable it if necessary. It does not have an effect whensign = true. - Exposes
blocks, which can will be used if there is norateoption. - Exposes
sort(Defaulttrue), that can be used to disable BIP69 sorting.
- Now has a
RPC
- Bug fix addresses for the
getnewaddresscommand with various networks. - Deprecate the
ismineandiswatchonlyfields from thevalidateaddresscommand and addisscript,iswitness,ischange,witness_versionandwitness_programto partially match the v0.18.0 Bitcoin Core release (26a2000b01) - Add wallet RPC
getaddressinfoto returnismineandiswatchonlywith the correct values instead of their previous values which were hardcoded to false. Also returnsaddress,scriptPubKey,isscript,iswitness,witness_versionandwitness_program. (a28ffa272a)
Node API changes
HTTP
Several CPU and memory exhaustion issues have been resolved with some additional arguments for querying multiple sets of results for addresses that have many transactions.
GET /tx/address/:addresshas several new arguments:after,reverseandlimit. Theafterargument is a txid, for querying additional results after a previous result. Thereverseargument will change the order that results are returned, the default order is oldest to latest. Thelimitargument can be used to give results back in smaller sets if necessary.POST /tx/addressThis has been deprecated, instead query for each address individually withGET /tx/address/:addresswith the expectation that there could be many results that would additionally need to be queried in a subsequent query using theafterargument to request the next set.POST /coin/addressandGET /coin/address/:addressare deprecated as coins can be generated using results from/tx/address/:addressand querying by only a range of the latest transactions to stay synchronized. Coins could otherwise be removed from results at any point, and thus the entire set of results would need to be queried every time to discover which coins have been spent and are currently available.GET /has new fields.indexes.{addr,tx}for the status of indexers.
Network changes
- Regtest params have been updated to correspond with other bitcoin
implementations for cross testing. Key prefixes have been updated and
segwit is always active (
39684df605). The regtest seeds have also been cleared so that the node will not attempt to connect to itself. - Testnet seeds have been updated (
8b6eba165b)
Logging changes
- Wallet and node HTTP and RPC is now more clearly identified. The wallet
HTTP server will log with the context
wallet-httpand the RPC aswallet-rpc. The node HTTP will log with the contextnode-httpand the RPC asnode-rpc. There was also a reduction in the duplicate logs in the case of an error for the node RPC, and the addition of method logging for the wallet RPC. - There is now also additional logging during wallet rescans.
Configuration changes
- Pool options now has a
--discoveroption exposed, and the--onlynode option will disable discovery of new nodes. - The option for
coin-cachehas been removed, this setting was causing issues during the sync with out-of-memory errors and was making performance worse instead of better. - The database location for indexes can be configured via the
--index-prefixoption. Default locations areprefix+/index(e.g.~/.bcoin/testnet/index/txand~/.bcoin/testnet/index/addr).
Script changes
- Script has been updated for policy flags. For example
VERIFY_CONST_SCRIPTCODEto disableOP_CODESEPARATORin non-segwit scripts and make a positivefindAndDeleteresult invalid. - Segwit scripts that terminate with a stack size not equal to one
now has as error of
CLEANSTACKinstead ofEVAL_FALSE. VERIFY_UPGRADABLE_NOPSnow does not apply toOP_CHECKLOCKTIMEVERIFYandOP_CHECKSEQUENCEVERIFY.
Testing changes
- Switched to use a security focused rewrite of
mochacalledbmocha, for further details see: https://github.com/bcoin-org/bmocha - Data has been updated to be in sync with other implementations around policy-only script validation.
- Tests now cleanly close with all timers being cleared.
- Config file
wallet.confwon't be read during test runs that was causing issues with some testing environments.
Chain changes
- The transaction index methods are now implemented at
node.txindex:getMeta(hash)getTX(hash)hasTX(hash)getSpentView(tx)
- The address index method
getHashesByAddressis now implemented atnode.addrindex:getHashesByAddress(addr)It now acceptsAddressinstances rather thanAddress|Stringand the results are now sorted in order of appearance in the blockchain.getHashesByAddress(addr, options)A new options argument has been added with the fields:after- A transaction hash for results to begin after.limit- The total number of results to return at maximum.reverse- Will give results in order of latest to oldest.
- The following methods require
node.addrindex.getHashesByAddressin conjunction withnode.txindex.getTXandnode.txindex.getMetarespectively, and now includes a new options argument as described above forgetHashesByAddress:node.getMetaByAddress(addr, options)node.getTXByAddress(addr, options)
- The following method has been deprecated:
getCoinsByAddress(addr)
Other changes
- A new module for storing block data in files.
- Use of
buffer-mapfor storing hashes (see https://github.com/bcoin-org/bcoin/issues/533). - Use of
bsertfor assertions. SIGINThandling will close the full node, spvnode and wallet.- Using the bcoin library in a REPL now has auto-completion by pressing tab.
- Various documentation updates.
- Mempool fix to add non-standard (non-segwit) to reject cache.
- A lockfile is now included and all dependencies integrity verified with sha512 hash and not the vulnerable sha1 hash.
- Updates to dependencies including
bcryptoto version > 3. - Various small fixes to run bcoin in a browser.
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:
$ 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.
$ 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:
$ ./migrate/latest ~/.bcoin
What this does:
- Renames
chain.ldbtochain. - Renames
spvchain.ldbtospvchain. - Renames
walletdb.ldbtowallet. - Runs a migration (
chaindb3to4.js) onchain. - Runs a migration (
chaindb3to4.js) onspvchain. - Runs a migration (
walletdb6to7.js) onwallet.
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.
$ ./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.
Configuration changes
Wallet and Node are now separated and use different persistent configuration files.
Some configuration options have moved to wallet.conf, which is stored in the prefix
directory next to the existing bcoin.conf.
All configuration options in wallet.conf will have the wallet-
prefix added implicitly. The prefix is still needed when using CLI/ENV configuration
methods. The wallet now has it's own HTTP server, so options such as
wallet-http-host must also be specified along with http-host
if you require this setting (required for Docker networking).
Wallet-specific settings such as api-key and wallet-auth
have moved to wallet.conf. If using CLI/ENV options, these are prefixed with wallet-.
Various configuration method examples are shown below.
Note some config options (eg. network) are automatically passed to wallet plugin
if specified through CLI/ENV, but should be specified in wallet.conf for bwallet-cli.
Example using wallet.conf:
network: testnet
wallet-auth: true
api-key: hunter2
http-host: 0.0.0.0
Example using CLI options:
./bin/node --network=testnet --http-host=0.0.0.0 --wallet-http-host=0.0.0.0 --wallet-api-key=hunter2 --wallet-wallet-auth=true
Example using ENV:
BCOIN_NETWORK=simnet BCOIN_HTTP_HOST=0.0.0.0 BCOIN_WALLET_HTTP_HOST=0.0.0.0 BCOIN_WALLET_API_KEY=hunter2 BCOIN_WALLET_WALLET_AUTH=true ./bin/node
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
conflictevent 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/cryptomodule has been moved to thebcryptopackage (and also heavily optimized even further). - bcoin - The main
bcoinmodule has been rewritten in terms of what it exposes and how. Conventions have changed (Addressinstead ofaddress). Due to the use of class syntax, something likebcoin.Address(str)is no longer possible. Please take a look atlib/bcoin.jsto get a better idea of what has changed. - net - Support for BIP151 and BIP150 has been dropped.
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 (
6182df0442,a630d23a97,7728a00470). -
address - Bech32 addresses are now supported (
6acef06cbc). This changes the semantics of theAddressobject: to support bech32,Address.fromBase58calls should be replaced withAddress.fromString. Likewise,addr.toBase58calls should be replaced withaddr.toString -
rpc -
getblockbyheightis now exposed via JSON-RPC. It takes the same parameters as thegetblockcall, requiring a height instead of block hash (12d3ee6f95). -
bin -
bcoin --versionandbcoin --helpnow exit with appropriate messages (f2f94a800e). -
net - The p2p pool now exposes an
--onlyoption (a1d0948f2e). -
mempool - The mempool
indexAddressoption should now work correctly (fba9b46d25). -
rpc - JSON-RPC calls now properly cast booleans a la bitcoin core (
dd49ee0761). -
rpc - Various RPC calls have been improved and updated (
c78707ed6a,c1e684dc12,5bde338a53). -
rpc - Retroactive pruning is now available via the
pruneblockchaincall (f0bc6d5925). -
http - Getting block by height via the Rest API now works again (
df4c8cc68c). -
net - Peers who serve invalid orphans are now punished properly (
0ceca23cb5). -
utils - An implementation of GCS filters is now supported (
b994c278f2). -
http - The
witnessoption is now properly exposed on the Rest API for segwit wallets (f04ad612b2). -
deps - Node.js >=v7.6.0 is now a required dependency (
a0bd9680fe). -
build - The browser build has switched from browserify to webpack (
19f236f740). -
bcoin - The codebase has been rewritten to use all ES6 and ES7 features supported by node.js (
aa05bb5df7,78d62c73b8,e00472891d,c53f4cf89e,8c7279518f). -
workers - The worker pool has been refactored to solve the dissonance between the browser and node.js (
27c60ce76e). -
net - DNS requests should now timeout sooner (
647b6909c6). -
http - Satoshi values are now required for all JSON serialization, as opposed to BTC strings which were used in the past (
2f51fd1c50). -
bin - The
--no-walletflag is now exposed for nodes who want to run without a wallet. -
chain - BIP91 support is now exposed via the
--bip91option. Thesegwitandsegsignalrules will be automatically added when callinggetblocktemplate. To enable bip91 on an existing database--force-flagsmust 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
--bip148option. This likewise must be enabled with--force-flagson existing chains. This has the same potential "reset" implications as the--bip91option.
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:
{
"unconfirmed": "1.12",
"confirmed": "1.12"
}
Becomes this:
{
"unconfirmed": 112000000,
"confirmed": 112000000
}
v1.0.0-beta.12
Notable changes
- networks - Fixed simnet wpkh prefix.
- http -
wallet joinwithout 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 toPUT /wallet/:id). - wallet/http - Create account route modified
(
POST /wallet/:id/account/:account?changed toPUT /wallet/:id/account/:account). - wallet/http -
authsocket.io event name for wallet auth changed towallet auth. - config -
payout-addressoption was changed tocoinbase-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 -
prioritisetransactionis now exposed properly (deltaFees are now tracked on mempool entries). - rpc - Proper
idand error codes are now implemented. - rpc - Several
getblocktemplateimprovements have been implemented for more accuracy. e.g.curtimewill 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
hostsfile 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.addnow takes aflagsparameter to avoid POW and non-contextual checks if necessary. - net - HostList is now potentially persistent with a
hostLocationoption. - 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
DELETEhttp method (393dd5d). - miner: Improved handling of default reserved size and sigops (
f2964e0and7104e4c).
v1.0.0-beta
Notable changes
- Initial tagged release.