评论(0) 浏览量(317)

ChainSQL is a blockchain network based database platform, firstly to create blockchain network, and then set related database table.


Installation steps

1. Set up blockchain network system, the total number of network
nodes can not be less than 4, the number of verification nodes can  
not be less than 4 each node distributed in different IP host.
1> Start the initial node:./chainsqld.exe--conf="./chainsqld.cfg"
2> Start other nodes:./chainsqld.exe--conf="./chainsqld.cfg"--net
2. Configure the local database: open the database, manually create
a database connection, the name of the connection is the contents of the  
DB field in the sync_db configuration item of the chainsqld.cfg file.
3. Configure table information to be synchronized locally.
4. Start local common node:./chainsqld.exe--conf= "./chainsqld.cfg" - net
5. Connect local common nodes to achieve the database write operation
through the API interface.

Configuration method

Modify configuration file chainsqld.cfg
1. Basic configuration:
[node_db]: Storage metadata database type, windows set NuDB,
Ubuntu set RocksDB
2. Common node configuration:
1> Configure [port_ws_admin_local] or [port_ws_public] according to request.
2> Modify [ledger_history], full record node set full; default is 256  
(save the last 256 blocks).
3> Modify [ips], fill in the connected opposite node IP address and port number
Port number is in the configuration file of the opposite node Port in [port_peer].
4> Modify [validators], fill the public key of the trust node.
5> Modify [validation_quorum], greater than or equal to ([validators] trust node
number + 1) / 2.

3.Verify the configuration of the node:

1> All settings of common nodes;

2> Runs the following command to obtain the authentication node public key and private key (seed);

# chainsqld -q validation create


"status": "success",




"validation_seed": "ssdecohJMDPFuUPDkmG1w4objZyp4"


3> adds validation_seed and validation_public_key to the fields of validation_seed and validation_public_key;





4> Adds trustment to other validation nodes: Add public key of other validation nodes in the validators field.





4.Configuration of local required synchronization tables:

1>[sync_db]: local database connection, currently supports MySQL、PostgreSQL、SQLite3, etc..

type=mysql //corresponding to the used type of database

host=localhost //corresponding to the used IP address of database

port=3306 //corresponding to the used port of database

user=root //corresponding to the used user name of database

pass=root //corresponding to the used password of database

db=ripple //corresponding to the used name of database

firststorage=0 //close the function of consensus after importing

2>[sync_tables]: required synchronization table information settings

The name of the account, tables need to synchronize, time need to synchronize or block index (LedgerIndex), separated by spaces, such as:

# continuous synchronize table1

rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh table1

# Synchronize table2 to a point in time

rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh table2 2016-11-18_10:30:10

# synchronize table3 to block index 20000

rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh table3 20000

3>[auto_sync] 1: All new forms will automatically synchronize after the node starts. 0: Only synchronize the tables described in sync_tables