You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 3, 2019. It is now read-only.
Copy file name to clipboardExpand all lines: docs/networks.md
+17Lines changed: 17 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,23 @@ Bitcore provides support for the main bitcoin network as well as for `testnet3`,
3
3
4
4
The `Network` namespace has a function, `get(...)` that returns an instance of a `Network` or `undefined`. The only argument to this function is some kind of identifier of the network: either its name, a reference to a Network object, or a number used as a magic constant to identify the network (for example, the value `0` that gives bitcoin addresses the distinctive `'1'` at its beginning on livenet, is a `0x6F` for testnet).
5
5
6
+
## Regtest
7
+
8
+
The regtest network is useful for development as it's possible to programmatically and instantly generate blocks for testing. It's currently supported as a variation of testnet. Here is an example of how to use regtest with the Bitcore Library:
9
+
10
+
```js
11
+
// Standard testnet
12
+
>bitcore.Networks.testnet.networkMagic;
13
+
<Buffer 0b110907>
14
+
```
15
+
16
+
```js
17
+
// Enabling testnet to use the regtest port and magicNumber
18
+
>bitcore.Networks.enableRegtest();
19
+
>bitcore.Networks.testnet.networkMagic;
20
+
<Buffer fa bf b5 da>
21
+
```
22
+
6
23
## Setting the Default Network
7
24
Most projects will only need to work with one of the networks. The value of `Networks.defaultNetwork` can be set to `Networks.testnet` if the project will need to only to work on testnet (the default is `Networks.livenet`).
0 commit comments