Guidelines
- Introduction
- Installation
- Quick Start
Guides
- Introductions
- Build local test node
- Smart Contract - ABI Files
- Smart Contract——JS Contract
- Deploy Contracts
- Test Contract
- Develop DApp Client
Smart Contracts
- Contract Introduction
- ABI File
- Database
- Account Authority
- Call In-contract
- Notification
System Contracts
- Resources
- Account
- Permission
Token Contracts
- Transfer
- Token
- Token Exchange
- Contract Sub-Wallet
Node Guide
- Node Introduction
- Add to nodes network
- Node Data Persistence
Access Guide
- FO 接入安全指南
Add to nodes network
In the last chapter, we introduced FIBOS’ node network. Now, we will join in as a node, and feel the charm of the blockchain.
fibos-nodes
fibos-nodes is a scripting tool provided by the FIBOS community, used to quick start FIBOS main net nodes. It can help developers quick start three different types of nodes.
Project link: https://github.com/FIBOS-Community/fibos-nodes
Installation
1 | git clone https://github.com/FIBOS-Community/fibos-nodes.git |
Start Up
1 | fibos bp.js // Quick start a BP node |
The default data & config storage location is /blockData/data
Full node data synchronization
Full node block data synchronization takes a long time, so the FIBOS community provides the latest mirror start serive to significantly reduce the block synch time.
Server address: http://ghost.bp.fo/
Usage
Download data:
Visit http://ghost.bp.fo/ghost/ and select the data packs you want to synch, and click download.
Or obtain the file URL, and use WGET to perform download.
1
weget http://ghost.bp.fo/ghost/data_15600397.tar.gz
Uncompress files:
1
tar -zxvSf data.tar.gz
Edit quick start script config file config.json :
Direct the data_dir parameters to the fibos-data directory from the uncompressed data files.
1
"data_dir": "fibos-data/",
Start full node
1
fibos full.js
Manual entry to FIBOS node network
If you dont use the fibos-node tool to start a node, you can also edit the start script yourself to enter into the node network.
Entering the FIBOS network confi requires and involves a few key info:
Obtain the node network chainId
TestNet:
1 | chainId : '68cee14f598d88d340b50940b6ddfba28c444b46cd5f33201ace82c78896793a' |
FIBOS Main Net:
1 | chainId : '6aa7bd33b6b45192465afa3553dedb531acaaff8928cf64b70bd4c5e49b7ec6a' |
Provide the P2P listening address and interface
1 | 'p2p-listen-endpoint' : '0.0.0.0:9870' |
Block data synch target node information
Block data synch must first synch data from current running BP nodes.
Currently, the TestNet BP node will be provided by the FIBOS foundation, the p2p address is p2p-testnet.fibos.fo:9870 and p2p-testnet-02.fibos.fo:9870
1 | 'p2p-peer-address' : ['p2p-testnet.fibos.fo:9870','p2p-testnet-02.fibos.fo:9870'] |
FIBOS Main Net nodes have already all been replaced by community nodes, for specific BP node info, please visit https://www.fibos123.com/#!/bp
1 | 'p2p-peer-address' : ['p2p.mainnet.fibos.me:80','seed-mainnet.fibscan.io:9103'] |
Note: the FIBOS Main Net BP P2P address demonstrated will variable, so please pay attention.
genesis.json File
TestNet:
1 | { |
FIBOS Main Net:
1 | { |
How to becojme a synch node
If the node is only a synch of FIBOS block data, it is very easy. Save the following codes tosync_node.js
:
1 | var fibos = require('fibos'); |
In the codes above, net
module’s p2p-peer-address
is a variable value, so please pay attention to change it.
Run synch node:
1 | fibos sync_node.js |
How to become a BP node
(* BP Block Producer)
Important Note: Use Producer ID to initiate registration application, producer key is best different from active key!
- Config Producer information to start FIBOS node servies
- Use Producer ID to initialize registration application
- Initialize voting to become a Producer.
Config Producer info to start FIBOS node services
Only if the number of votes reach a certain amount, will a FIBOS node really become a Producer, having rights to block production. Other situations are merely for existence of ID for synch block data
The following codes realize config of a Producer, saving the codes to producer_node.js
:
1 | var fibos = require('fibos'); |
Explanation for varaiable configs in the codes above:
1 | var config = { |
Run a Producer node:
1 | fibos producer_node.js |
Use Producer ID to initialize registration application
Call Method:
1 | // Initialize a fibos client |
Method Clarification:
Use fibos.js client to call eosio contract to initialize registration of BP operations
Example:
The following coves are saved to register_bp.js
:
1 | var FIBOS = require('fibos.js'); |
Example Clarification:
In the example, after configuring the FIBOS MainNe and FIBOS RPC address and FIBOS private key, initializes a FIBOS client, calling regproducerSync
to pass four parameters:
Parameter | Explanation |
---|---|
producerName | Block Producer Account Name |
publicKey | Block Producer Public Key |
url | Blopck Producer Public Website |
location | Block Producer Server Address and Location Code |
Obtain votes to become Producer
To become BP requires a certain amount of votes, you can let others vote for you, or vote for yourself. Voting requires mortgaging FO to obtain resources. Here we will explain how to mortgage for resources and how to vote.
Mortgage resources
Call Method:
1 | //Initialize a fibos client |
Method Clarification:
Use delegatebwSync
method to mortgage FO to get NET and CPU resources, used for voting.
Example:
1 | var FIBOS = require('fibos.js'); |
Example Clarification:
By configuring FIBOS Main Net chainId and Http Server address, initializes a FIBOS client, calling delegatebwSync
method, mortgaging FO to obtain resources.
Parameter | Explanation |
---|---|
from | Mortgagor |
receiver | Resource Recipient |
stake_net_quantity | Num of FO Mortgaged to obtain NET |
stake_cpu_quantity | Num of FO Mortgaged to obtain CPU |
transfer | 0: Means using own resource to mortgage for others 1: Represents giving resource to others and mortgaging them. Note: When you are mortaging resource for yourslef, can only input 0 |
Perform Voting
Call Method:
1 | //Initialize a FIBOS client |
Method Clarification:
Use voteproducerSync
method to vote for BP.
Example:
Following codes are saved to vote_bp.js
1 | var FIBOS = require('fibos.js'); |
Example Clarification:
In the codes above, the user fibostest123
votes for fibosbpnodea, fibosbpnodeb, fibosbpnodec
, the node vote list requires the developer to organize alphabetically, and the one time max is voting for 30 BP. The empty parameter represents an agent. If left empty it means voting for BP directly, if filled in represents voting through an agent to BP.
Perform Voting:
1 | fibos vote_bp.js |
Note: After voting is completed, a rank in the TOP 21 is required to be selected as block producer BP.
Claim Rewards
Producing a block as BP will earn rewards. One can use the following interface to claim the rewards:
Call Method:
1 | //Initialize a FIBOS client |
Method Clarification:
Use claimrewardsSync
method to claim BP rewards.
Example:
1 | var FIBOS = require('fibos.js'); |
Example Clarification:
The above codes shows fibosbpnode1
claiming rewards for its own block production!