How to run bcoin on testnet?

2

In the documentation you can specify a network param, but the default main network name isn't the same as bitcoind (livenet). What is the name of testnet on bcoin?

EDIT: When going by the documentation and adding network: testnet to bcoin.conf, I get the error

AssertionError [ERR_ASSERTION]: Unknown network.
at Function.create (/usr/local/lib/node_modules/bcoin/lib/protocol/network.js:161:3)
at Function.get (/usr/local/lib/node_modules/bcoin/lib/protocol/network.js:207:20)
at FullNode.Node (/usr/local/lib/node_modules/bcoin/lib/node/node.js:43:26)
at new FullNode (/usr/local/lib/node_modules/bcoin/lib/node/fullnode.js:46:8)
at Object.<anonymous> (/usr/local/lib/node_modules/bcoin/bin/node:12:8)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)

My bcoin.conf file is

network: testnet
prefix: ~/.bcoin
prune: true
http-port: 8332
api-key: ******
uri: http://localhost

arshbot

Posted 2017-07-16T18:25:33.300

Reputation: 753

Are you referring to http://bcoin.io/ ??

Marc Alexander 2017-07-16T19:16:18.723

Yep! And alternate to bitcoindarshbot 2017-07-16T19:45:20.100

Just curious what is the advantage of bcoin to bitcoind?Marc Alexander 2017-07-17T19:00:45.687

Very modular, entirely written in node.js, has an extensive api built out so you can easily build on top of a node (previously only possible with bitcore), and has an active team whose focus seems to be making this more developer friendly. For example, I'm building a mobile wallet with bcoin as a local backend (without using the node functionality). You can't do that with bitcoind.arshbot 2017-07-18T14:42:08.380

Answers

0

This might be as a result of a previous ChainDB having been initialized at ~/.bcoin/chain.ldb/ . You can find information inside of the debug.log file. e.g.

[I:2017-07-17T09:11:47Z] (chaindb) Opening ChainDB... [E:2017-07-17T09:11:47Z] (node) Network mismatch for chain.

  1. create a new location for the chain, e.g. ~/.bcoin/testnet/
  2. copy the above config with the updated prefix as per the above
  3. execute bcoin --prefix ~/.bcoin/testnet/

Default prefix is "~/.bcoin/", you can override this by using the prefix cli flag

user54671

Posted 2017-07-16T18:25:33.300

Reputation: 16

To add to this, you can specify a config file with bcoin --config=~/.bcoin/bcoin.conf (your config location) or you can set a different config file in the testnet or main folder and bcoin should pick it uparshbot 2017-07-18T14:46:19.293

0

As stated by the configuration page, you set

network: testnet

In your bcoin.conf file.

MattyAB

Posted 2017-07-16T18:25:33.300

Reputation: 11

See the question again, I updated it with an error related to this solution (provided by the documentation)arshbot 2017-07-16T19:44:32.130

Did you add the network: testnet to your config file?MattyAB 2017-07-16T19:46:26.330

Yes, the error occurs when using that config file. The command I use to specify the conf file is bcoin -config=~/.bcoin/bcoin.confarshbot 2017-07-16T19:49:45.913