new Environment(optionsnullable)
A BCoin "environment" which is used for
bootstrapping the initial bcoin
module.
It exposes all constructors for primitives,
the blockchain, mempool, wallet, etc. It
also sets the default network if there is
one. It exposes a global TimeData
object for adjusted time, as well as a
global worker pool.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | NetworkType |
<nullable> |
Options object or network type. Properties
|
Properties:
Name | Type | Attributes | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
isBrowser |
Boolean | ||||||||||||||||||||
networkType |
NetworkType | ||||||||||||||||||||
bn |
function | Big number constructor (see https://github.com/indutny/bn.js for docs). |
|||||||||||||||||||
utils |
Object | ||||||||||||||||||||
locker |
function | Locker constructor. |
|||||||||||||||||||
reader |
function | BufferReader constructor. |
|||||||||||||||||||
writer |
function | BufferWriter constructor. |
|||||||||||||||||||
ec |
Object | ||||||||||||||||||||
lru |
function | LRU constructor. |
|||||||||||||||||||
bloom |
function | Bloom constructor. |
|||||||||||||||||||
bst |
function | BST constructor. |
|||||||||||||||||||
lowlevelup |
function | See LowlevelUp. |
|||||||||||||||||||
uri |
function | See module:uri. |
|||||||||||||||||||
protocol |
Object |
Properties
|
|||||||||||||||||||
errors |
Object |
Properties
|
|||||||||||||||||||
profiler |
function | ||||||||||||||||||||
ldb |
function | See module:ldb. |
|||||||||||||||||||
script |
function | Script constructor. |
|||||||||||||||||||
stack |
function | Stack constructor. |
|||||||||||||||||||
witness |
function | Witness constructor. |
|||||||||||||||||||
input |
function | Input constructor. |
|||||||||||||||||||
output |
function | Output constructor. |
|||||||||||||||||||
coin |
function | Coin constructor. |
|||||||||||||||||||
coins |
function | Coins constructor. |
|||||||||||||||||||
coinview |
function | CoinView constructor. |
|||||||||||||||||||
tx |
function | TX constructor. |
|||||||||||||||||||
mtx |
function | MTX constructor. |
|||||||||||||||||||
txdb |
function | TXDB constructor. |
|||||||||||||||||||
abstractblock |
function | AbstractBlock constructor. |
|||||||||||||||||||
compactblock |
function | CompactBlock constructor. |
|||||||||||||||||||
block |
function | Block constructor. |
|||||||||||||||||||
merkleblock |
function | MerkleBlock constructor. |
|||||||||||||||||||
headers |
function | Headers constructor. |
|||||||||||||||||||
node |
function | Node constructor. |
|||||||||||||||||||
spvnode |
function | SPVNode constructor. |
|||||||||||||||||||
fullnode |
function | Fullnode constructor. |
|||||||||||||||||||
chainentry |
function | ChainEntry constructor. |
|||||||||||||||||||
chaindb |
function | ChainDB constructor. |
|||||||||||||||||||
chain |
function | Chain constructor. |
|||||||||||||||||||
mempool |
function | Mempool constructor. |
|||||||||||||||||||
mempoolentry |
function | MempoolEntry constructor. |
|||||||||||||||||||
keypair |
function | KeyPair constructor. |
|||||||||||||||||||
hd |
function | HD constructor. |
|||||||||||||||||||
address |
function | Address constructor. |
|||||||||||||||||||
wallet |
function | Wallet constructor. |
|||||||||||||||||||
walletdb |
function | WalletDB constructor. |
|||||||||||||||||||
provider |
function | Provider constructor. |
|||||||||||||||||||
peer |
function | Peer constructor. |
|||||||||||||||||||
pool |
function | Pool constructor. |
|||||||||||||||||||
miner |
function | Miner constructor. |
|||||||||||||||||||
minerblock |
function | MinerBlock constructor. |
|||||||||||||||||||
http |
Object |
Properties
|
|||||||||||||||||||
workers |
Object | See module:workers. |
|||||||||||||||||||
time |
TimeData | For adjusted time. |
|||||||||||||||||||
workerPool |
Workers |
<nullable> |
Default global worker pool. |
- Source:
Methods
debug(obj, …args)
Output a debug message.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
obj |
Object | String | ||
args |
String |
<repeatable> |
- Source:
Example
bcoin.debug('foo: %d', 10);
error(err)
Output an error.
Parameters:
Name | Type | Description |
---|---|---|
err |
Error |
- Source:
mkdir(path, dirnamenullable)
Ensure a directory.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
String | ||
dirname |
Boolean |
<nullable> |
- Source:
now() → {Number}
Get the adjusted time.
- Source:
Returns:
Adjusted time.
- Type
- Number
write(msg)
Write a message to the debug log.
Parameters:
Name | Type | Description |
---|---|---|
msg |
String |
- Source: