FIBOS Module
fibos example objects
Usage:
1 | var fibos = require('fibos') |
Example attribute
data_dir
Fibos data storage directory
Type:String
1 | fibos.data_dir = './fibos_data_dir'; |
config_dir
fibos configuration directory
Type:String
1 | fibos.config_dir = './fibos_config_dir'; |
core_symbol
fibos main token name
Type:String
1 | fibos.core_symbol = 'FO'; |
pubkey_prefix
fibos public key prefix
Type:String
1 | fibos.pubkey_prefix = 'FO'; |
enableJSContract
Query and set the JavaScript smart contract state, support JavaScript smart contracts when True
Type:Boolean
1 | fibos.enableJSContract = true; |
Example function
load
loading load itself‘s contiguration
1 | fibos.load(cfgs); |
Parameters:
- cfgs : Object ,adjust object.
load system plugin and configurations
1 | fibos.load( name, cfg ); |
Parameters:
- name : String ,system plugin name.
- cfg : Object ,Provide system plugin config.[Optional]
start
start fibos
1 | fibos.start(); |
stop
stop fibos
1 | fibos.stop(); |
system plugin
Note: Please use system plugin with fibos.load example
http plugin
start all RPC API on FIBOS node
Configurations:
Config name | Config note | default | example |
---|---|---|---|
http-server-address | local http server address | 127.0.0.1:8888 | |
https-server-address | local https server address | - | |
max-body-size | maximum byte allowed for RPC request | 1024*1024(bytes) | |
verbose-http-errors | show Http error log | false | |
http-validate-host | verify Http request host | true | |
access-control-allow-origin | return special Access-Control-Allow-Origin for each request | - | * |
chain plugin
Core plugin of FIBOS node, used to process and aggregate chain data
configurations:
config name | config note | default | example |
---|---|---|---|
genesis-json | Specifies the genesis block data path | - | file path example file[FIBOS MainNet]https://github.com/FIBOS-Community/fibos-nodes/blob/master/genesis.json) |
genesis-timestamp | Overrides the initial timestamp in the genesis block | - | - |
print-genesis-json | Whether to print genesis data | false | - |
fix-reversible-blocks | Whether to restore the data to the irreversible height | false | -(unable to use) |
replay-blockchain | Whether to clear state data and then roll back all data | false | -(Cannot be used, presumably for command line use?) |
hard-replay-blockchain | Whether to clear state data and then roll back as much data as possible from the block log | false | - |
delete-all-blocks | Whether to delete all state data and block data | false | - |
truncate-at-block | stop producing,And roll back at the block height | 0 | -(unable to use) |
blocks-dir | Block data storage path | blocks | - |
abi-serializer-max-time-ms | rewrite default ABI serialization timeout | 15*1000(ms) | - |
chain-state-db-size-mb | The maximum capacity allowed in a block database | 1024 (MB) | - |
chain-state-db-guard-size-mb | Nodes can be safely closed when the remaining data in the block database is less than this size | 128(MB) | - |
reversible-blocks-db-size-mb | Maximum amount of data that can be rolled back | 340(MB) | - |
contracts-console | if print contract output | false | - |
read-mode | mode database contains changes done up to the head block plus changes made by transactions not yet included to the blockchain mode database contains changes done up to the current head block. | speculative | - |
net plugin
compose a network
configurations:
config name | config note | default | example |
---|---|---|---|
p2p-listen-endpoint | listen address and port of p2p link | 0.0.0.0:9876 | - |
p2p-server-addrsss | Provide p2p service address to other nodes | p2p-listen-endpoint | - |
p2p-peer-address | public p2p node address | - | FIBOS TestNet [ 103.80.170.107:9876 ] |
p2p-max-nodes-per-host | Maximum number of clients that a single IP can connect to | 1 | - |
allowed-connection | allow to connect | any | ‘any’/‘producers’/‘specified’/‘none’。if ‘specified’ ,Then the peer key must be specified at least once。if there is only ‘producers’ ,then the peer key is not required. |
peer-private-key | An array of public and private keys | ||
max-clients | Maximum number of clients allowed to connect | 25 | 0: Unlimited |
connection-cleanup-period | unavailable link clearing cycle | 30(s) | - |
network-version-match | Whether the same version of the network is required | false | - |
peer-log-format | Node log formatting | [“${name}” ${_ip}:${_port}] | - |
chain_api plugin
make chain_plugin’s function release to RPC API managed by http_plugin.
dependency:
- chain_plugin
- http_plugin
configurations:
api | request | note |
---|---|---|
get_info | GET | get info of node |
get_block | POST | get info of a block |
get_account | POST | get info of an account |
get_code | POST | get code of smart contract |
producer plugin
Load necessary function required by block node.
configurations:
config name | config note | default | example |
---|---|---|---|
max-transaction-time | Maximum transaction timeout | 30(s) | - |
greylist-account | account unable to use CPU and NET | - | - |
enable-stale-production | start production,even if it is static | ||
max-irreversible-block-age | Maximum irreversible block time | -1 | >1 |
producer-name | Control the account name of the node block | eosio(Can be more parameters) | |
private-key | The public and private keys of the signature program | (can be more parameters) |
bnet plugin
provided a P2P protocol, uses very simple algorithm sync 2 chains permanently
configurations:
config name | config note | default | example |
---|---|---|---|
bnet-endpoint: | The endpoint of the incoming link to which are listening | 0.0.0.0:4321 | |
bnet-follow-irreversible | Whether to accept only irreversible blocks from other endpoints | false | |
bnet-threads | Number of threads used to process network messages | ||
bnet-connect | Remote endpoint connections to other nodes; According to the requirement to use multiple bnet-connect option to composite an network | ||
bnet-no-trx | This peer requests that other nodes have no pending transactions | false | false |
Example
bp node
1 | var fibos = require('fibos'); |
sync node
1 | var fibos = require('fibos'); |
genesis.json file
1 | { |