testnet support

Hello,

I've added support for testnet coins. I'm assuming you won't like it as is, as it's pretty awkward, but I figured I should make a proposition first before asking for advice on how to best do it.


80 column limit, missing semicolon. Could I wonder if we could just split `constants` module into three parts:

* Common (common parts for both normal and test)
* Normal network
* Test network

And do `this.constants = constants[type]` and use `this.constants` everywhere.