Further understanding of Baidu super chain xuper

Time:2020-10-21

preface

Previously, I wrote an article about deploying smart contract on Baidu super chain xuper and realizing the function of certificate storage. Here, we describe how to build three nodes and take node 1 as the outbound node. In this article, we configure node 1 and node 2 as the outbound node, and node 3 as the synchronization node How to configure and several points need to pay attention to, in order to avoid readers in the operation of practice into the pit or due to the lack of understanding caused by a lot of time delay

I don’t use Baidu chain for a long time, maybe I have a one-sided understanding. I write this article and I’d like to point out the mistakes or other places that need to be discussed. Please send it to my email( [email protected] )Let’s talk about it

Configure multiple outbound nodes

`Node 1 and node 2 are configured as out of block nodes
Node 3 acts as the synchronization node`

Modify the configuration of node 1

  • View the address of node 2

`cd pn2
cat data/keys/address
WJHuX9haAL7Sea6rUo8VBhhsQmMJbTopk`

  • Configuration to node 1 xuper.json in

Further understanding of Baidu super chain xuper

  • Delete configuration item

Set init_ proposer_ Neturl Configuration Item Deletion

Copy the configuration of node 1 to node 2 and node 3

`cp pn1/data/config/xuper.json pn2/data/config/xuper.json
cp pn1/data/config/xuper.json pn3/data/config/xuper.json`

Start each node

`First delete the data / blockchain / xuper folder under the node
./xchain-cli createChain
nohup ./xchain –vm ixvm &`

Confirm whether the lower node 2 is out of the block

`cd pn2
tail -f logs/xchain.log|grep ‘isCoreMiner=true’`

Thinking: do you want to delete data every time you modify the configuration

  • If the consensus algorithm is modified, it can be configured dynamically

`By way of initiating a proposal
Official documents
https://xuperchain.readthedoc…
Every time you access this document, it’s very slow. Is there a quick way to access it? `

  • If you add an output block node

`There is an interface for dynamically adding nodes, so there is no need to redo the data
In addition, when a node first joins, it synchronizes data and then blocks`

  • Modify other configurations

Data need to be redone (no company can tolerate this point. To modify a configuration, you need to delete the previous historical data and reorganize the data)

Reasons and solutions of signing errors in contract deployment

Java SDK about connection node environment

Further understanding of Baidu super chain xuper

  • The first red area is an IP and port. This address can be any node in a multi node environment, where load balancing can be done

`For example, there are three nodes to do load balancing through nginx
Therefore, the IP and port of nginx are configured here (I have no practice and guess it is OK)`

  • As for the second red circle, keys means that you are reading under the keys folder under the Resources folder private.key Private key file

`About this private key file, it is a node account
Here we use the actual process to illustrate the points for attention here`

a. Connect the node environment and read the private key file under the keys folder to obtain the account information

b. Deployment contract

`./xchain-cli wasm deploy –account [email protected] –cname eleccertest1 -a ‘{“creator”: “someone”}’ -A data/acl/addrs -o tx.output –name xuper -H localhost:37101 /Users/mengfanxiao/Documents/project/company/XinPools_INFO/document/business/baidu/xuperchain/data/blockchain/xuper/wasm/eleccert –fee 5568187 –runtime=go -a ‘{“owner”:”mengfanxiao”}’
At this time, if an error is reported
Failed to post tx:TX_SIGN_ERROR
This indicates that the private key file of the current account has not been obtained, because the private key information of the operating account needs to be obtained for signature when making a transaction. Why not obtain the private key file?
Let’s first look at which node the client is using to execute the current command, such as node 3
Then we can see which node is currently connected – H localhost:37101 This is node 1
It is OK to use the client of node 3 to connect to the service of node 1. Is there any data / keys / under the key node 3 [email protected] For this contract account
Does the private key file of the contract account exist in the private key file data / keys / directory`

ACL sign more

`Official documents
https://xuperchain.readthedoc…
ACL is used when signing multiple transactions. If multiple signatures are not required, you do not need to pay attention to this part`

The operation log did not synchronize this piece

`For example, if an error is reported in the above deployment contract command, there will be a log number
Take the log number to check the specific error information in the log file under the corresponding node service
For example, the connection above is – H localhost:37101 If it is node 1, you only need to go to node 1
The following log can find the detailed log corresponding to the log number`

Advantages and disadvantages of timing block

`On this point, what I said is not professional enough, and I use Baidu super chain for a short time, and the research is not very in-depth, so I can only say the current idea as a piece to attract jade
First of all, let’s talk about the use scenarios, and then elaborate on the problems in the use scenarios
Let’s start with bitcoin
First of all, bitcoin has a root chain in the public network, and transactions all over the world take place on this chain. If you start a bitcoin client locally, you will first synchronize the transactions on the root chain, and then the transactions initiated by yourself will also be uploaded to the root chain, and then they will be synchronized to other transaction terminals
Then look at the process of building Baidu chain
Company a has built four nodes on its own server. After the node environment is set up, eh? How is it that the block is constantly coming out? My own server Intranet has not been trading on the chain, how has been constantly out of the block? Shouldn’t the node data on the public network alliance chain be synchronized? Then realized that Baidu super chain is timed out of the block, each 3 seconds will appear a block, regardless of whether there is a transaction, will be out of the block
What are the disadvantages of this analysis
inferiority:
1. Only the data used within the company is not as large as that of other companies. In other words, a root chain is built first, and then the data on the root chain will be synchronized by the joined nodes, instead of being like other blockchains, such as bitcoin There is already a root chain on the public network that contains transactions all over the world. Then start a client and synchronize all the data
2. No matter whether there is a transaction or not, it will accumulate to a very high level, but when the business volume is relatively small, a large number of empty transaction blocks will be generated
3. Since a large number of empty transaction blocks are generated, whether it is reasonable to do block confirmation by block height difference remains to be discussed
Generally speaking, there are two ways to confirm the chain
a. According to the data of the blocks appended after the current block, if six blocks are added, that is, the height difference between the current block and the latest block, if more than six blocks are added, the current block is considered to be online
b. Querying the transaction time stamp of the current block through the timestamp and the current time difference exceeding a certain value is also considered as confirmation of online
4. Once the configuration is wrong and the configuration needs to be modified, the accumulated data must be cleared first. This is also something that no company can tolerate. Therefore, the first configuration needs to be very careful`

This paper uses mdnice typesetting

Recommended Today

What black technology does the real-time big data platform use behind the glory of the king?

Hello everyone, I’m Xu Zhenwen. Today’s topic is “Tencent game big data service application practice based on Flink + servicemesh”, which is mainly divided into the following four parts: Introduction to background and Solution Framework Real time big data computing onedata Data interface service onefun Microservice & servicemesh 1、 Introduction to the solution framework and […]