<p>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.</p>

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

<ol>
<li>create a new location for the chain, e.g. ~/.bcoin/testnet/</li>
<li>copy the above config with the updated prefix as per the above</li>
<li>execute
<code>bcoin --prefix ~/.bcoin/testnet/</code></li>
</ol>

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

CC BY-SA 3.0
2017-07-18T14:46:19.293Z
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 up
arshbot
CC BY-SA 3.0
2017-07-17T19:24:19.390Z
2017-07-17T19:24:19.390Z
user54671
<p>As stated by the <a href="https://github.com/bcoin-org/bcoin/wiki/Configuration" rel="nofollow noreferrer">configuration page</a>, you set </p>

<p><code>network: testnet</code></p>

<p>In your bcoin.conf file.</p>

CC BY-SA 3.0
2017-07-16T19:44:32.130Z
See the question again, I updated it with an error related to this solution (provided by the documentation)
arshbot
CC BY-SA 3.0
2017-07-16T19:46:26.330Z
Did you add the `network: testnet` to your config file?
MattyAB
CC BY-SA 3.0
2017-07-16T19:49:45.913Z
Yes, the error occurs when using that config file. The command I use to specify the conf file is `bcoin -config=~/.bcoin/bcoin.conf`
arshbot
CC BY-SA 3.0
2017-07-16T18:53:13.227Z
2017-07-16T19:14:06.253Z
2017-07-16T19:14:06.253Z
MattyAB
<p>In the documentation you can specify a network param, but the default <code>main</code> network name isn't the same as bitcoind (<code>livenet</code>). What is the name of testnet on bcoin? </p>

<p>EDIT: When going by the documentation and adding <code>network: testnet</code> to bcoin.conf, I get the error </p>

<pre><code>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.&lt;anonymous&gt; (/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)
</code></pre>

<p>My bcoin.conf file is</p>

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

CC BY-SA 3.0
2017-07-16T19:16:18.723Z
Are you referring to http://bcoin.io/ ??
Marc Alexander
CC BY-SA 3.0
2017-07-16T19:45:20.100Z
Yep! And alternate to bitcoind
arshbot
CC BY-SA 3.0
2017-07-17T19:00:45.687Z
Just curious what is the advantage of bcoin to bitcoind?
Marc Alexander
CC BY-SA 3.0
2017-07-18T14:42:08.380Z
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
<testnet><documentation>
How to run bcoin on testnet?
arshbot
# How to run bcoin on testnet?

(Asked by: username_0 on 2017-07-16)

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. (/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

**Tags:** testnet, documentation

> **Comments:**
> **username_1**: Are you referring to http://bcoin.io/ ??  
> **username_0**: Yep! And alternate to bitcoind  
> **username_1**: Just curious what is the advantage of bcoin to bitcoind?  
> **username_0**: 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.  

---

## 2 answers

### Answer by username_2 on 2017-07-17. Score: 0 | Accepted answer

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

> **Comments:**
> **username_0**: 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 up  

---

### Answer by username_3 on 2017-07-16. Score: 0

As stated by the [configuration page](https://github.com/bcoin-org/bcoin/wiki/Configuration), you set

`network: testnet`

In your bcoin.conf file.

> **Comments:**
> **username_0**: See the question again, I updated it with an error related to this solution (provided by the documentation)  
> **username_3**: Did you add the `network: testnet` to your config file?  
> **username_0**: Yes, the error occurs when using that config file. The command I use to specify the conf file is `bcoin -config=~/.bcoin/bcoin.conf`  

---

